http://git-wip-us.apache.org/repos/asf/airavata/blob/122fb8da/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/credential/store/PasswordCredential.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/credential/store/PasswordCredential.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/credential/store/PasswordCredential.java new file mode 100644 index 0000000..f7d5db0 --- /dev/null +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/credential/store/PasswordCredential.java @@ -0,0 +1,1028 @@ +/** + * 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.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.credential.store; + +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)") +public class PasswordCredential implements org.apache.thrift.TBase<PasswordCredential, PasswordCredential._Fields>, java.io.Serializable, Cloneable, Comparable<PasswordCredential> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PasswordCredential"); + + private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField PORTAL_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("portalUserName", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField LOGIN_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("loginUserName", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("password", org.apache.thrift.protocol.TType.STRING, (short)4); + private static final org.apache.thrift.protocol.TField DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("description", org.apache.thrift.protocol.TType.STRING, (short)5); + private static final org.apache.thrift.protocol.TField PERSISTED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("persistedTime", org.apache.thrift.protocol.TType.I64, (short)6); + private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)7); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new PasswordCredentialStandardSchemeFactory()); + schemes.put(TupleScheme.class, new PasswordCredentialTupleSchemeFactory()); + } + + private String gatewayId; // required + private String portalUserName; // required + private String loginUserName; // required + private String password; // required + private String description; // optional + private long persistedTime; // optional + private String token; // 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 { + GATEWAY_ID((short)1, "gatewayId"), + PORTAL_USER_NAME((short)2, "portalUserName"), + LOGIN_USER_NAME((short)3, "loginUserName"), + PASSWORD((short)4, "password"), + DESCRIPTION((short)5, "description"), + PERSISTED_TIME((short)6, "persistedTime"), + TOKEN((short)7, "token"); + + 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: // GATEWAY_ID + return GATEWAY_ID; + case 2: // PORTAL_USER_NAME + return PORTAL_USER_NAME; + case 3: // LOGIN_USER_NAME + return LOGIN_USER_NAME; + case 4: // PASSWORD + return PASSWORD; + case 5: // DESCRIPTION + return DESCRIPTION; + case 6: // PERSISTED_TIME + return PERSISTED_TIME; + case 7: // TOKEN + return TOKEN; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __PERSISTEDTIME_ISSET_ID = 0; + private byte __isset_bitfield = 0; + private static final _Fields optionals[] = {_Fields.DESCRIPTION,_Fields.PERSISTED_TIME,_Fields.TOKEN}; + 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.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayId", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.PORTAL_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("portalUserName", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.LOGIN_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("loginUserName", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("description", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.PERSISTED_TIME, new org.apache.thrift.meta_data.FieldMetaData("persistedTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", 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(PasswordCredential.class, metaDataMap); + } + + public PasswordCredential() { + } + + public PasswordCredential( + String gatewayId, + String portalUserName, + String loginUserName, + String password) + { + this(); + this.gatewayId = gatewayId; + this.portalUserName = portalUserName; + this.loginUserName = loginUserName; + this.password = password; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public PasswordCredential(PasswordCredential other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetGatewayId()) { + this.gatewayId = other.gatewayId; + } + if (other.isSetPortalUserName()) { + this.portalUserName = other.portalUserName; + } + if (other.isSetLoginUserName()) { + this.loginUserName = other.loginUserName; + } + if (other.isSetPassword()) { + this.password = other.password; + } + if (other.isSetDescription()) { + this.description = other.description; + } + this.persistedTime = other.persistedTime; + if (other.isSetToken()) { + this.token = other.token; + } + } + + public PasswordCredential deepCopy() { + return new PasswordCredential(this); + } + + @Override + public void clear() { + this.gatewayId = null; + this.portalUserName = null; + this.loginUserName = null; + this.password = null; + this.description = null; + setPersistedTimeIsSet(false); + this.persistedTime = 0; + this.token = null; + } + + public String getGatewayId() { + return this.gatewayId; + } + + public void setGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + } + + public void unsetGatewayId() { + this.gatewayId = null; + } + + /** Returns true if field gatewayId is set (has been assigned a value) and false otherwise */ + public boolean isSetGatewayId() { + return this.gatewayId != null; + } + + public void setGatewayIdIsSet(boolean value) { + if (!value) { + this.gatewayId = null; + } + } + + public String getPortalUserName() { + return this.portalUserName; + } + + public void setPortalUserName(String portalUserName) { + this.portalUserName = portalUserName; + } + + public void unsetPortalUserName() { + this.portalUserName = null; + } + + /** Returns true if field portalUserName is set (has been assigned a value) and false otherwise */ + public boolean isSetPortalUserName() { + return this.portalUserName != null; + } + + public void setPortalUserNameIsSet(boolean value) { + if (!value) { + this.portalUserName = null; + } + } + + public String getLoginUserName() { + return this.loginUserName; + } + + public void setLoginUserName(String loginUserName) { + this.loginUserName = loginUserName; + } + + public void unsetLoginUserName() { + this.loginUserName = null; + } + + /** Returns true if field loginUserName is set (has been assigned a value) and false otherwise */ + public boolean isSetLoginUserName() { + return this.loginUserName != null; + } + + public void setLoginUserNameIsSet(boolean value) { + if (!value) { + this.loginUserName = null; + } + } + + public String getPassword() { + return this.password; + } + + public void setPassword(String password) { + this.password = password; + } + + public void unsetPassword() { + this.password = null; + } + + /** Returns true if field password is set (has been assigned a value) and false otherwise */ + public boolean isSetPassword() { + return this.password != null; + } + + public void setPasswordIsSet(boolean value) { + if (!value) { + this.password = null; + } + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public void unsetDescription() { + this.description = null; + } + + /** Returns true if field description is set (has been assigned a value) and false otherwise */ + public boolean isSetDescription() { + return this.description != null; + } + + public void setDescriptionIsSet(boolean value) { + if (!value) { + this.description = null; + } + } + + public long getPersistedTime() { + return this.persistedTime; + } + + public void setPersistedTime(long persistedTime) { + this.persistedTime = persistedTime; + setPersistedTimeIsSet(true); + } + + public void unsetPersistedTime() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID); + } + + /** Returns true if field persistedTime is set (has been assigned a value) and false otherwise */ + public boolean isSetPersistedTime() { + return EncodingUtils.testBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID); + } + + public void setPersistedTimeIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID, value); + } + + public String getToken() { + return this.token; + } + + public void setToken(String token) { + this.token = token; + } + + public void unsetToken() { + this.token = null; + } + + /** Returns true if field token is set (has been assigned a value) and false otherwise */ + public boolean isSetToken() { + return this.token != null; + } + + public void setTokenIsSet(boolean value) { + if (!value) { + this.token = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case GATEWAY_ID: + if (value == null) { + unsetGatewayId(); + } else { + setGatewayId((String)value); + } + break; + + case PORTAL_USER_NAME: + if (value == null) { + unsetPortalUserName(); + } else { + setPortalUserName((String)value); + } + break; + + case LOGIN_USER_NAME: + if (value == null) { + unsetLoginUserName(); + } else { + setLoginUserName((String)value); + } + break; + + case PASSWORD: + if (value == null) { + unsetPassword(); + } else { + setPassword((String)value); + } + break; + + case DESCRIPTION: + if (value == null) { + unsetDescription(); + } else { + setDescription((String)value); + } + break; + + case PERSISTED_TIME: + if (value == null) { + unsetPersistedTime(); + } else { + setPersistedTime((Long)value); + } + break; + + case TOKEN: + if (value == null) { + unsetToken(); + } else { + setToken((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case GATEWAY_ID: + return getGatewayId(); + + case PORTAL_USER_NAME: + return getPortalUserName(); + + case LOGIN_USER_NAME: + return getLoginUserName(); + + case PASSWORD: + return getPassword(); + + case DESCRIPTION: + return getDescription(); + + case PERSISTED_TIME: + return getPersistedTime(); + + case TOKEN: + return getToken(); + + } + 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 GATEWAY_ID: + return isSetGatewayId(); + case PORTAL_USER_NAME: + return isSetPortalUserName(); + case LOGIN_USER_NAME: + return isSetLoginUserName(); + case PASSWORD: + return isSetPassword(); + case DESCRIPTION: + return isSetDescription(); + case PERSISTED_TIME: + return isSetPersistedTime(); + case TOKEN: + return isSetToken(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof PasswordCredential) + return this.equals((PasswordCredential)that); + return false; + } + + public boolean equals(PasswordCredential that) { + if (that == null) + return false; + + boolean this_present_gatewayId = true && this.isSetGatewayId(); + boolean that_present_gatewayId = true && that.isSetGatewayId(); + if (this_present_gatewayId || that_present_gatewayId) { + if (!(this_present_gatewayId && that_present_gatewayId)) + return false; + if (!this.gatewayId.equals(that.gatewayId)) + return false; + } + + boolean this_present_portalUserName = true && this.isSetPortalUserName(); + boolean that_present_portalUserName = true && that.isSetPortalUserName(); + if (this_present_portalUserName || that_present_portalUserName) { + if (!(this_present_portalUserName && that_present_portalUserName)) + return false; + if (!this.portalUserName.equals(that.portalUserName)) + return false; + } + + boolean this_present_loginUserName = true && this.isSetLoginUserName(); + boolean that_present_loginUserName = true && that.isSetLoginUserName(); + if (this_present_loginUserName || that_present_loginUserName) { + if (!(this_present_loginUserName && that_present_loginUserName)) + return false; + if (!this.loginUserName.equals(that.loginUserName)) + return false; + } + + boolean this_present_password = true && this.isSetPassword(); + boolean that_present_password = true && that.isSetPassword(); + if (this_present_password || that_present_password) { + if (!(this_present_password && that_present_password)) + return false; + if (!this.password.equals(that.password)) + return false; + } + + boolean this_present_description = true && this.isSetDescription(); + boolean that_present_description = true && that.isSetDescription(); + if (this_present_description || that_present_description) { + if (!(this_present_description && that_present_description)) + return false; + if (!this.description.equals(that.description)) + return false; + } + + boolean this_present_persistedTime = true && this.isSetPersistedTime(); + boolean that_present_persistedTime = true && that.isSetPersistedTime(); + if (this_present_persistedTime || that_present_persistedTime) { + if (!(this_present_persistedTime && that_present_persistedTime)) + return false; + if (this.persistedTime != that.persistedTime) + return false; + } + + boolean this_present_token = true && this.isSetToken(); + boolean that_present_token = true && that.isSetToken(); + if (this_present_token || that_present_token) { + if (!(this_present_token && that_present_token)) + return false; + if (!this.token.equals(that.token)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_gatewayId = true && (isSetGatewayId()); + list.add(present_gatewayId); + if (present_gatewayId) + list.add(gatewayId); + + boolean present_portalUserName = true && (isSetPortalUserName()); + list.add(present_portalUserName); + if (present_portalUserName) + list.add(portalUserName); + + boolean present_loginUserName = true && (isSetLoginUserName()); + list.add(present_loginUserName); + if (present_loginUserName) + list.add(loginUserName); + + boolean present_password = true && (isSetPassword()); + list.add(present_password); + if (present_password) + list.add(password); + + boolean present_description = true && (isSetDescription()); + list.add(present_description); + if (present_description) + list.add(description); + + boolean present_persistedTime = true && (isSetPersistedTime()); + list.add(present_persistedTime); + if (present_persistedTime) + list.add(persistedTime); + + boolean present_token = true && (isSetToken()); + list.add(present_token); + if (present_token) + list.add(token); + + return list.hashCode(); + } + + @Override + public int compareTo(PasswordCredential other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetGatewayId()).compareTo(other.isSetGatewayId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetGatewayId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayId, other.gatewayId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetPortalUserName()).compareTo(other.isSetPortalUserName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPortalUserName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.portalUserName, other.portalUserName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetLoginUserName()).compareTo(other.isSetLoginUserName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetLoginUserName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.loginUserName, other.loginUserName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetPassword()).compareTo(other.isSetPassword()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPassword()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, other.password); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetDescription()).compareTo(other.isSetDescription()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDescription()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.description, other.description); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetPersistedTime()).compareTo(other.isSetPersistedTime()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPersistedTime()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.persistedTime, other.persistedTime); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetToken()).compareTo(other.isSetToken()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetToken()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, other.token); + 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("PasswordCredential("); + boolean first = true; + + sb.append("gatewayId:"); + if (this.gatewayId == null) { + sb.append("null"); + } else { + sb.append(this.gatewayId); + } + first = false; + if (!first) sb.append(", "); + sb.append("portalUserName:"); + if (this.portalUserName == null) { + sb.append("null"); + } else { + sb.append(this.portalUserName); + } + first = false; + if (!first) sb.append(", "); + sb.append("loginUserName:"); + if (this.loginUserName == null) { + sb.append("null"); + } else { + sb.append(this.loginUserName); + } + first = false; + if (!first) sb.append(", "); + sb.append("password:"); + if (this.password == null) { + sb.append("null"); + } else { + sb.append(this.password); + } + first = false; + if (isSetDescription()) { + if (!first) sb.append(", "); + sb.append("description:"); + if (this.description == null) { + sb.append("null"); + } else { + sb.append(this.description); + } + first = false; + } + if (isSetPersistedTime()) { + if (!first) sb.append(", "); + sb.append("persistedTime:"); + sb.append(this.persistedTime); + first = false; + } + if (isSetToken()) { + if (!first) sb.append(", "); + sb.append("token:"); + if (this.token == null) { + sb.append("null"); + } else { + sb.append(this.token); + } + first = false; + } + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetGatewayId()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayId' is unset! Struct:" + toString()); + } + + if (!isSetPortalUserName()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'portalUserName' is unset! Struct:" + toString()); + } + + if (!isSetLoginUserName()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'loginUserName' is unset! Struct:" + toString()); + } + + if (!isSetPassword()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'password' is unset! 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 { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class PasswordCredentialStandardSchemeFactory implements SchemeFactory { + public PasswordCredentialStandardScheme getScheme() { + return new PasswordCredentialStandardScheme(); + } + } + + private static class PasswordCredentialStandardScheme extends StandardScheme<PasswordCredential> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, PasswordCredential 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: // GATEWAY_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.gatewayId = iprot.readString(); + struct.setGatewayIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // PORTAL_USER_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.portalUserName = iprot.readString(); + struct.setPortalUserNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // LOGIN_USER_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.loginUserName = iprot.readString(); + struct.setLoginUserNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // PASSWORD + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.password = iprot.readString(); + struct.setPasswordIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // DESCRIPTION + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.description = iprot.readString(); + struct.setDescriptionIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // PERSISTED_TIME + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.persistedTime = iprot.readI64(); + struct.setPersistedTimeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 7: // TOKEN + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.token = iprot.readString(); + struct.setTokenIsSet(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(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, PasswordCredential struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.gatewayId != null) { + oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC); + oprot.writeString(struct.gatewayId); + oprot.writeFieldEnd(); + } + if (struct.portalUserName != null) { + oprot.writeFieldBegin(PORTAL_USER_NAME_FIELD_DESC); + oprot.writeString(struct.portalUserName); + oprot.writeFieldEnd(); + } + if (struct.loginUserName != null) { + oprot.writeFieldBegin(LOGIN_USER_NAME_FIELD_DESC); + oprot.writeString(struct.loginUserName); + oprot.writeFieldEnd(); + } + if (struct.password != null) { + oprot.writeFieldBegin(PASSWORD_FIELD_DESC); + oprot.writeString(struct.password); + oprot.writeFieldEnd(); + } + if (struct.description != null) { + if (struct.isSetDescription()) { + oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC); + oprot.writeString(struct.description); + oprot.writeFieldEnd(); + } + } + if (struct.isSetPersistedTime()) { + oprot.writeFieldBegin(PERSISTED_TIME_FIELD_DESC); + oprot.writeI64(struct.persistedTime); + oprot.writeFieldEnd(); + } + if (struct.token != null) { + if (struct.isSetToken()) { + oprot.writeFieldBegin(TOKEN_FIELD_DESC); + oprot.writeString(struct.token); + oprot.writeFieldEnd(); + } + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class PasswordCredentialTupleSchemeFactory implements SchemeFactory { + public PasswordCredentialTupleScheme getScheme() { + return new PasswordCredentialTupleScheme(); + } + } + + private static class PasswordCredentialTupleScheme extends TupleScheme<PasswordCredential> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, PasswordCredential struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.gatewayId); + oprot.writeString(struct.portalUserName); + oprot.writeString(struct.loginUserName); + oprot.writeString(struct.password); + BitSet optionals = new BitSet(); + if (struct.isSetDescription()) { + optionals.set(0); + } + if (struct.isSetPersistedTime()) { + optionals.set(1); + } + if (struct.isSetToken()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetDescription()) { + oprot.writeString(struct.description); + } + if (struct.isSetPersistedTime()) { + oprot.writeI64(struct.persistedTime); + } + if (struct.isSetToken()) { + oprot.writeString(struct.token); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, PasswordCredential struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.gatewayId = iprot.readString(); + struct.setGatewayIdIsSet(true); + struct.portalUserName = iprot.readString(); + struct.setPortalUserNameIsSet(true); + struct.loginUserName = iprot.readString(); + struct.setLoginUserNameIsSet(true); + struct.password = iprot.readString(); + struct.setPasswordIsSet(true); + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.description = iprot.readString(); + struct.setDescriptionIsSet(true); + } + if (incoming.get(1)) { + struct.persistedTime = iprot.readI64(); + struct.setPersistedTimeIsSet(true); + } + if (incoming.get(2)) { + struct.token = iprot.readString(); + struct.setTokenIsSet(true); + } + } + } + +} +
http://git-wip-us.apache.org/repos/asf/airavata/blob/122fb8da/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/credential/store/SSHCredential.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/credential/store/SSHCredential.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/credential/store/SSHCredential.java new file mode 100644 index 0000000..670fc7e --- /dev/null +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/credential/store/SSHCredential.java @@ -0,0 +1,1265 @@ +/** + * 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.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.credential.store; + +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)") +public class SSHCredential implements org.apache.thrift.TBase<SSHCredential, SSHCredential._Fields>, java.io.Serializable, Cloneable, Comparable<SSHCredential> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SSHCredential"); + + private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField PASSPHRASE_FIELD_DESC = new org.apache.thrift.protocol.TField("passphrase", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField PUBLIC_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("publicKey", org.apache.thrift.protocol.TType.STRING, (short)4); + private static final org.apache.thrift.protocol.TField PRIVATE_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("privateKey", org.apache.thrift.protocol.TType.STRING, (short)5); + private static final org.apache.thrift.protocol.TField PERSISTED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("persistedTime", org.apache.thrift.protocol.TType.I64, (short)6); + private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)7); + private static final org.apache.thrift.protocol.TField DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("description", org.apache.thrift.protocol.TType.STRING, (short)8); + private static final org.apache.thrift.protocol.TField CREDENTIAL_OWNER_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("credentialOwnerType", org.apache.thrift.protocol.TType.I32, (short)9); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new SSHCredentialStandardSchemeFactory()); + schemes.put(TupleScheme.class, new SSHCredentialTupleSchemeFactory()); + } + + private String gatewayId; // required + private String username; // required + private String passphrase; // optional + private String publicKey; // optional + private String privateKey; // optional + private long persistedTime; // optional + private String token; // optional + private String description; // optional + private CredentialOwnerType credentialOwnerType; // 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 { + GATEWAY_ID((short)1, "gatewayId"), + USERNAME((short)2, "username"), + PASSPHRASE((short)3, "passphrase"), + PUBLIC_KEY((short)4, "publicKey"), + PRIVATE_KEY((short)5, "privateKey"), + PERSISTED_TIME((short)6, "persistedTime"), + TOKEN((short)7, "token"), + DESCRIPTION((short)8, "description"), + /** + * + * @see CredentialOwnerType + */ + CREDENTIAL_OWNER_TYPE((short)9, "credentialOwnerType"); + + 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: // GATEWAY_ID + return GATEWAY_ID; + case 2: // USERNAME + return USERNAME; + case 3: // PASSPHRASE + return PASSPHRASE; + case 4: // PUBLIC_KEY + return PUBLIC_KEY; + case 5: // PRIVATE_KEY + return PRIVATE_KEY; + case 6: // PERSISTED_TIME + return PERSISTED_TIME; + case 7: // TOKEN + return TOKEN; + case 8: // DESCRIPTION + return DESCRIPTION; + case 9: // CREDENTIAL_OWNER_TYPE + return CREDENTIAL_OWNER_TYPE; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __PERSISTEDTIME_ISSET_ID = 0; + private byte __isset_bitfield = 0; + private static final _Fields optionals[] = {_Fields.PASSPHRASE,_Fields.PUBLIC_KEY,_Fields.PRIVATE_KEY,_Fields.PERSISTED_TIME,_Fields.TOKEN,_Fields.DESCRIPTION,_Fields.CREDENTIAL_OWNER_TYPE}; + 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.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayId", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.PASSPHRASE, new org.apache.thrift.meta_data.FieldMetaData("passphrase", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.PUBLIC_KEY, new org.apache.thrift.meta_data.FieldMetaData("publicKey", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.PRIVATE_KEY, new org.apache.thrift.meta_data.FieldMetaData("privateKey", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.PERSISTED_TIME, new org.apache.thrift.meta_data.FieldMetaData("persistedTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("description", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.CREDENTIAL_OWNER_TYPE, new org.apache.thrift.meta_data.FieldMetaData("credentialOwnerType", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, CredentialOwnerType.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SSHCredential.class, metaDataMap); + } + + public SSHCredential() { + this.credentialOwnerType = org.apache.airavata.model.credential.store.CredentialOwnerType.GATEWAY; + + } + + public SSHCredential( + String gatewayId, + String username) + { + this(); + this.gatewayId = gatewayId; + this.username = username; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public SSHCredential(SSHCredential other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetGatewayId()) { + this.gatewayId = other.gatewayId; + } + if (other.isSetUsername()) { + this.username = other.username; + } + if (other.isSetPassphrase()) { + this.passphrase = other.passphrase; + } + if (other.isSetPublicKey()) { + this.publicKey = other.publicKey; + } + if (other.isSetPrivateKey()) { + this.privateKey = other.privateKey; + } + this.persistedTime = other.persistedTime; + if (other.isSetToken()) { + this.token = other.token; + } + if (other.isSetDescription()) { + this.description = other.description; + } + if (other.isSetCredentialOwnerType()) { + this.credentialOwnerType = other.credentialOwnerType; + } + } + + public SSHCredential deepCopy() { + return new SSHCredential(this); + } + + @Override + public void clear() { + this.gatewayId = null; + this.username = null; + this.passphrase = null; + this.publicKey = null; + this.privateKey = null; + setPersistedTimeIsSet(false); + this.persistedTime = 0; + this.token = null; + this.description = null; + this.credentialOwnerType = org.apache.airavata.model.credential.store.CredentialOwnerType.GATEWAY; + + } + + public String getGatewayId() { + return this.gatewayId; + } + + public void setGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + } + + public void unsetGatewayId() { + this.gatewayId = null; + } + + /** Returns true if field gatewayId is set (has been assigned a value) and false otherwise */ + public boolean isSetGatewayId() { + return this.gatewayId != null; + } + + public void setGatewayIdIsSet(boolean value) { + if (!value) { + this.gatewayId = null; + } + } + + public String getUsername() { + return this.username; + } + + public void setUsername(String username) { + this.username = username; + } + + public void unsetUsername() { + this.username = null; + } + + /** Returns true if field username is set (has been assigned a value) and false otherwise */ + public boolean isSetUsername() { + return this.username != null; + } + + public void setUsernameIsSet(boolean value) { + if (!value) { + this.username = null; + } + } + + public String getPassphrase() { + return this.passphrase; + } + + public void setPassphrase(String passphrase) { + this.passphrase = passphrase; + } + + public void unsetPassphrase() { + this.passphrase = null; + } + + /** Returns true if field passphrase is set (has been assigned a value) and false otherwise */ + public boolean isSetPassphrase() { + return this.passphrase != null; + } + + public void setPassphraseIsSet(boolean value) { + if (!value) { + this.passphrase = null; + } + } + + public String getPublicKey() { + return this.publicKey; + } + + public void setPublicKey(String publicKey) { + this.publicKey = publicKey; + } + + public void unsetPublicKey() { + this.publicKey = null; + } + + /** Returns true if field publicKey is set (has been assigned a value) and false otherwise */ + public boolean isSetPublicKey() { + return this.publicKey != null; + } + + public void setPublicKeyIsSet(boolean value) { + if (!value) { + this.publicKey = null; + } + } + + public String getPrivateKey() { + return this.privateKey; + } + + public void setPrivateKey(String privateKey) { + this.privateKey = privateKey; + } + + public void unsetPrivateKey() { + this.privateKey = null; + } + + /** Returns true if field privateKey is set (has been assigned a value) and false otherwise */ + public boolean isSetPrivateKey() { + return this.privateKey != null; + } + + public void setPrivateKeyIsSet(boolean value) { + if (!value) { + this.privateKey = null; + } + } + + public long getPersistedTime() { + return this.persistedTime; + } + + public void setPersistedTime(long persistedTime) { + this.persistedTime = persistedTime; + setPersistedTimeIsSet(true); + } + + public void unsetPersistedTime() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID); + } + + /** Returns true if field persistedTime is set (has been assigned a value) and false otherwise */ + public boolean isSetPersistedTime() { + return EncodingUtils.testBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID); + } + + public void setPersistedTimeIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PERSISTEDTIME_ISSET_ID, value); + } + + public String getToken() { + return this.token; + } + + public void setToken(String token) { + this.token = token; + } + + public void unsetToken() { + this.token = null; + } + + /** Returns true if field token is set (has been assigned a value) and false otherwise */ + public boolean isSetToken() { + return this.token != null; + } + + public void setTokenIsSet(boolean value) { + if (!value) { + this.token = null; + } + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public void unsetDescription() { + this.description = null; + } + + /** Returns true if field description is set (has been assigned a value) and false otherwise */ + public boolean isSetDescription() { + return this.description != null; + } + + public void setDescriptionIsSet(boolean value) { + if (!value) { + this.description = null; + } + } + + /** + * + * @see CredentialOwnerType + */ + public CredentialOwnerType getCredentialOwnerType() { + return this.credentialOwnerType; + } + + /** + * + * @see CredentialOwnerType + */ + public void setCredentialOwnerType(CredentialOwnerType credentialOwnerType) { + this.credentialOwnerType = credentialOwnerType; + } + + public void unsetCredentialOwnerType() { + this.credentialOwnerType = null; + } + + /** Returns true if field credentialOwnerType is set (has been assigned a value) and false otherwise */ + public boolean isSetCredentialOwnerType() { + return this.credentialOwnerType != null; + } + + public void setCredentialOwnerTypeIsSet(boolean value) { + if (!value) { + this.credentialOwnerType = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case GATEWAY_ID: + if (value == null) { + unsetGatewayId(); + } else { + setGatewayId((String)value); + } + break; + + case USERNAME: + if (value == null) { + unsetUsername(); + } else { + setUsername((String)value); + } + break; + + case PASSPHRASE: + if (value == null) { + unsetPassphrase(); + } else { + setPassphrase((String)value); + } + break; + + case PUBLIC_KEY: + if (value == null) { + unsetPublicKey(); + } else { + setPublicKey((String)value); + } + break; + + case PRIVATE_KEY: + if (value == null) { + unsetPrivateKey(); + } else { + setPrivateKey((String)value); + } + break; + + case PERSISTED_TIME: + if (value == null) { + unsetPersistedTime(); + } else { + setPersistedTime((Long)value); + } + break; + + case TOKEN: + if (value == null) { + unsetToken(); + } else { + setToken((String)value); + } + break; + + case DESCRIPTION: + if (value == null) { + unsetDescription(); + } else { + setDescription((String)value); + } + break; + + case CREDENTIAL_OWNER_TYPE: + if (value == null) { + unsetCredentialOwnerType(); + } else { + setCredentialOwnerType((CredentialOwnerType)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case GATEWAY_ID: + return getGatewayId(); + + case USERNAME: + return getUsername(); + + case PASSPHRASE: + return getPassphrase(); + + case PUBLIC_KEY: + return getPublicKey(); + + case PRIVATE_KEY: + return getPrivateKey(); + + case PERSISTED_TIME: + return getPersistedTime(); + + case TOKEN: + return getToken(); + + case DESCRIPTION: + return getDescription(); + + case CREDENTIAL_OWNER_TYPE: + return getCredentialOwnerType(); + + } + 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 GATEWAY_ID: + return isSetGatewayId(); + case USERNAME: + return isSetUsername(); + case PASSPHRASE: + return isSetPassphrase(); + case PUBLIC_KEY: + return isSetPublicKey(); + case PRIVATE_KEY: + return isSetPrivateKey(); + case PERSISTED_TIME: + return isSetPersistedTime(); + case TOKEN: + return isSetToken(); + case DESCRIPTION: + return isSetDescription(); + case CREDENTIAL_OWNER_TYPE: + return isSetCredentialOwnerType(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof SSHCredential) + return this.equals((SSHCredential)that); + return false; + } + + public boolean equals(SSHCredential that) { + if (that == null) + return false; + + boolean this_present_gatewayId = true && this.isSetGatewayId(); + boolean that_present_gatewayId = true && that.isSetGatewayId(); + if (this_present_gatewayId || that_present_gatewayId) { + if (!(this_present_gatewayId && that_present_gatewayId)) + return false; + if (!this.gatewayId.equals(that.gatewayId)) + return false; + } + + boolean this_present_username = true && this.isSetUsername(); + boolean that_present_username = true && that.isSetUsername(); + if (this_present_username || that_present_username) { + if (!(this_present_username && that_present_username)) + return false; + if (!this.username.equals(that.username)) + return false; + } + + boolean this_present_passphrase = true && this.isSetPassphrase(); + boolean that_present_passphrase = true && that.isSetPassphrase(); + if (this_present_passphrase || that_present_passphrase) { + if (!(this_present_passphrase && that_present_passphrase)) + return false; + if (!this.passphrase.equals(that.passphrase)) + return false; + } + + boolean this_present_publicKey = true && this.isSetPublicKey(); + boolean that_present_publicKey = true && that.isSetPublicKey(); + if (this_present_publicKey || that_present_publicKey) { + if (!(this_present_publicKey && that_present_publicKey)) + return false; + if (!this.publicKey.equals(that.publicKey)) + return false; + } + + boolean this_present_privateKey = true && this.isSetPrivateKey(); + boolean that_present_privateKey = true && that.isSetPrivateKey(); + if (this_present_privateKey || that_present_privateKey) { + if (!(this_present_privateKey && that_present_privateKey)) + return false; + if (!this.privateKey.equals(that.privateKey)) + return false; + } + + boolean this_present_persistedTime = true && this.isSetPersistedTime(); + boolean that_present_persistedTime = true && that.isSetPersistedTime(); + if (this_present_persistedTime || that_present_persistedTime) { + if (!(this_present_persistedTime && that_present_persistedTime)) + return false; + if (this.persistedTime != that.persistedTime) + return false; + } + + boolean this_present_token = true && this.isSetToken(); + boolean that_present_token = true && that.isSetToken(); + if (this_present_token || that_present_token) { + if (!(this_present_token && that_present_token)) + return false; + if (!this.token.equals(that.token)) + return false; + } + + boolean this_present_description = true && this.isSetDescription(); + boolean that_present_description = true && that.isSetDescription(); + if (this_present_description || that_present_description) { + if (!(this_present_description && that_present_description)) + return false; + if (!this.description.equals(that.description)) + return false; + } + + boolean this_present_credentialOwnerType = true && this.isSetCredentialOwnerType(); + boolean that_present_credentialOwnerType = true && that.isSetCredentialOwnerType(); + if (this_present_credentialOwnerType || that_present_credentialOwnerType) { + if (!(this_present_credentialOwnerType && that_present_credentialOwnerType)) + return false; + if (!this.credentialOwnerType.equals(that.credentialOwnerType)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_gatewayId = true && (isSetGatewayId()); + list.add(present_gatewayId); + if (present_gatewayId) + list.add(gatewayId); + + boolean present_username = true && (isSetUsername()); + list.add(present_username); + if (present_username) + list.add(username); + + boolean present_passphrase = true && (isSetPassphrase()); + list.add(present_passphrase); + if (present_passphrase) + list.add(passphrase); + + boolean present_publicKey = true && (isSetPublicKey()); + list.add(present_publicKey); + if (present_publicKey) + list.add(publicKey); + + boolean present_privateKey = true && (isSetPrivateKey()); + list.add(present_privateKey); + if (present_privateKey) + list.add(privateKey); + + boolean present_persistedTime = true && (isSetPersistedTime()); + list.add(present_persistedTime); + if (present_persistedTime) + list.add(persistedTime); + + boolean present_token = true && (isSetToken()); + list.add(present_token); + if (present_token) + list.add(token); + + boolean present_description = true && (isSetDescription()); + list.add(present_description); + if (present_description) + list.add(description); + + boolean present_credentialOwnerType = true && (isSetCredentialOwnerType()); + list.add(present_credentialOwnerType); + if (present_credentialOwnerType) + list.add(credentialOwnerType.getValue()); + + return list.hashCode(); + } + + @Override + public int compareTo(SSHCredential other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetGatewayId()).compareTo(other.isSetGatewayId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetGatewayId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayId, other.gatewayId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUsername()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetPassphrase()).compareTo(other.isSetPassphrase()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPassphrase()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.passphrase, other.passphrase); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetPublicKey()).compareTo(other.isSetPublicKey()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPublicKey()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.publicKey, other.publicKey); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetPrivateKey()).compareTo(other.isSetPrivateKey()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPrivateKey()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privateKey, other.privateKey); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetPersistedTime()).compareTo(other.isSetPersistedTime()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPersistedTime()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.persistedTime, other.persistedTime); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetToken()).compareTo(other.isSetToken()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetToken()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, other.token); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetDescription()).compareTo(other.isSetDescription()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDescription()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.description, other.description); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCredentialOwnerType()).compareTo(other.isSetCredentialOwnerType()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCredentialOwnerType()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.credentialOwnerType, other.credentialOwnerType); + 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("SSHCredential("); + boolean first = true; + + sb.append("gatewayId:"); + if (this.gatewayId == null) { + sb.append("null"); + } else { + sb.append(this.gatewayId); + } + first = false; + if (!first) sb.append(", "); + sb.append("username:"); + if (this.username == null) { + sb.append("null"); + } else { + sb.append(this.username); + } + first = false; + if (isSetPassphrase()) { + if (!first) sb.append(", "); + sb.append("passphrase:"); + if (this.passphrase == null) { + sb.append("null"); + } else { + sb.append(this.passphrase); + } + first = false; + } + if (isSetPublicKey()) { + if (!first) sb.append(", "); + sb.append("publicKey:"); + if (this.publicKey == null) { + sb.append("null"); + } else { + sb.append(this.publicKey); + } + first = false; + } + if (isSetPrivateKey()) { + if (!first) sb.append(", "); + sb.append("privateKey:"); + if (this.privateKey == null) { + sb.append("null"); + } else { + sb.append(this.privateKey); + } + first = false; + } + if (isSetPersistedTime()) { + if (!first) sb.append(", "); + sb.append("persistedTime:"); + sb.append(this.persistedTime); + first = false; + } + if (isSetToken()) { + if (!first) sb.append(", "); + sb.append("token:"); + if (this.token == null) { + sb.append("null"); + } else { + sb.append(this.token); + } + first = false; + } + if (isSetDescription()) { + if (!first) sb.append(", "); + sb.append("description:"); + if (this.description == null) { + sb.append("null"); + } else { + sb.append(this.description); + } + first = false; + } + if (isSetCredentialOwnerType()) { + if (!first) sb.append(", "); + sb.append("credentialOwnerType:"); + if (this.credentialOwnerType == null) { + sb.append("null"); + } else { + sb.append(this.credentialOwnerType); + } + first = false; + } + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetGatewayId()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayId' is unset! Struct:" + toString()); + } + + if (!isSetUsername()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'username' is unset! 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 { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class SSHCredentialStandardSchemeFactory implements SchemeFactory { + public SSHCredentialStandardScheme getScheme() { + return new SSHCredentialStandardScheme(); + } + } + + private static class SSHCredentialStandardScheme extends StandardScheme<SSHCredential> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, SSHCredential 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: // GATEWAY_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.gatewayId = iprot.readString(); + struct.setGatewayIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USERNAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.username = iprot.readString(); + struct.setUsernameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // PASSPHRASE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.passphrase = iprot.readString(); + struct.setPassphraseIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // PUBLIC_KEY + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.publicKey = iprot.readString(); + struct.setPublicKeyIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // PRIVATE_KEY + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.privateKey = iprot.readString(); + struct.setPrivateKeyIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // PERSISTED_TIME + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.persistedTime = iprot.readI64(); + struct.setPersistedTimeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 7: // TOKEN + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.token = iprot.readString(); + struct.setTokenIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 8: // DESCRIPTION + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.description = iprot.readString(); + struct.setDescriptionIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 9: // CREDENTIAL_OWNER_TYPE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.credentialOwnerType = org.apache.airavata.model.credential.store.CredentialOwnerType.findByValue(iprot.readI32()); + struct.setCredentialOwnerTypeIsSet(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(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, SSHCredential struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.gatewayId != null) { + oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC); + oprot.writeString(struct.gatewayId); + oprot.writeFieldEnd(); + } + if (struct.username != null) { + oprot.writeFieldBegin(USERNAME_FIELD_DESC); + oprot.writeString(struct.username); + oprot.writeFieldEnd(); + } + if (struct.passphrase != null) { + if (struct.isSetPassphrase()) { + oprot.writeFieldBegin(PASSPHRASE_FIELD_DESC); + oprot.writeString(struct.passphrase); + oprot.writeFieldEnd(); + } + } + if (struct.publicKey != null) { + if (struct.isSetPublicKey()) { + oprot.writeFieldBegin(PUBLIC_KEY_FIELD_DESC); + oprot.writeString(struct.publicKey); + oprot.writeFieldEnd(); + } + } + if (struct.privateKey != null) { + if (struct.isSetPrivateKey()) { + oprot.writeFieldBegin(PRIVATE_KEY_FIELD_DESC); + oprot.writeString(struct.privateKey); + oprot.writeFieldEnd(); + } + } + if (struct.isSetPersistedTime()) { + oprot.writeFieldBegin(PERSISTED_TIME_FIELD_DESC); + oprot.writeI64(struct.persistedTime); + oprot.writeFieldEnd(); + } + if (struct.token != null) { + if (struct.isSetToken()) { + oprot.writeFieldBegin(TOKEN_FIELD_DESC); + oprot.writeString(struct.token); + oprot.writeFieldEnd(); + } + } + if (struct.description != null) { + if (struct.isSetDescription()) { + oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC); + oprot.writeString(struct.description); + oprot.writeFieldEnd(); + } + } + if (struct.credentialOwnerType != null) { + if (struct.isSetCredentialOwnerType()) { + oprot.writeFieldBegin(CREDENTIAL_OWNER_TYPE_FIELD_DESC); + oprot.writeI32(struct.credentialOwnerType.getValue()); + oprot.writeFieldEnd(); + } + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class SSHCredentialTupleSchemeFactory implements SchemeFactory { + public SSHCredentialTupleScheme getScheme() { + return new SSHCredentialTupleScheme(); + } + } + + private static class SSHCredentialTupleScheme extends TupleScheme<SSHCredential> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, SSHCredential struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.gatewayId); + oprot.writeString(struct.username); + BitSet optionals = new BitSet(); + if (struct.isSetPassphrase()) { + optionals.set(0); + } + if (struct.isSetPublicKey()) { + optionals.set(1); + } + if (struct.isSetPrivateKey()) { + optionals.set(2); + } + if (struct.isSetPersistedTime()) { + optionals.set(3); + } + if (struct.isSetToken()) { + optionals.set(4); + } + if (struct.isSetDescription()) { + optionals.set(5); + } + if (struct.isSetCredentialOwnerType()) { + optionals.set(6); + } + oprot.writeBitSet(optionals, 7); + if (struct.isSetPassphrase()) { + oprot.writeString(struct.passphrase); + } + if (struct.isSetPublicKey()) { + oprot.writeString(struct.publicKey); + } + if (struct.isSetPrivateKey()) { + oprot.writeString(struct.privateKey); + } + if (struct.isSetPersistedTime()) { + oprot.writeI64(struct.persistedTime); + } + if (struct.isSetToken()) { + oprot.writeString(struct.token); + } + if (struct.isSetDescription()) { + oprot.writeString(struct.description); + } + if (struct.isSetCredentialOwnerType()) { + oprot.writeI32(struct.credentialOwnerType.getValue()); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, SSHCredential struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.gatewayId = iprot.readString(); + struct.setGatewayIdIsSet(true); + struct.username = iprot.readString(); + struct.setUsernameIsSet(true); + BitSet incoming = iprot.readBitSet(7); + if (incoming.get(0)) { + struct.passphrase = iprot.readString(); + struct.setPassphraseIsSet(true); + } + if (incoming.get(1)) { + struct.publicKey = iprot.readString(); + struct.setPublicKeyIsSet(true); + } + if (incoming.get(2)) { + struct.privateKey = iprot.readString(); + struct.setPrivateKeyIsSet(true); + } + if (incoming.get(3)) { + struct.persistedTime = iprot.readI64(); + struct.setPersistedTimeIsSet(true); + } + if (incoming.get(4)) { + struct.token = iprot.readString(); + struct.setTokenIsSet(true); + } + if (incoming.get(5)) { + struct.description = iprot.readString(); + struct.setDescriptionIsSet(true); + } + if (incoming.get(6)) { + struct.credentialOwnerType = org.apache.airavata.model.credential.store.CredentialOwnerType.findByValue(iprot.readI32()); + struct.setCredentialOwnerTypeIsSet(true); + } + } + } + +} +
