You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sh...@apache.org on 2016/10/13 18:32:57 UTC
[04/30] airavata git commit: Making the token field required in
SSHCredentialSummary
Making the token field required in SSHCredentialSummary
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/3170fefd
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/3170fefd
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/3170fefd
Branch: refs/heads/develop
Commit: 3170fefdf371e6db6cd4099570ff294909eec10e
Parents: eb0cd63
Author: Anuj Bhandar <bh...@gmail.com>
Authored: Mon Oct 10 15:18:02 2016 -0400
Committer: Anuj Bhandar <bh...@gmail.com>
Committed: Mon Oct 10 15:35:32 2016 -0400
----------------------------------------------------------------------
.../impl/ssh/SSHCredentialSummary.java | 101 +++++++++++++++++++
.../store/datamodel/SSHCredentialSummary.java | 56 +++++-----
.../credential_store_data_models.thrift | 2 +-
3 files changed, 127 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/3170fefd/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialSummary.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialSummary.java b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialSummary.java
new file mode 100644
index 0000000..f838eaa
--- /dev/null
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialSummary.java
@@ -0,0 +1,101 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+package org.apache.airavata.credential.store.credential.impl.ssh;
+
+import org.apache.airavata.credential.store.credential.Credential;
+
+import java.io.Serializable;
+
+/**
+ * An SSH Credential Summary class which is an extension of Airavata Credential
+ */
+public class SSHCredentialSummary extends Credential implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1235236447420198981L;
+
+ private byte[] publicKey;
+ private String gateway;
+ private String username;
+ private String token;
+ private String description;
+
+ @Override
+ public String getToken() {
+ return token;
+ }
+
+ @Override
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+
+ public SSHCredentialSummary() {
+ }
+
+ public SSHCredentialSummary(byte[] publicKey, String token, String gateway, String username) {
+ this.publicKey = publicKey;
+ this.gateway = gateway;
+ this.username = username;
+ this.token = token;
+ this.setPortalUserName(username);
+ }
+
+
+ public byte[] getPublicKey() {
+ return publicKey;
+ }
+
+ public void setPublicKey(byte[] pubKey) {
+ this.publicKey = pubKey;
+ }
+
+ public String getGateway() {
+ return gateway;
+ }
+
+ public void setGateway(String gateway) {
+ this.gateway = gateway;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/3170fefd/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredentialSummary.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredentialSummary.java b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredentialSummary.java
index d0a8a12..624fc0b 100644
--- a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredentialSummary.java
+++ b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredentialSummary.java
@@ -71,7 +71,7 @@ public class SSHCredentialSummary implements org.apache.thrift.TBase<SSHCredenti
public String username; // required
public String publicKey; // optional
public long persistedTime; // optional
- public String token; // optional
+ public String token; // required
public String description; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -150,7 +150,7 @@ public class SSHCredentialSummary implements org.apache.thrift.TBase<SSHCredenti
// isset id assignments
private static final int __PERSISTEDTIME_ISSET_ID = 0;
private byte __isset_bitfield = 0;
- private static final _Fields optionals[] = {_Fields.PUBLIC_KEY,_Fields.PERSISTED_TIME,_Fields.TOKEN,_Fields.DESCRIPTION};
+ private static final _Fields optionals[] = {_Fields.PUBLIC_KEY,_Fields.PERSISTED_TIME,_Fields.DESCRIPTION};
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);
@@ -162,7 +162,7 @@ public class SSHCredentialSummary implements org.apache.thrift.TBase<SSHCredenti
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,
+ tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", 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)));
@@ -175,11 +175,13 @@ public class SSHCredentialSummary implements org.apache.thrift.TBase<SSHCredenti
public SSHCredentialSummary(
String gatewayId,
- String username)
+ String username,
+ String token)
{
this();
this.gatewayId = gatewayId;
this.username = username;
+ this.token = token;
}
/**
@@ -689,16 +691,14 @@ public class SSHCredentialSummary implements org.apache.thrift.TBase<SSHCredenti
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 (!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:");
@@ -721,6 +721,9 @@ public class SSHCredentialSummary implements org.apache.thrift.TBase<SSHCredenti
if (username == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'username' was not present! Struct: " + toString());
}
+ if (token == null) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'token' was not present! Struct: " + toString());
+ }
// check for sub-struct validity
}
@@ -846,11 +849,9 @@ public class SSHCredentialSummary implements org.apache.thrift.TBase<SSHCredenti
oprot.writeFieldEnd();
}
if (struct.token != null) {
- if (struct.isSetToken()) {
- oprot.writeFieldBegin(TOKEN_FIELD_DESC);
- oprot.writeString(struct.token);
- oprot.writeFieldEnd();
- }
+ oprot.writeFieldBegin(TOKEN_FIELD_DESC);
+ oprot.writeString(struct.token);
+ oprot.writeFieldEnd();
}
if (struct.description != null) {
if (struct.isSetDescription()) {
@@ -878,6 +879,7 @@ public class SSHCredentialSummary implements org.apache.thrift.TBase<SSHCredenti
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeString(struct.gatewayId);
oprot.writeString(struct.username);
+ oprot.writeString(struct.token);
BitSet optionals = new BitSet();
if (struct.isSetPublicKey()) {
optionals.set(0);
@@ -885,22 +887,16 @@ public class SSHCredentialSummary implements org.apache.thrift.TBase<SSHCredenti
if (struct.isSetPersistedTime()) {
optionals.set(1);
}
- if (struct.isSetToken()) {
- optionals.set(2);
- }
if (struct.isSetDescription()) {
- optionals.set(3);
+ optionals.set(2);
}
- oprot.writeBitSet(optionals, 4);
+ oprot.writeBitSet(optionals, 3);
if (struct.isSetPublicKey()) {
oprot.writeString(struct.publicKey);
}
if (struct.isSetPersistedTime()) {
oprot.writeI64(struct.persistedTime);
}
- if (struct.isSetToken()) {
- oprot.writeString(struct.token);
- }
if (struct.isSetDescription()) {
oprot.writeString(struct.description);
}
@@ -913,7 +909,9 @@ public class SSHCredentialSummary implements org.apache.thrift.TBase<SSHCredenti
struct.setGatewayIdIsSet(true);
struct.username = iprot.readString();
struct.setUsernameIsSet(true);
- BitSet incoming = iprot.readBitSet(4);
+ struct.token = iprot.readString();
+ struct.setTokenIsSet(true);
+ BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.publicKey = iprot.readString();
struct.setPublicKeyIsSet(true);
@@ -923,10 +921,6 @@ public class SSHCredentialSummary implements org.apache.thrift.TBase<SSHCredenti
struct.setPersistedTimeIsSet(true);
}
if (incoming.get(2)) {
- struct.token = iprot.readString();
- struct.setTokenIsSet(true);
- }
- if (incoming.get(3)) {
struct.description = iprot.readString();
struct.setDescriptionIsSet(true);
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/3170fefd/thrift-interface-descriptions/component-cpis/credential_store_data_models.thrift
----------------------------------------------------------------------
diff --git a/thrift-interface-descriptions/component-cpis/credential_store_data_models.thrift b/thrift-interface-descriptions/component-cpis/credential_store_data_models.thrift
index c7998e3..f2c2c77 100644
--- a/thrift-interface-descriptions/component-cpis/credential_store_data_models.thrift
+++ b/thrift-interface-descriptions/component-cpis/credential_store_data_models.thrift
@@ -40,7 +40,7 @@ struct SSHCredentialSummary {
2: required string username,
3: optional string publicKey,
4: optional i64 persistedTime,
- 5: optional string token,
+ 5: required string token,
6: optional string description
}