implementing credential store server handler - AIRAVATA-1561
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/c6fe0dec Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/c6fe0dec Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/c6fe0dec Branch: refs/heads/master Commit: c6fe0decd079bdfe078da620b29fc2b280c1701f Parents: 7f89880 Author: Chathuri Wimalasena <[email protected]> Authored: Fri Feb 6 15:57:14 2015 -0500 Committer: Chathuri Wimalasena <[email protected]> Committed: Fri Feb 6 15:57:14 2015 -0500 ---------------------------------------------------------------------- .../store/cpi/CredentialStoreService.java | 372 +++++++++++++++++-- .../store/datamodel/CertificateCredential.java | 258 +++++++------ .../store/datamodel/PasswordCredential.java | 24 +- .../store/datamodel/SSHCredential.java | 92 +++-- .../server/CredentialStoreServerHandler.java | 159 +++++--- .../airavata/credential/store/util/Utility.java | 36 +- .../cs-thrift-description/cs.cpi.service.thrift | 6 +- .../cs-thrift-description/csDataModel.thrift | 14 +- 8 files changed, 672 insertions(+), 289 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/c6fe0dec/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java index b0a3cbc..5d9c05c 100644 --- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java +++ b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java @@ -69,11 +69,11 @@ import org.slf4j.LoggerFactory; public String addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException; - public org.apache.airavata.credential.store.datamodel.SSHCredential getSSHCredential(String tokenId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException; + public org.apache.airavata.credential.store.datamodel.SSHCredential getSSHCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException; - public org.apache.airavata.credential.store.datamodel.CertificateCredential getCertificateCredential(String tokenId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException; + public org.apache.airavata.credential.store.datamodel.CertificateCredential getCertificateCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException; - public org.apache.airavata.credential.store.datamodel.PasswordCredential getPasswordCredential(String tokenId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException; + public org.apache.airavata.credential.store.datamodel.PasswordCredential getPasswordCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException; } @@ -87,11 +87,11 @@ import org.slf4j.LoggerFactory; public void addPasswordCredential(org.apache.airavata.credential.store.datamodel.PasswordCredential passwordCredential, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void getSSHCredential(String tokenId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getSSHCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void getCertificateCredential(String tokenId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getCertificateCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void getPasswordCredential(String tokenId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getPasswordCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; } @@ -215,16 +215,17 @@ import org.slf4j.LoggerFactory; throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "addPasswordCredential failed: unknown result"); } - public org.apache.airavata.credential.store.datamodel.SSHCredential getSSHCredential(String tokenId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException + public org.apache.airavata.credential.store.datamodel.SSHCredential getSSHCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException { - send_getSSHCredential(tokenId); + send_getSSHCredential(tokenId, gatewayId); return recv_getSSHCredential(); } - public void send_getSSHCredential(String tokenId) throws org.apache.thrift.TException + public void send_getSSHCredential(String tokenId, String gatewayId) throws org.apache.thrift.TException { getSSHCredential_args args = new getSSHCredential_args(); args.setTokenId(tokenId); + args.setGatewayId(gatewayId); sendBase("getSSHCredential", args); } @@ -241,16 +242,17 @@ import org.slf4j.LoggerFactory; throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getSSHCredential failed: unknown result"); } - public org.apache.airavata.credential.store.datamodel.CertificateCredential getCertificateCredential(String tokenId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException + public org.apache.airavata.credential.store.datamodel.CertificateCredential getCertificateCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException { - send_getCertificateCredential(tokenId); + send_getCertificateCredential(tokenId, gatewayId); return recv_getCertificateCredential(); } - public void send_getCertificateCredential(String tokenId) throws org.apache.thrift.TException + public void send_getCertificateCredential(String tokenId, String gatewayId) throws org.apache.thrift.TException { getCertificateCredential_args args = new getCertificateCredential_args(); args.setTokenId(tokenId); + args.setGatewayId(gatewayId); sendBase("getCertificateCredential", args); } @@ -267,16 +269,17 @@ import org.slf4j.LoggerFactory; throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getCertificateCredential failed: unknown result"); } - public org.apache.airavata.credential.store.datamodel.PasswordCredential getPasswordCredential(String tokenId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException + public org.apache.airavata.credential.store.datamodel.PasswordCredential getPasswordCredential(String tokenId, String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException, org.apache.thrift.TException { - send_getPasswordCredential(tokenId); + send_getPasswordCredential(tokenId, gatewayId); return recv_getPasswordCredential(); } - public void send_getPasswordCredential(String tokenId) throws org.apache.thrift.TException + public void send_getPasswordCredential(String tokenId, String gatewayId) throws org.apache.thrift.TException { getPasswordCredential_args args = new getPasswordCredential_args(); args.setTokenId(tokenId); + args.setGatewayId(gatewayId); sendBase("getPasswordCredential", args); } @@ -436,24 +439,27 @@ import org.slf4j.LoggerFactory; } } - public void getSSHCredential(String tokenId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void getSSHCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); - getSSHCredential_call method_call = new getSSHCredential_call(tokenId, resultHandler, this, ___protocolFactory, ___transport); + getSSHCredential_call method_call = new getSSHCredential_call(tokenId, gatewayId, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } public static class getSSHCredential_call extends org.apache.thrift.async.TAsyncMethodCall { private String tokenId; - public getSSHCredential_call(String tokenId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + private String gatewayId; + public getSSHCredential_call(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); this.tokenId = tokenId; + this.gatewayId = gatewayId; } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getSSHCredential", org.apache.thrift.protocol.TMessageType.CALL, 0)); getSSHCredential_args args = new getSSHCredential_args(); args.setTokenId(tokenId); + args.setGatewayId(gatewayId); args.write(prot); prot.writeMessageEnd(); } @@ -468,24 +474,27 @@ import org.slf4j.LoggerFactory; } } - public void getCertificateCredential(String tokenId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void getCertificateCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); - getCertificateCredential_call method_call = new getCertificateCredential_call(tokenId, resultHandler, this, ___protocolFactory, ___transport); + getCertificateCredential_call method_call = new getCertificateCredential_call(tokenId, gatewayId, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } public static class getCertificateCredential_call extends org.apache.thrift.async.TAsyncMethodCall { private String tokenId; - public getCertificateCredential_call(String tokenId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + private String gatewayId; + public getCertificateCredential_call(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); this.tokenId = tokenId; + this.gatewayId = gatewayId; } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getCertificateCredential", org.apache.thrift.protocol.TMessageType.CALL, 0)); getCertificateCredential_args args = new getCertificateCredential_args(); args.setTokenId(tokenId); + args.setGatewayId(gatewayId); args.write(prot); prot.writeMessageEnd(); } @@ -500,24 +509,27 @@ import org.slf4j.LoggerFactory; } } - public void getPasswordCredential(String tokenId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void getPasswordCredential(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); - getPasswordCredential_call method_call = new getPasswordCredential_call(tokenId, resultHandler, this, ___protocolFactory, ___transport); + getPasswordCredential_call method_call = new getPasswordCredential_call(tokenId, gatewayId, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } public static class getPasswordCredential_call extends org.apache.thrift.async.TAsyncMethodCall { private String tokenId; - public getPasswordCredential_call(String tokenId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + private String gatewayId; + public getPasswordCredential_call(String tokenId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); this.tokenId = tokenId; + this.gatewayId = gatewayId; } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getPasswordCredential", org.apache.thrift.protocol.TMessageType.CALL, 0)); getPasswordCredential_args args = new getPasswordCredential_args(); args.setTokenId(tokenId); + args.setGatewayId(gatewayId); args.write(prot); prot.writeMessageEnd(); } @@ -663,7 +675,7 @@ import org.slf4j.LoggerFactory; public getSSHCredential_result getResult(I iface, getSSHCredential_args args) throws org.apache.thrift.TException { getSSHCredential_result result = new getSSHCredential_result(); try { - result.success = iface.getSSHCredential(args.tokenId); + result.success = iface.getSSHCredential(args.tokenId, args.gatewayId); } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) { result.csException = csException; } @@ -687,7 +699,7 @@ import org.slf4j.LoggerFactory; public getCertificateCredential_result getResult(I iface, getCertificateCredential_args args) throws org.apache.thrift.TException { getCertificateCredential_result result = new getCertificateCredential_result(); try { - result.success = iface.getCertificateCredential(args.tokenId); + result.success = iface.getCertificateCredential(args.tokenId, args.gatewayId); } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) { result.csException = csException; } @@ -711,7 +723,7 @@ import org.slf4j.LoggerFactory; public getPasswordCredential_result getResult(I iface, getPasswordCredential_args args) throws org.apache.thrift.TException { getPasswordCredential_result result = new getPasswordCredential_result(); try { - result.success = iface.getPasswordCredential(args.tokenId); + result.success = iface.getPasswordCredential(args.tokenId, args.gatewayId); } catch (org.apache.airavata.credential.store.exception.CredentialStoreException csException) { result.csException = csException; } @@ -1017,7 +1029,7 @@ import org.slf4j.LoggerFactory; } public void start(I iface, getSSHCredential_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.SSHCredential> resultHandler) throws TException { - iface.getSSHCredential(args.tokenId,resultHandler); + iface.getSSHCredential(args.tokenId, args.gatewayId,resultHandler); } } @@ -1074,7 +1086,7 @@ import org.slf4j.LoggerFactory; } public void start(I iface, getCertificateCredential_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.CertificateCredential> resultHandler) throws TException { - iface.getCertificateCredential(args.tokenId,resultHandler); + iface.getCertificateCredential(args.tokenId, args.gatewayId,resultHandler); } } @@ -1131,7 +1143,7 @@ import org.slf4j.LoggerFactory; } public void start(I iface, getPasswordCredential_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.credential.store.datamodel.PasswordCredential> resultHandler) throws TException { - iface.getPasswordCredential(args.tokenId,resultHandler); + iface.getPasswordCredential(args.tokenId, args.gatewayId,resultHandler); } } @@ -4165,6 +4177,7 @@ import org.slf4j.LoggerFactory; private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getSSHCredential_args"); private static final org.apache.thrift.protocol.TField TOKEN_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("tokenId", org.apache.thrift.protocol.TType.STRING, (short)1); + 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)2); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -4173,10 +4186,12 @@ import org.slf4j.LoggerFactory; } public String tokenId; // required + public String gatewayId; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { - TOKEN_ID((short)1, "tokenId"); + TOKEN_ID((short)1, "tokenId"), + GATEWAY_ID((short)2, "gatewayId"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -4193,6 +4208,8 @@ import org.slf4j.LoggerFactory; switch(fieldId) { case 1: // TOKEN_ID return TOKEN_ID; + case 2: // GATEWAY_ID + return GATEWAY_ID; default: return null; } @@ -4238,6 +4255,8 @@ import org.slf4j.LoggerFactory; Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.TOKEN_ID, new org.apache.thrift.meta_data.FieldMetaData("tokenId", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + 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))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getSSHCredential_args.class, metaDataMap); } @@ -4246,10 +4265,12 @@ import org.slf4j.LoggerFactory; } public getSSHCredential_args( - String tokenId) + String tokenId, + String gatewayId) { this(); this.tokenId = tokenId; + this.gatewayId = gatewayId; } /** @@ -4259,6 +4280,9 @@ import org.slf4j.LoggerFactory; if (other.isSetTokenId()) { this.tokenId = other.tokenId; } + if (other.isSetGatewayId()) { + this.gatewayId = other.gatewayId; + } } public getSSHCredential_args deepCopy() { @@ -4268,6 +4292,7 @@ import org.slf4j.LoggerFactory; @Override public void clear() { this.tokenId = null; + this.gatewayId = null; } public String getTokenId() { @@ -4294,6 +4319,30 @@ import org.slf4j.LoggerFactory; } } + public String getGatewayId() { + return this.gatewayId; + } + + public getSSHCredential_args setGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + return this; + } + + 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 void setFieldValue(_Fields field, Object value) { switch (field) { case TOKEN_ID: @@ -4304,6 +4353,14 @@ import org.slf4j.LoggerFactory; } break; + case GATEWAY_ID: + if (value == null) { + unsetGatewayId(); + } else { + setGatewayId((String)value); + } + break; + } } @@ -4312,6 +4369,9 @@ import org.slf4j.LoggerFactory; case TOKEN_ID: return getTokenId(); + case GATEWAY_ID: + return getGatewayId(); + } throw new IllegalStateException(); } @@ -4325,6 +4385,8 @@ import org.slf4j.LoggerFactory; switch (field) { case TOKEN_ID: return isSetTokenId(); + case GATEWAY_ID: + return isSetGatewayId(); } throw new IllegalStateException(); } @@ -4351,6 +4413,15 @@ import org.slf4j.LoggerFactory; 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; + } + return true; } @@ -4377,6 +4448,16 @@ import org.slf4j.LoggerFactory; return lastComparison; } } + 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; + } + } return 0; } @@ -4404,6 +4485,14 @@ import org.slf4j.LoggerFactory; sb.append(this.tokenId); } first = false; + if (!first) sb.append(", "); + sb.append("gatewayId:"); + if (this.gatewayId == null) { + sb.append("null"); + } else { + sb.append(this.gatewayId); + } + first = false; sb.append(")"); return sb.toString(); } @@ -4413,6 +4502,9 @@ import org.slf4j.LoggerFactory; if (tokenId == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'tokenId' was not present! Struct: " + toString()); } + if (gatewayId == null) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayId' was not present! Struct: " + toString()); + } // check for sub-struct validity } @@ -4458,6 +4550,14 @@ import org.slf4j.LoggerFactory; org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 2: // 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; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -4478,6 +4578,11 @@ import org.slf4j.LoggerFactory; oprot.writeString(struct.tokenId); oprot.writeFieldEnd(); } + if (struct.gatewayId != null) { + oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC); + oprot.writeString(struct.gatewayId); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -4496,6 +4601,7 @@ import org.slf4j.LoggerFactory; public void write(org.apache.thrift.protocol.TProtocol prot, getSSHCredential_args struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeString(struct.tokenId); + oprot.writeString(struct.gatewayId); } @Override @@ -4503,6 +4609,8 @@ import org.slf4j.LoggerFactory; TTupleProtocol iprot = (TTupleProtocol) prot; struct.tokenId = iprot.readString(); struct.setTokenIdIsSet(true); + struct.gatewayId = iprot.readString(); + struct.setGatewayIdIsSet(true); } } @@ -4973,6 +5081,7 @@ import org.slf4j.LoggerFactory; private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getCertificateCredential_args"); private static final org.apache.thrift.protocol.TField TOKEN_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("tokenId", org.apache.thrift.protocol.TType.STRING, (short)1); + 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)2); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -4981,10 +5090,12 @@ import org.slf4j.LoggerFactory; } public String tokenId; // required + public String gatewayId; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { - TOKEN_ID((short)1, "tokenId"); + TOKEN_ID((short)1, "tokenId"), + GATEWAY_ID((short)2, "gatewayId"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -5001,6 +5112,8 @@ import org.slf4j.LoggerFactory; switch(fieldId) { case 1: // TOKEN_ID return TOKEN_ID; + case 2: // GATEWAY_ID + return GATEWAY_ID; default: return null; } @@ -5046,6 +5159,8 @@ import org.slf4j.LoggerFactory; Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.TOKEN_ID, new org.apache.thrift.meta_data.FieldMetaData("tokenId", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + 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))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getCertificateCredential_args.class, metaDataMap); } @@ -5054,10 +5169,12 @@ import org.slf4j.LoggerFactory; } public getCertificateCredential_args( - String tokenId) + String tokenId, + String gatewayId) { this(); this.tokenId = tokenId; + this.gatewayId = gatewayId; } /** @@ -5067,6 +5184,9 @@ import org.slf4j.LoggerFactory; if (other.isSetTokenId()) { this.tokenId = other.tokenId; } + if (other.isSetGatewayId()) { + this.gatewayId = other.gatewayId; + } } public getCertificateCredential_args deepCopy() { @@ -5076,6 +5196,7 @@ import org.slf4j.LoggerFactory; @Override public void clear() { this.tokenId = null; + this.gatewayId = null; } public String getTokenId() { @@ -5102,6 +5223,30 @@ import org.slf4j.LoggerFactory; } } + public String getGatewayId() { + return this.gatewayId; + } + + public getCertificateCredential_args setGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + return this; + } + + 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 void setFieldValue(_Fields field, Object value) { switch (field) { case TOKEN_ID: @@ -5112,6 +5257,14 @@ import org.slf4j.LoggerFactory; } break; + case GATEWAY_ID: + if (value == null) { + unsetGatewayId(); + } else { + setGatewayId((String)value); + } + break; + } } @@ -5120,6 +5273,9 @@ import org.slf4j.LoggerFactory; case TOKEN_ID: return getTokenId(); + case GATEWAY_ID: + return getGatewayId(); + } throw new IllegalStateException(); } @@ -5133,6 +5289,8 @@ import org.slf4j.LoggerFactory; switch (field) { case TOKEN_ID: return isSetTokenId(); + case GATEWAY_ID: + return isSetGatewayId(); } throw new IllegalStateException(); } @@ -5159,6 +5317,15 @@ import org.slf4j.LoggerFactory; 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; + } + return true; } @@ -5185,6 +5352,16 @@ import org.slf4j.LoggerFactory; return lastComparison; } } + 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; + } + } return 0; } @@ -5212,6 +5389,14 @@ import org.slf4j.LoggerFactory; sb.append(this.tokenId); } first = false; + if (!first) sb.append(", "); + sb.append("gatewayId:"); + if (this.gatewayId == null) { + sb.append("null"); + } else { + sb.append(this.gatewayId); + } + first = false; sb.append(")"); return sb.toString(); } @@ -5221,6 +5406,9 @@ import org.slf4j.LoggerFactory; if (tokenId == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'tokenId' was not present! Struct: " + toString()); } + if (gatewayId == null) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayId' was not present! Struct: " + toString()); + } // check for sub-struct validity } @@ -5266,6 +5454,14 @@ import org.slf4j.LoggerFactory; org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 2: // 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; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -5286,6 +5482,11 @@ import org.slf4j.LoggerFactory; oprot.writeString(struct.tokenId); oprot.writeFieldEnd(); } + if (struct.gatewayId != null) { + oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC); + oprot.writeString(struct.gatewayId); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -5304,6 +5505,7 @@ import org.slf4j.LoggerFactory; public void write(org.apache.thrift.protocol.TProtocol prot, getCertificateCredential_args struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeString(struct.tokenId); + oprot.writeString(struct.gatewayId); } @Override @@ -5311,6 +5513,8 @@ import org.slf4j.LoggerFactory; TTupleProtocol iprot = (TTupleProtocol) prot; struct.tokenId = iprot.readString(); struct.setTokenIdIsSet(true); + struct.gatewayId = iprot.readString(); + struct.setGatewayIdIsSet(true); } } @@ -5781,6 +5985,7 @@ import org.slf4j.LoggerFactory; private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getPasswordCredential_args"); private static final org.apache.thrift.protocol.TField TOKEN_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("tokenId", org.apache.thrift.protocol.TType.STRING, (short)1); + 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)2); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -5789,10 +5994,12 @@ import org.slf4j.LoggerFactory; } public String tokenId; // required + public String gatewayId; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { - TOKEN_ID((short)1, "tokenId"); + TOKEN_ID((short)1, "tokenId"), + GATEWAY_ID((short)2, "gatewayId"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -5809,6 +6016,8 @@ import org.slf4j.LoggerFactory; switch(fieldId) { case 1: // TOKEN_ID return TOKEN_ID; + case 2: // GATEWAY_ID + return GATEWAY_ID; default: return null; } @@ -5854,6 +6063,8 @@ import org.slf4j.LoggerFactory; Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.TOKEN_ID, new org.apache.thrift.meta_data.FieldMetaData("tokenId", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + 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))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPasswordCredential_args.class, metaDataMap); } @@ -5862,10 +6073,12 @@ import org.slf4j.LoggerFactory; } public getPasswordCredential_args( - String tokenId) + String tokenId, + String gatewayId) { this(); this.tokenId = tokenId; + this.gatewayId = gatewayId; } /** @@ -5875,6 +6088,9 @@ import org.slf4j.LoggerFactory; if (other.isSetTokenId()) { this.tokenId = other.tokenId; } + if (other.isSetGatewayId()) { + this.gatewayId = other.gatewayId; + } } public getPasswordCredential_args deepCopy() { @@ -5884,6 +6100,7 @@ import org.slf4j.LoggerFactory; @Override public void clear() { this.tokenId = null; + this.gatewayId = null; } public String getTokenId() { @@ -5910,6 +6127,30 @@ import org.slf4j.LoggerFactory; } } + public String getGatewayId() { + return this.gatewayId; + } + + public getPasswordCredential_args setGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + return this; + } + + 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 void setFieldValue(_Fields field, Object value) { switch (field) { case TOKEN_ID: @@ -5920,6 +6161,14 @@ import org.slf4j.LoggerFactory; } break; + case GATEWAY_ID: + if (value == null) { + unsetGatewayId(); + } else { + setGatewayId((String)value); + } + break; + } } @@ -5928,6 +6177,9 @@ import org.slf4j.LoggerFactory; case TOKEN_ID: return getTokenId(); + case GATEWAY_ID: + return getGatewayId(); + } throw new IllegalStateException(); } @@ -5941,6 +6193,8 @@ import org.slf4j.LoggerFactory; switch (field) { case TOKEN_ID: return isSetTokenId(); + case GATEWAY_ID: + return isSetGatewayId(); } throw new IllegalStateException(); } @@ -5967,6 +6221,15 @@ import org.slf4j.LoggerFactory; 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; + } + return true; } @@ -5993,6 +6256,16 @@ import org.slf4j.LoggerFactory; return lastComparison; } } + 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; + } + } return 0; } @@ -6020,6 +6293,14 @@ import org.slf4j.LoggerFactory; sb.append(this.tokenId); } first = false; + if (!first) sb.append(", "); + sb.append("gatewayId:"); + if (this.gatewayId == null) { + sb.append("null"); + } else { + sb.append(this.gatewayId); + } + first = false; sb.append(")"); return sb.toString(); } @@ -6029,6 +6310,9 @@ import org.slf4j.LoggerFactory; if (tokenId == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'tokenId' was not present! Struct: " + toString()); } + if (gatewayId == null) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayId' was not present! Struct: " + toString()); + } // check for sub-struct validity } @@ -6074,6 +6358,14 @@ import org.slf4j.LoggerFactory; org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 2: // 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; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -6094,6 +6386,11 @@ import org.slf4j.LoggerFactory; oprot.writeString(struct.tokenId); oprot.writeFieldEnd(); } + if (struct.gatewayId != null) { + oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC); + oprot.writeString(struct.gatewayId); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -6112,6 +6409,7 @@ import org.slf4j.LoggerFactory; public void write(org.apache.thrift.protocol.TProtocol prot, getPasswordCredential_args struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeString(struct.tokenId); + oprot.writeString(struct.gatewayId); } @Override @@ -6119,6 +6417,8 @@ import org.slf4j.LoggerFactory; TTupleProtocol iprot = (TTupleProtocol) prot; struct.tokenId = iprot.readString(); struct.setTokenIdIsSet(true); + struct.gatewayId = iprot.readString(); + struct.setGatewayIdIsSet(true); } } http://git-wip-us.apache.org/repos/asf/airavata/blob/c6fe0dec/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java index 7bcf5a6..ae37b1d 100644 --- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java +++ b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java @@ -52,12 +52,12 @@ import org.slf4j.LoggerFactory; private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CertificateCredential"); private static final org.apache.thrift.protocol.TField COMMUNITY_USER_FIELD_DESC = new org.apache.thrift.protocol.TField("communityUser", org.apache.thrift.protocol.TType.STRUCT, (short)1); - private static final org.apache.thrift.protocol.TField NOT_AFTER_FIELD_DESC = new org.apache.thrift.protocol.TField("notAfter", org.apache.thrift.protocol.TType.STRING, (short)2); - private static final org.apache.thrift.protocol.TField X509_CERT_FIELD_DESC = new org.apache.thrift.protocol.TField("x509Cert", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField X509_CERT_FIELD_DESC = new org.apache.thrift.protocol.TField("x509Cert", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField NOT_AFTER_FIELD_DESC = new org.apache.thrift.protocol.TField("notAfter", org.apache.thrift.protocol.TType.STRING, (short)3); 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)4); - private static final org.apache.thrift.protocol.TField LIFE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("lifeTime", org.apache.thrift.protocol.TType.I32, (short)5); + private static final org.apache.thrift.protocol.TField LIFE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("lifeTime", org.apache.thrift.protocol.TType.I64, (short)5); private static final org.apache.thrift.protocol.TField NOT_BEFORE_FIELD_DESC = new org.apache.thrift.protocol.TField("notBefore", org.apache.thrift.protocol.TType.STRING, (short)6); - private static final org.apache.thrift.protocol.TField PERSISTED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("persistedTime", org.apache.thrift.protocol.TType.I32, (short)7); + 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)7); 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)8); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); @@ -67,19 +67,19 @@ import org.slf4j.LoggerFactory; } public CommunityUser communityUser; // required + public String x509Cert; // required public String notAfter; // optional - public String x509Cert; // optional public String privateKey; // optional - public int lifeTime; // optional + public long lifeTime; // optional public String notBefore; // optional - public int persistedTime; // optional + public long persistedTime; // optional public String token; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { COMMUNITY_USER((short)1, "communityUser"), - NOT_AFTER((short)2, "notAfter"), - X509_CERT((short)3, "x509Cert"), + X509_CERT((short)2, "x509Cert"), + NOT_AFTER((short)3, "notAfter"), PRIVATE_KEY((short)4, "privateKey"), LIFE_TIME((short)5, "lifeTime"), NOT_BEFORE((short)6, "notBefore"), @@ -101,10 +101,10 @@ import org.slf4j.LoggerFactory; switch(fieldId) { case 1: // COMMUNITY_USER return COMMUNITY_USER; - case 2: // NOT_AFTER - return NOT_AFTER; - case 3: // X509_CERT + case 2: // X509_CERT return X509_CERT; + case 3: // NOT_AFTER + return NOT_AFTER; case 4: // PRIVATE_KEY return PRIVATE_KEY; case 5: // LIFE_TIME @@ -158,24 +158,24 @@ import org.slf4j.LoggerFactory; private static final int __LIFETIME_ISSET_ID = 0; private static final int __PERSISTEDTIME_ISSET_ID = 1; private byte __isset_bitfield = 0; - private _Fields optionals[] = {_Fields.NOT_AFTER,_Fields.X509_CERT,_Fields.PRIVATE_KEY,_Fields.LIFE_TIME,_Fields.NOT_BEFORE,_Fields.PERSISTED_TIME,_Fields.TOKEN}; + private _Fields optionals[] = {_Fields.NOT_AFTER,_Fields.PRIVATE_KEY,_Fields.LIFE_TIME,_Fields.NOT_BEFORE,_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.COMMUNITY_USER, new org.apache.thrift.meta_data.FieldMetaData("communityUser", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CommunityUser.class))); - tmpMap.put(_Fields.NOT_AFTER, new org.apache.thrift.meta_data.FieldMetaData("notAfter", org.apache.thrift.TFieldRequirementType.OPTIONAL, + tmpMap.put(_Fields.X509_CERT, new org.apache.thrift.meta_data.FieldMetaData("x509Cert", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.X509_CERT, new org.apache.thrift.meta_data.FieldMetaData("x509Cert", org.apache.thrift.TFieldRequirementType.OPTIONAL, + tmpMap.put(_Fields.NOT_AFTER, new org.apache.thrift.meta_data.FieldMetaData("notAfter", 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.LIFE_TIME, new org.apache.thrift.meta_data.FieldMetaData("lifeTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); tmpMap.put(_Fields.NOT_BEFORE, new org.apache.thrift.meta_data.FieldMetaData("notBefore", 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.I32))); + 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); @@ -186,10 +186,12 @@ import org.slf4j.LoggerFactory; } public CertificateCredential( - CommunityUser communityUser) + CommunityUser communityUser, + String x509Cert) { this(); this.communityUser = communityUser; + this.x509Cert = x509Cert; } /** @@ -200,12 +202,12 @@ import org.slf4j.LoggerFactory; if (other.isSetCommunityUser()) { this.communityUser = new CommunityUser(other.communityUser); } - if (other.isSetNotAfter()) { - this.notAfter = other.notAfter; - } if (other.isSetX509Cert()) { this.x509Cert = other.x509Cert; } + if (other.isSetNotAfter()) { + this.notAfter = other.notAfter; + } if (other.isSetPrivateKey()) { this.privateKey = other.privateKey; } @@ -226,8 +228,8 @@ import org.slf4j.LoggerFactory; @Override public void clear() { this.communityUser = null; - this.notAfter = null; this.x509Cert = null; + this.notAfter = null; this.privateKey = null; setLifeTimeIsSet(false); this.lifeTime = 0; @@ -261,51 +263,51 @@ import org.slf4j.LoggerFactory; } } - public String getNotAfter() { - return this.notAfter; + public String getX509Cert() { + return this.x509Cert; } - public CertificateCredential setNotAfter(String notAfter) { - this.notAfter = notAfter; + public CertificateCredential setX509Cert(String x509Cert) { + this.x509Cert = x509Cert; return this; } - public void unsetNotAfter() { - this.notAfter = null; + public void unsetX509Cert() { + this.x509Cert = null; } - /** Returns true if field notAfter is set (has been assigned a value) and false otherwise */ - public boolean isSetNotAfter() { - return this.notAfter != null; + /** Returns true if field x509Cert is set (has been assigned a value) and false otherwise */ + public boolean isSetX509Cert() { + return this.x509Cert != null; } - public void setNotAfterIsSet(boolean value) { + public void setX509CertIsSet(boolean value) { if (!value) { - this.notAfter = null; + this.x509Cert = null; } } - public String getX509Cert() { - return this.x509Cert; + public String getNotAfter() { + return this.notAfter; } - public CertificateCredential setX509Cert(String x509Cert) { - this.x509Cert = x509Cert; + public CertificateCredential setNotAfter(String notAfter) { + this.notAfter = notAfter; return this; } - public void unsetX509Cert() { - this.x509Cert = null; + public void unsetNotAfter() { + this.notAfter = null; } - /** Returns true if field x509Cert is set (has been assigned a value) and false otherwise */ - public boolean isSetX509Cert() { - return this.x509Cert != null; + /** Returns true if field notAfter is set (has been assigned a value) and false otherwise */ + public boolean isSetNotAfter() { + return this.notAfter != null; } - public void setX509CertIsSet(boolean value) { + public void setNotAfterIsSet(boolean value) { if (!value) { - this.x509Cert = null; + this.notAfter = null; } } @@ -333,11 +335,11 @@ import org.slf4j.LoggerFactory; } } - public int getLifeTime() { + public long getLifeTime() { return this.lifeTime; } - public CertificateCredential setLifeTime(int lifeTime) { + public CertificateCredential setLifeTime(long lifeTime) { this.lifeTime = lifeTime; setLifeTimeIsSet(true); return this; @@ -380,11 +382,11 @@ import org.slf4j.LoggerFactory; } } - public int getPersistedTime() { + public long getPersistedTime() { return this.persistedTime; } - public CertificateCredential setPersistedTime(int persistedTime) { + public CertificateCredential setPersistedTime(long persistedTime) { this.persistedTime = persistedTime; setPersistedTimeIsSet(true); return this; @@ -437,19 +439,19 @@ import org.slf4j.LoggerFactory; } break; - case NOT_AFTER: + case X509_CERT: if (value == null) { - unsetNotAfter(); + unsetX509Cert(); } else { - setNotAfter((String)value); + setX509Cert((String)value); } break; - case X509_CERT: + case NOT_AFTER: if (value == null) { - unsetX509Cert(); + unsetNotAfter(); } else { - setX509Cert((String)value); + setNotAfter((String)value); } break; @@ -465,7 +467,7 @@ import org.slf4j.LoggerFactory; if (value == null) { unsetLifeTime(); } else { - setLifeTime((Integer)value); + setLifeTime((Long)value); } break; @@ -481,7 +483,7 @@ import org.slf4j.LoggerFactory; if (value == null) { unsetPersistedTime(); } else { - setPersistedTime((Integer)value); + setPersistedTime((Long)value); } break; @@ -501,23 +503,23 @@ import org.slf4j.LoggerFactory; case COMMUNITY_USER: return getCommunityUser(); - case NOT_AFTER: - return getNotAfter(); - case X509_CERT: return getX509Cert(); + case NOT_AFTER: + return getNotAfter(); + case PRIVATE_KEY: return getPrivateKey(); case LIFE_TIME: - return Integer.valueOf(getLifeTime()); + return Long.valueOf(getLifeTime()); case NOT_BEFORE: return getNotBefore(); case PERSISTED_TIME: - return Integer.valueOf(getPersistedTime()); + return Long.valueOf(getPersistedTime()); case TOKEN: return getToken(); @@ -535,10 +537,10 @@ import org.slf4j.LoggerFactory; switch (field) { case COMMUNITY_USER: return isSetCommunityUser(); - case NOT_AFTER: - return isSetNotAfter(); case X509_CERT: return isSetX509Cert(); + case NOT_AFTER: + return isSetNotAfter(); case PRIVATE_KEY: return isSetPrivateKey(); case LIFE_TIME: @@ -575,15 +577,6 @@ import org.slf4j.LoggerFactory; return false; } - boolean this_present_notAfter = true && this.isSetNotAfter(); - boolean that_present_notAfter = true && that.isSetNotAfter(); - if (this_present_notAfter || that_present_notAfter) { - if (!(this_present_notAfter && that_present_notAfter)) - return false; - if (!this.notAfter.equals(that.notAfter)) - return false; - } - boolean this_present_x509Cert = true && this.isSetX509Cert(); boolean that_present_x509Cert = true && that.isSetX509Cert(); if (this_present_x509Cert || that_present_x509Cert) { @@ -593,6 +586,15 @@ import org.slf4j.LoggerFactory; return false; } + boolean this_present_notAfter = true && this.isSetNotAfter(); + boolean that_present_notAfter = true && that.isSetNotAfter(); + if (this_present_notAfter || that_present_notAfter) { + if (!(this_present_notAfter && that_present_notAfter)) + return false; + if (!this.notAfter.equals(that.notAfter)) + return false; + } + boolean this_present_privateKey = true && this.isSetPrivateKey(); boolean that_present_privateKey = true && that.isSetPrivateKey(); if (this_present_privateKey || that_present_privateKey) { @@ -664,22 +666,22 @@ import org.slf4j.LoggerFactory; return lastComparison; } } - lastComparison = Boolean.valueOf(isSetNotAfter()).compareTo(other.isSetNotAfter()); + lastComparison = Boolean.valueOf(isSetX509Cert()).compareTo(other.isSetX509Cert()); if (lastComparison != 0) { return lastComparison; } - if (isSetNotAfter()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.notAfter, other.notAfter); + if (isSetX509Cert()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.x509Cert, other.x509Cert); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetX509Cert()).compareTo(other.isSetX509Cert()); + lastComparison = Boolean.valueOf(isSetNotAfter()).compareTo(other.isSetNotAfter()); if (lastComparison != 0) { return lastComparison; } - if (isSetX509Cert()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.x509Cert, other.x509Cert); + if (isSetNotAfter()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.notAfter, other.notAfter); if (lastComparison != 0) { return lastComparison; } @@ -761,6 +763,14 @@ import org.slf4j.LoggerFactory; sb.append(this.communityUser); } first = false; + if (!first) sb.append(", "); + sb.append("x509Cert:"); + if (this.x509Cert == null) { + sb.append("null"); + } else { + sb.append(this.x509Cert); + } + first = false; if (isSetNotAfter()) { if (!first) sb.append(", "); sb.append("notAfter:"); @@ -771,16 +781,6 @@ import org.slf4j.LoggerFactory; } first = false; } - if (isSetX509Cert()) { - if (!first) sb.append(", "); - sb.append("x509Cert:"); - if (this.x509Cert == null) { - sb.append("null"); - } else { - sb.append(this.x509Cert); - } - first = false; - } if (isSetPrivateKey()) { if (!first) sb.append(", "); sb.append("privateKey:"); @@ -832,6 +832,9 @@ import org.slf4j.LoggerFactory; if (communityUser == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'communityUser' was not present! Struct: " + toString()); } + if (x509Cert == null) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'x509Cert' was not present! Struct: " + toString()); + } // check for sub-struct validity if (communityUser != null) { communityUser.validate(); @@ -883,18 +886,18 @@ import org.slf4j.LoggerFactory; org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 2: // NOT_AFTER + case 2: // X509_CERT if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.notAfter = iprot.readString(); - struct.setNotAfterIsSet(true); + struct.x509Cert = iprot.readString(); + struct.setX509CertIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 3: // X509_CERT + case 3: // NOT_AFTER if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.x509Cert = iprot.readString(); - struct.setX509CertIsSet(true); + struct.notAfter = iprot.readString(); + struct.setNotAfterIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -908,8 +911,8 @@ import org.slf4j.LoggerFactory; } break; case 5: // LIFE_TIME - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.lifeTime = iprot.readI32(); + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.lifeTime = iprot.readI64(); struct.setLifeTimeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); @@ -924,8 +927,8 @@ import org.slf4j.LoggerFactory; } break; case 7: // PERSISTED_TIME - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.persistedTime = iprot.readI32(); + 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); @@ -959,6 +962,11 @@ import org.slf4j.LoggerFactory; struct.communityUser.write(oprot); oprot.writeFieldEnd(); } + if (struct.x509Cert != null) { + oprot.writeFieldBegin(X509_CERT_FIELD_DESC); + oprot.writeString(struct.x509Cert); + oprot.writeFieldEnd(); + } if (struct.notAfter != null) { if (struct.isSetNotAfter()) { oprot.writeFieldBegin(NOT_AFTER_FIELD_DESC); @@ -966,13 +974,6 @@ import org.slf4j.LoggerFactory; oprot.writeFieldEnd(); } } - if (struct.x509Cert != null) { - if (struct.isSetX509Cert()) { - oprot.writeFieldBegin(X509_CERT_FIELD_DESC); - oprot.writeString(struct.x509Cert); - oprot.writeFieldEnd(); - } - } if (struct.privateKey != null) { if (struct.isSetPrivateKey()) { oprot.writeFieldBegin(PRIVATE_KEY_FIELD_DESC); @@ -982,7 +983,7 @@ import org.slf4j.LoggerFactory; } if (struct.isSetLifeTime()) { oprot.writeFieldBegin(LIFE_TIME_FIELD_DESC); - oprot.writeI32(struct.lifeTime); + oprot.writeI64(struct.lifeTime); oprot.writeFieldEnd(); } if (struct.notBefore != null) { @@ -994,7 +995,7 @@ import org.slf4j.LoggerFactory; } if (struct.isSetPersistedTime()) { oprot.writeFieldBegin(PERSISTED_TIME_FIELD_DESC); - oprot.writeI32(struct.persistedTime); + oprot.writeI64(struct.persistedTime); oprot.writeFieldEnd(); } if (struct.token != null) { @@ -1022,46 +1023,41 @@ import org.slf4j.LoggerFactory; public void write(org.apache.thrift.protocol.TProtocol prot, CertificateCredential struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.communityUser.write(oprot); + oprot.writeString(struct.x509Cert); BitSet optionals = new BitSet(); if (struct.isSetNotAfter()) { optionals.set(0); } - if (struct.isSetX509Cert()) { - optionals.set(1); - } if (struct.isSetPrivateKey()) { - optionals.set(2); + optionals.set(1); } if (struct.isSetLifeTime()) { - optionals.set(3); + optionals.set(2); } if (struct.isSetNotBefore()) { - optionals.set(4); + optionals.set(3); } if (struct.isSetPersistedTime()) { - optionals.set(5); + optionals.set(4); } if (struct.isSetToken()) { - optionals.set(6); + optionals.set(5); } - oprot.writeBitSet(optionals, 7); + oprot.writeBitSet(optionals, 6); if (struct.isSetNotAfter()) { oprot.writeString(struct.notAfter); } - if (struct.isSetX509Cert()) { - oprot.writeString(struct.x509Cert); - } if (struct.isSetPrivateKey()) { oprot.writeString(struct.privateKey); } if (struct.isSetLifeTime()) { - oprot.writeI32(struct.lifeTime); + oprot.writeI64(struct.lifeTime); } if (struct.isSetNotBefore()) { oprot.writeString(struct.notBefore); } if (struct.isSetPersistedTime()) { - oprot.writeI32(struct.persistedTime); + oprot.writeI64(struct.persistedTime); } if (struct.isSetToken()) { oprot.writeString(struct.token); @@ -1074,32 +1070,30 @@ import org.slf4j.LoggerFactory; struct.communityUser = new CommunityUser(); struct.communityUser.read(iprot); struct.setCommunityUserIsSet(true); - BitSet incoming = iprot.readBitSet(7); + struct.x509Cert = iprot.readString(); + struct.setX509CertIsSet(true); + BitSet incoming = iprot.readBitSet(6); if (incoming.get(0)) { struct.notAfter = iprot.readString(); struct.setNotAfterIsSet(true); } if (incoming.get(1)) { - struct.x509Cert = iprot.readString(); - struct.setX509CertIsSet(true); - } - if (incoming.get(2)) { struct.privateKey = iprot.readString(); struct.setPrivateKeyIsSet(true); } - if (incoming.get(3)) { - struct.lifeTime = iprot.readI32(); + if (incoming.get(2)) { + struct.lifeTime = iprot.readI64(); struct.setLifeTimeIsSet(true); } - if (incoming.get(4)) { + if (incoming.get(3)) { struct.notBefore = iprot.readString(); struct.setNotBeforeIsSet(true); } - if (incoming.get(5)) { - struct.persistedTime = iprot.readI32(); + if (incoming.get(4)) { + struct.persistedTime = iprot.readI64(); struct.setPersistedTimeIsSet(true); } - if (incoming.get(6)) { + if (incoming.get(5)) { struct.token = iprot.readString(); struct.setTokenIsSet(true); } http://git-wip-us.apache.org/repos/asf/airavata/blob/c6fe0dec/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java index 1c91304..f6b6837 100644 --- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java +++ b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java @@ -53,7 +53,7 @@ import org.slf4j.LoggerFactory; 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)1); 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)2); - private static final org.apache.thrift.protocol.TField PERSISTED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("persistedTime", org.apache.thrift.protocol.TType.I32, (short)3); + 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)3); 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)4); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); @@ -64,7 +64,7 @@ import org.slf4j.LoggerFactory; public String username; // required public String password; // required - public int persistedTime; // optional + public long persistedTime; // optional public String token; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @@ -146,7 +146,7 @@ import org.slf4j.LoggerFactory; 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.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.I32))); + 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); @@ -243,11 +243,11 @@ import org.slf4j.LoggerFactory; } } - public int getPersistedTime() { + public long getPersistedTime() { return this.persistedTime; } - public PasswordCredential setPersistedTime(int persistedTime) { + public PasswordCredential setPersistedTime(long persistedTime) { this.persistedTime = persistedTime; setPersistedTimeIsSet(true); return this; @@ -312,7 +312,7 @@ import org.slf4j.LoggerFactory; if (value == null) { unsetPersistedTime(); } else { - setPersistedTime((Integer)value); + setPersistedTime((Long)value); } break; @@ -336,7 +336,7 @@ import org.slf4j.LoggerFactory; return getPassword(); case PERSISTED_TIME: - return Integer.valueOf(getPersistedTime()); + return Long.valueOf(getPersistedTime()); case TOKEN: return getToken(); @@ -588,8 +588,8 @@ import org.slf4j.LoggerFactory; } break; case 3: // PERSISTED_TIME - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.persistedTime = iprot.readI32(); + 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); @@ -630,7 +630,7 @@ import org.slf4j.LoggerFactory; } if (struct.isSetPersistedTime()) { oprot.writeFieldBegin(PERSISTED_TIME_FIELD_DESC); - oprot.writeI32(struct.persistedTime); + oprot.writeI64(struct.persistedTime); oprot.writeFieldEnd(); } if (struct.token != null) { @@ -668,7 +668,7 @@ import org.slf4j.LoggerFactory; } oprot.writeBitSet(optionals, 2); if (struct.isSetPersistedTime()) { - oprot.writeI32(struct.persistedTime); + oprot.writeI64(struct.persistedTime); } if (struct.isSetToken()) { oprot.writeString(struct.token); @@ -684,7 +684,7 @@ import org.slf4j.LoggerFactory; struct.setPasswordIsSet(true); BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { - struct.persistedTime = iprot.readI32(); + struct.persistedTime = iprot.readI64(); struct.setPersistedTimeIsSet(true); } if (incoming.get(1)) { http://git-wip-us.apache.org/repos/asf/airavata/blob/c6fe0dec/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java ---------------------------------------------------------------------- diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java index 60ed316..9fc373a 100644 --- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java +++ b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java @@ -56,7 +56,7 @@ import org.slf4j.LoggerFactory; 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.I32, (short)6); + 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>(); @@ -67,10 +67,10 @@ import org.slf4j.LoggerFactory; public String gatewayId; // required public String username; // required - public String passphrase; // optional + public String passphrase; // required public String publicKey; // optional public String privateKey; // optional - public int persistedTime; // optional + public long persistedTime; // optional public String token; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @@ -152,7 +152,7 @@ import org.slf4j.LoggerFactory; // isset id assignments private static final int __PERSISTEDTIME_ISSET_ID = 0; private byte __isset_bitfield = 0; - private _Fields optionals[] = {_Fields.PASSPHRASE,_Fields.PUBLIC_KEY,_Fields.PRIVATE_KEY,_Fields.PERSISTED_TIME,_Fields.TOKEN}; + private _Fields optionals[] = {_Fields.PUBLIC_KEY,_Fields.PRIVATE_KEY,_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); @@ -160,14 +160,14 @@ import org.slf4j.LoggerFactory; 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, + tmpMap.put(_Fields.PASSPHRASE, new org.apache.thrift.meta_data.FieldMetaData("passphrase", org.apache.thrift.TFieldRequirementType.REQUIRED, 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.I32))); + 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); @@ -179,11 +179,13 @@ import org.slf4j.LoggerFactory; public SSHCredential( String gatewayId, - String username) + String username, + String passphrase) { this(); this.gatewayId = gatewayId; this.username = username; + this.passphrase = passphrase; } /** @@ -348,11 +350,11 @@ import org.slf4j.LoggerFactory; } } - public int getPersistedTime() { + public long getPersistedTime() { return this.persistedTime; } - public SSHCredential setPersistedTime(int persistedTime) { + public SSHCredential setPersistedTime(long persistedTime) { this.persistedTime = persistedTime; setPersistedTimeIsSet(true); return this; @@ -441,7 +443,7 @@ import org.slf4j.LoggerFactory; if (value == null) { unsetPersistedTime(); } else { - setPersistedTime((Integer)value); + setPersistedTime((Long)value); } break; @@ -474,7 +476,7 @@ import org.slf4j.LoggerFactory; return getPrivateKey(); case PERSISTED_TIME: - return Integer.valueOf(getPersistedTime()); + return Long.valueOf(getPersistedTime()); case TOKEN: return getToken(); @@ -705,16 +707,14 @@ import org.slf4j.LoggerFactory; 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 (!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:"); @@ -763,6 +763,9 @@ import org.slf4j.LoggerFactory; if (username == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'username' was not present! Struct: " + toString()); } + if (passphrase == null) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'passphrase' was not present! Struct: " + toString()); + } // check for sub-struct validity } @@ -843,8 +846,8 @@ import org.slf4j.LoggerFactory; } break; case 6: // PERSISTED_TIME - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.persistedTime = iprot.readI32(); + 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); @@ -884,11 +887,9 @@ import org.slf4j.LoggerFactory; oprot.writeFieldEnd(); } if (struct.passphrase != null) { - if (struct.isSetPassphrase()) { - oprot.writeFieldBegin(PASSPHRASE_FIELD_DESC); - oprot.writeString(struct.passphrase); - oprot.writeFieldEnd(); - } + oprot.writeFieldBegin(PASSPHRASE_FIELD_DESC); + oprot.writeString(struct.passphrase); + oprot.writeFieldEnd(); } if (struct.publicKey != null) { if (struct.isSetPublicKey()) { @@ -906,7 +907,7 @@ import org.slf4j.LoggerFactory; } if (struct.isSetPersistedTime()) { oprot.writeFieldBegin(PERSISTED_TIME_FIELD_DESC); - oprot.writeI32(struct.persistedTime); + oprot.writeI64(struct.persistedTime); oprot.writeFieldEnd(); } if (struct.token != null) { @@ -935,26 +936,21 @@ import org.slf4j.LoggerFactory; TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeString(struct.gatewayId); oprot.writeString(struct.username); + oprot.writeString(struct.passphrase); BitSet optionals = new BitSet(); - if (struct.isSetPassphrase()) { - optionals.set(0); - } if (struct.isSetPublicKey()) { - optionals.set(1); + optionals.set(0); } if (struct.isSetPrivateKey()) { - optionals.set(2); + optionals.set(1); } if (struct.isSetPersistedTime()) { - optionals.set(3); + optionals.set(2); } if (struct.isSetToken()) { - optionals.set(4); - } - oprot.writeBitSet(optionals, 5); - if (struct.isSetPassphrase()) { - oprot.writeString(struct.passphrase); + optionals.set(3); } + oprot.writeBitSet(optionals, 4); if (struct.isSetPublicKey()) { oprot.writeString(struct.publicKey); } @@ -962,7 +958,7 @@ import org.slf4j.LoggerFactory; oprot.writeString(struct.privateKey); } if (struct.isSetPersistedTime()) { - oprot.writeI32(struct.persistedTime); + oprot.writeI64(struct.persistedTime); } if (struct.isSetToken()) { oprot.writeString(struct.token); @@ -976,24 +972,22 @@ import org.slf4j.LoggerFactory; struct.setGatewayIdIsSet(true); struct.username = iprot.readString(); struct.setUsernameIsSet(true); - BitSet incoming = iprot.readBitSet(5); + struct.passphrase = iprot.readString(); + struct.setPassphraseIsSet(true); + BitSet incoming = iprot.readBitSet(4); 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)) { + if (incoming.get(1)) { struct.privateKey = iprot.readString(); struct.setPrivateKeyIsSet(true); } - if (incoming.get(3)) { - struct.persistedTime = iprot.readI32(); + if (incoming.get(2)) { + struct.persistedTime = iprot.readI64(); struct.setPersistedTimeIsSet(true); } - if (incoming.get(4)) { + if (incoming.get(3)) { struct.token = iprot.readString(); struct.setTokenIsSet(true); }
