adding local/scp data transfer capability to data manager
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/9bf53d2c Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/9bf53d2c Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/9bf53d2c Branch: refs/heads/develop Commit: 9bf53d2c1879bf01e5732b486a58f6627949457e Parents: 6242aca Author: scnakandala <[email protected]> Authored: Fri Dec 4 01:46:28 2015 -0500 Committer: scnakandala <[email protected]> Committed: Fri Dec 4 01:46:28 2015 -0500 ---------------------------------------------------------------------- .../java/org/apache/airavata/api/Airavata.java | 2 +- .../src/main/resources/lib/airavata/Airavata.h | 2 +- .../lib/airavata/Airavata_server.skeleton.cpp | 2 +- .../lib/airavata/data_resource_models_types.cpp | 36 +- .../lib/airavata/data_resource_models_types.h | 16 +- .../resources/lib/Airavata/API/Airavata.php | 2 +- .../resources/lib/Airavata/API/Error/Types.php | 2 +- .../lib/Airavata/Model/Data/Movement/Types.php | 2 +- .../lib/Airavata/Model/Data/Resource/Types.php | 37 +- .../lib/apache/airavata/api/Airavata.py | 4 +- .../lib/apache/airavata/api/error/ttypes.py | 2 +- .../airavata/model/data/movement/ttypes.py | 2 +- .../airavata/model/data/resource/ttypes.py | 31 +- .../model/data/movement/SecurityProtocol.java | 2 +- .../model/data/resource/DataResourceModel.java | 146 +++++- .../model/error/AuthenticationException.java | 2 +- .../main/resources/airavata-server.properties | 8 +- .../test/resources/airavata-server.properties | 8 +- .../airavata/data/manager/DataManager.java | 4 +- .../data/manager/DataManagerConstants.java | 3 + .../airavata/data/manager/DataManagerImpl.java | 34 +- .../data/manager/utils/DataTransferUtils.java | 142 ++++++ .../data/manager/utils/ssh/SSHApiException.java | 35 ++ .../utils/ssh/SSHAuthenticationUtils.java | 45 ++ .../manager/utils/ssh/SSHCommandOutput.java | 55 ++ .../manager/utils/ssh/SSHKeyAuthentication.java | 83 +++ .../manager/utils/ssh/SSHStandardOutReader.java | 86 ++++ .../data/manager/utils/ssh/SSHUserInfo.java | 70 +++ .../data/manager/utils/ssh/SSHUtils.java | 500 +++++++++++++++++++ .../data/manager/DataManagerImplTest.java | 82 ++- .../airavata/data/manager/utils/AppCatInit.java | 320 ------------ modules/data-manager/src/test/resources/id_rsa | 30 ++ .../data-manager/src/test/resources/id_rsa.pub | 1 + .../data-manager/src/test/resources/known_hosts | 0 .../core/data/catalog/model/DataResource.java | 10 + .../utils/ThriftDataModelConversion.java | 2 + .../src/main/resources/datacatalog-derby.sql | 1 + .../src/test/resources/datacatalog-derby.sql | 1 + .../airavata-api/airavata_api.thrift | 2 +- .../airavata-api/airavata_errors.thrift | 2 +- .../airavata-api/data_movement_models.thrift | 2 +- .../airavata-api/data_resource_models.thrift | 7 +- .../orchestrator.cpi.service.thrift | 2 +- 43 files changed, 1411 insertions(+), 414 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java index 11790f4..6ed3f3a 100644 --- a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java +++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java @@ -414,7 +414,7 @@ public class Airavata { /** * Create an experiment for the specified user belonging to the gateway. The gateway identity is not explicitly passed - * but inferred from the authentication header. This experiment is just a persistent place holder. The client + * but inferred from the sshKeyAuthentication header. This experiment is just a persistent place holder. The client * has to subsequently configure and launch the created experiment. No action is taken on Airavata Server except * registering the experiment in a persistent store. * http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h index 78cb01b..29af511 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h @@ -382,7 +382,7 @@ class AiravataIf { /** * Create an experiment for the specified user belonging to the gateway. The gateway identity is not explicitly passed - * but inferred from the authentication header. This experiment is just a persistent place holder. The client + * but inferred from the sshKeyAuthentication header. This experiment is just a persistent place holder. The client * has to subsequently configure and launch the created experiment. No action is taken on Airavata Server except * registering the experiment in a persistent store. * http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp index 7814f2f..7b4c5df 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp @@ -475,7 +475,7 @@ class AiravataHandler : virtual public AiravataIf { /** * Create an experiment for the specified user belonging to the gateway. The gateway identity is not explicitly passed - * but inferred from the authentication header. This experiment is just a persistent place holder. The client + * but inferred from the sshKeyAuthentication header. This experiment is just a persistent place holder. The client * has to subsequently configure and launch the created experiment. No action is taken on Airavata Server except * registering the experiment in a persistent store. * http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.cpp ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.cpp index 7074618..5ea6e34 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.cpp +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.cpp @@ -50,6 +50,11 @@ void DataResourceModel::__set_resourceDescription(const std::string& val) { __isset.resourceDescription = true; } +void DataResourceModel::__set_ownerName(const std::string& val) { + this->ownerName = val; +__isset.ownerName = true; +} + void DataResourceModel::__set_resourceSize(const int32_t val) { this->resourceSize = val; __isset.resourceSize = true; @@ -65,8 +70,8 @@ void DataResourceModel::__set_lastModifiedTime(const int64_t val) { __isset.lastModifiedTime = true; } -const char* DataResourceModel::ascii_fingerprint = "8F398C67A12C2B477911D779C3172BD6"; -const uint8_t DataResourceModel::binary_fingerprint[16] = {0x8F,0x39,0x8C,0x67,0xA1,0x2C,0x2B,0x47,0x79,0x11,0xD7,0x79,0xC3,0x17,0x2B,0xD6}; +const char* DataResourceModel::ascii_fingerprint = "F4F870AD81FF6118FD1ADC4F20AC188B"; +const uint8_t DataResourceModel::binary_fingerprint[16] = {0xF4,0xF8,0x70,0xAD,0x81,0xFF,0x61,0x18,0xFD,0x1A,0xDC,0x4F,0x20,0xAC,0x18,0x8B}; uint32_t DataResourceModel::read(::apache::thrift::protocol::TProtocol* iprot) { @@ -113,6 +118,14 @@ uint32_t DataResourceModel::read(::apache::thrift::protocol::TProtocol* iprot) { } break; case 4: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->ownerName); + this->__isset.ownerName = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 5: if (ftype == ::apache::thrift::protocol::T_I32) { xfer += iprot->readI32(this->resourceSize); this->__isset.resourceSize = true; @@ -120,7 +133,7 @@ uint32_t DataResourceModel::read(::apache::thrift::protocol::TProtocol* iprot) { xfer += iprot->skip(ftype); } break; - case 5: + case 6: if (ftype == ::apache::thrift::protocol::T_I64) { xfer += iprot->readI64(this->creationTime); this->__isset.creationTime = true; @@ -128,7 +141,7 @@ uint32_t DataResourceModel::read(::apache::thrift::protocol::TProtocol* iprot) { xfer += iprot->skip(ftype); } break; - case 6: + case 7: if (ftype == ::apache::thrift::protocol::T_I64) { xfer += iprot->readI64(this->lastModifiedTime); this->__isset.lastModifiedTime = true; @@ -168,18 +181,23 @@ uint32_t DataResourceModel::write(::apache::thrift::protocol::TProtocol* oprot) xfer += oprot->writeString(this->resourceDescription); xfer += oprot->writeFieldEnd(); } + if (this->__isset.ownerName) { + xfer += oprot->writeFieldBegin("ownerName", ::apache::thrift::protocol::T_STRING, 4); + xfer += oprot->writeString(this->ownerName); + xfer += oprot->writeFieldEnd(); + } if (this->__isset.resourceSize) { - xfer += oprot->writeFieldBegin("resourceSize", ::apache::thrift::protocol::T_I32, 4); + xfer += oprot->writeFieldBegin("resourceSize", ::apache::thrift::protocol::T_I32, 5); xfer += oprot->writeI32(this->resourceSize); xfer += oprot->writeFieldEnd(); } if (this->__isset.creationTime) { - xfer += oprot->writeFieldBegin("creationTime", ::apache::thrift::protocol::T_I64, 5); + xfer += oprot->writeFieldBegin("creationTime", ::apache::thrift::protocol::T_I64, 6); xfer += oprot->writeI64(this->creationTime); xfer += oprot->writeFieldEnd(); } if (this->__isset.lastModifiedTime) { - xfer += oprot->writeFieldBegin("lastModifiedTime", ::apache::thrift::protocol::T_I64, 6); + xfer += oprot->writeFieldBegin("lastModifiedTime", ::apache::thrift::protocol::T_I64, 7); xfer += oprot->writeI64(this->lastModifiedTime); xfer += oprot->writeFieldEnd(); } @@ -194,6 +212,7 @@ void swap(DataResourceModel &a, DataResourceModel &b) { swap(a.resourceId, b.resourceId); swap(a.resourceName, b.resourceName); swap(a.resourceDescription, b.resourceDescription); + swap(a.ownerName, b.ownerName); swap(a.resourceSize, b.resourceSize); swap(a.creationTime, b.creationTime); swap(a.lastModifiedTime, b.lastModifiedTime); @@ -204,6 +223,7 @@ DataResourceModel::DataResourceModel(const DataResourceModel& other0) { resourceId = other0.resourceId; resourceName = other0.resourceName; resourceDescription = other0.resourceDescription; + ownerName = other0.ownerName; resourceSize = other0.resourceSize; creationTime = other0.creationTime; lastModifiedTime = other0.lastModifiedTime; @@ -213,6 +233,7 @@ DataResourceModel& DataResourceModel::operator=(const DataResourceModel& other1) resourceId = other1.resourceId; resourceName = other1.resourceName; resourceDescription = other1.resourceDescription; + ownerName = other1.ownerName; resourceSize = other1.resourceSize; creationTime = other1.creationTime; lastModifiedTime = other1.lastModifiedTime; @@ -225,6 +246,7 @@ std::ostream& operator<<(std::ostream& out, const DataResourceModel& obj) { out << "resourceId="; (obj.__isset.resourceId ? (out << to_string(obj.resourceId)) : (out << "<null>")); out << ", " << "resourceName="; (obj.__isset.resourceName ? (out << to_string(obj.resourceName)) : (out << "<null>")); out << ", " << "resourceDescription="; (obj.__isset.resourceDescription ? (out << to_string(obj.resourceDescription)) : (out << "<null>")); + out << ", " << "ownerName="; (obj.__isset.ownerName ? (out << to_string(obj.ownerName)) : (out << "<null>")); out << ", " << "resourceSize="; (obj.__isset.resourceSize ? (out << to_string(obj.resourceSize)) : (out << "<null>")); out << ", " << "creationTime="; (obj.__isset.creationTime ? (out << to_string(obj.creationTime)) : (out << "<null>")); out << ", " << "lastModifiedTime="; (obj.__isset.lastModifiedTime ? (out << to_string(obj.lastModifiedTime)) : (out << "<null>")); http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.h ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.h b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.h index c9a523a..73d9938 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.h +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.h @@ -41,10 +41,11 @@ class DataResourceModel; class DataReplicaLocationModel; typedef struct _DataResourceModel__isset { - _DataResourceModel__isset() : resourceId(false), resourceName(false), resourceDescription(false), resourceSize(false), creationTime(false), lastModifiedTime(false) {} + _DataResourceModel__isset() : resourceId(false), resourceName(false), resourceDescription(false), ownerName(false), resourceSize(false), creationTime(false), lastModifiedTime(false) {} bool resourceId :1; bool resourceName :1; bool resourceDescription :1; + bool ownerName :1; bool resourceSize :1; bool creationTime :1; bool lastModifiedTime :1; @@ -53,18 +54,19 @@ typedef struct _DataResourceModel__isset { class DataResourceModel { public: - static const char* ascii_fingerprint; // = "8F398C67A12C2B477911D779C3172BD6"; - static const uint8_t binary_fingerprint[16]; // = {0x8F,0x39,0x8C,0x67,0xA1,0x2C,0x2B,0x47,0x79,0x11,0xD7,0x79,0xC3,0x17,0x2B,0xD6}; + static const char* ascii_fingerprint; // = "F4F870AD81FF6118FD1ADC4F20AC188B"; + static const uint8_t binary_fingerprint[16]; // = {0xF4,0xF8,0x70,0xAD,0x81,0xFF,0x61,0x18,0xFD,0x1A,0xDC,0x4F,0x20,0xAC,0x18,0x8B}; DataResourceModel(const DataResourceModel&); DataResourceModel& operator=(const DataResourceModel&); - DataResourceModel() : resourceId(), resourceName(), resourceDescription(), resourceSize(0), creationTime(0), lastModifiedTime(0) { + DataResourceModel() : resourceId(), resourceName(), resourceDescription(), ownerName(), resourceSize(0), creationTime(0), lastModifiedTime(0) { } virtual ~DataResourceModel() throw(); std::string resourceId; std::string resourceName; std::string resourceDescription; + std::string ownerName; int32_t resourceSize; int64_t creationTime; int64_t lastModifiedTime; @@ -77,6 +79,8 @@ class DataResourceModel { void __set_resourceDescription(const std::string& val); + void __set_ownerName(const std::string& val); + void __set_resourceSize(const int32_t val); void __set_creationTime(const int64_t val); @@ -97,6 +101,10 @@ class DataResourceModel { return false; else if (__isset.resourceDescription && !(resourceDescription == rhs.resourceDescription)) return false; + if (__isset.ownerName != rhs.__isset.ownerName) + return false; + else if (__isset.ownerName && !(ownerName == rhs.ownerName)) + return false; if (__isset.resourceSize != rhs.__isset.resourceSize) return false; else if (__isset.resourceSize && !(resourceSize == rhs.resourceSize)) http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php index 746c686..dc0a193 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php @@ -515,7 +515,7 @@ interface AiravataIf { public function getUserExperiments(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $userName, $limit, $offset); /** * Create an experiment for the specified user belonging to the gateway. The gateway identity is not explicitly passed - * but inferred from the authentication header. This experiment is just a persistent place holder. The client + * but inferred from the sshKeyAuthentication header. This experiment is just a persistent place holder. The client * has to subsequently configure and launch the created experiment. No action is taken on Airavata Server except * registering the experiment in a persistent store. * http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Error/Types.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Error/Types.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Error/Types.php index 7d26178..d0a1ab6 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Error/Types.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Error/Types.php @@ -354,7 +354,7 @@ class TimedOutException extends TException { } /** - * This exception is thrown for invalid authentication requests. + * This exception is thrown for invalid sshKeyAuthentication requests. * * message: contains the cause of the authorization failure. */ http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Movement/Types.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Movement/Types.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Movement/Types.php index 2c20bf4..bacee47 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Movement/Types.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Movement/Types.php @@ -27,7 +27,7 @@ final class DMType { } /** - * Enumeration of security authentication and authorization mechanisms supported by Airavata. This enumeration just + * Enumeration of security sshKeyAuthentication and authorization mechanisms supported by Airavata. This enumeration just * describes the supported mechanism. The corresponding security credentials are registered with Airavata Credential * store. * http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Resource/Types.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Resource/Types.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Resource/Types.php index d40b2ad..f0cf287 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Resource/Types.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Resource/Types.php @@ -33,6 +33,10 @@ class DataResourceModel { */ public $resourceDescription = null; /** + * @var string + */ + public $ownerName = null; + /** * @var int */ public $resourceSize = null; @@ -61,14 +65,18 @@ class DataResourceModel { 'type' => TType::STRING, ), 4 => array( + 'var' => 'ownerName', + 'type' => TType::STRING, + ), + 5 => array( 'var' => 'resourceSize', 'type' => TType::I32, ), - 5 => array( + 6 => array( 'var' => 'creationTime', 'type' => TType::I64, ), - 6 => array( + 7 => array( 'var' => 'lastModifiedTime', 'type' => TType::I64, ), @@ -84,6 +92,9 @@ class DataResourceModel { if (isset($vals['resourceDescription'])) { $this->resourceDescription = $vals['resourceDescription']; } + if (isset($vals['ownerName'])) { + $this->ownerName = $vals['ownerName']; + } if (isset($vals['resourceSize'])) { $this->resourceSize = $vals['resourceSize']; } @@ -137,20 +148,27 @@ class DataResourceModel { } break; case 4: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->ownerName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 5: if ($ftype == TType::I32) { $xfer += $input->readI32($this->resourceSize); } else { $xfer += $input->skip($ftype); } break; - case 5: + case 6: if ($ftype == TType::I64) { $xfer += $input->readI64($this->creationTime); } else { $xfer += $input->skip($ftype); } break; - case 6: + case 7: if ($ftype == TType::I64) { $xfer += $input->readI64($this->lastModifiedTime); } else { @@ -185,18 +203,23 @@ class DataResourceModel { $xfer += $output->writeString($this->resourceDescription); $xfer += $output->writeFieldEnd(); } + if ($this->ownerName !== null) { + $xfer += $output->writeFieldBegin('ownerName', TType::STRING, 4); + $xfer += $output->writeString($this->ownerName); + $xfer += $output->writeFieldEnd(); + } if ($this->resourceSize !== null) { - $xfer += $output->writeFieldBegin('resourceSize', TType::I32, 4); + $xfer += $output->writeFieldBegin('resourceSize', TType::I32, 5); $xfer += $output->writeI32($this->resourceSize); $xfer += $output->writeFieldEnd(); } if ($this->creationTime !== null) { - $xfer += $output->writeFieldBegin('creationTime', TType::I64, 5); + $xfer += $output->writeFieldBegin('creationTime', TType::I64, 6); $xfer += $output->writeI64($this->creationTime); $xfer += $output->writeFieldEnd(); } if ($this->lastModifiedTime !== null) { - $xfer += $output->writeFieldBegin('lastModifiedTime', TType::I64, 6); + $xfer += $output->writeFieldBegin('lastModifiedTime', TType::I64, 7); $xfer += $output->writeI64($this->lastModifiedTime); $xfer += $output->writeFieldEnd(); } http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py index 2d473bd..0aae15e 100644 --- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py @@ -466,7 +466,7 @@ class Iface: def createExperiment(self, authzToken, gatewayId, experiment): """ Create an experiment for the specified user belonging to the gateway. The gateway identity is not explicitly passed - but inferred from the authentication header. This experiment is just a persistent place holder. The client + but inferred from the sshKeyAuthentication header. This experiment is just a persistent place holder. The client has to subsequently configure and launch the created experiment. No action is taken on Airavata Server except registering the experiment in a persistent store. @@ -3651,7 +3651,7 @@ class Client(Iface): def createExperiment(self, authzToken, gatewayId, experiment): """ Create an experiment for the specified user belonging to the gateway. The gateway identity is not explicitly passed - but inferred from the authentication header. This experiment is just a persistent place holder. The client + but inferred from the sshKeyAuthentication header. This experiment is just a persistent place holder. The client has to subsequently configure and launch the created experiment. No action is taken on Airavata Server except registering the experiment in a persistent store. http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/error/ttypes.py ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/error/ttypes.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/error/ttypes.py index 0c33acf..130eef5 100644 --- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/error/ttypes.py +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/error/ttypes.py @@ -349,7 +349,7 @@ class TimedOutException(TException): class AuthenticationException(TException): """ - This exception is thrown for invalid authentication requests. + This exception is thrown for invalid sshKeyAuthentication requests. message: contains the cause of the authorization failure. http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/movement/ttypes.py ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/movement/ttypes.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/movement/ttypes.py index db4f516..1caf97e 100644 --- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/movement/ttypes.py +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/movement/ttypes.py @@ -34,7 +34,7 @@ class DMType: class SecurityProtocol: """ - Enumeration of security authentication and authorization mechanisms supported by Airavata. This enumeration just + Enumeration of security sshKeyAuthentication and authorization mechanisms supported by Airavata. This enumeration just describes the supported mechanism. The corresponding security credentials are registered with Airavata Credential store. http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/ttypes.py ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/ttypes.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/ttypes.py index 8c787ab..0055991 100644 --- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/ttypes.py +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/ttypes.py @@ -23,6 +23,7 @@ class DataResourceModel: - resourceId - resourceName - resourceDescription + - ownerName - resourceSize - creationTime - lastModifiedTime @@ -33,15 +34,17 @@ class DataResourceModel: (1, TType.STRING, 'resourceId', None, None, ), # 1 (2, TType.STRING, 'resourceName', None, None, ), # 2 (3, TType.STRING, 'resourceDescription', None, None, ), # 3 - (4, TType.I32, 'resourceSize', None, None, ), # 4 - (5, TType.I64, 'creationTime', None, None, ), # 5 - (6, TType.I64, 'lastModifiedTime', None, None, ), # 6 + (4, TType.STRING, 'ownerName', None, None, ), # 4 + (5, TType.I32, 'resourceSize', None, None, ), # 5 + (6, TType.I64, 'creationTime', None, None, ), # 6 + (7, TType.I64, 'lastModifiedTime', None, None, ), # 7 ) - def __init__(self, resourceId=None, resourceName=None, resourceDescription=None, resourceSize=None, creationTime=None, lastModifiedTime=None,): + def __init__(self, resourceId=None, resourceName=None, resourceDescription=None, ownerName=None, resourceSize=None, creationTime=None, lastModifiedTime=None,): self.resourceId = resourceId self.resourceName = resourceName self.resourceDescription = resourceDescription + self.ownerName = ownerName self.resourceSize = resourceSize self.creationTime = creationTime self.lastModifiedTime = lastModifiedTime @@ -71,16 +74,21 @@ class DataResourceModel: else: iprot.skip(ftype) elif fid == 4: + if ftype == TType.STRING: + self.ownerName = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 5: if ftype == TType.I32: self.resourceSize = iprot.readI32(); else: iprot.skip(ftype) - elif fid == 5: + elif fid == 6: if ftype == TType.I64: self.creationTime = iprot.readI64(); else: iprot.skip(ftype) - elif fid == 6: + elif fid == 7: if ftype == TType.I64: self.lastModifiedTime = iprot.readI64(); else: @@ -107,16 +115,20 @@ class DataResourceModel: oprot.writeFieldBegin('resourceDescription', TType.STRING, 3) oprot.writeString(self.resourceDescription) oprot.writeFieldEnd() + if self.ownerName is not None: + oprot.writeFieldBegin('ownerName', TType.STRING, 4) + oprot.writeString(self.ownerName) + oprot.writeFieldEnd() if self.resourceSize is not None: - oprot.writeFieldBegin('resourceSize', TType.I32, 4) + oprot.writeFieldBegin('resourceSize', TType.I32, 5) oprot.writeI32(self.resourceSize) oprot.writeFieldEnd() if self.creationTime is not None: - oprot.writeFieldBegin('creationTime', TType.I64, 5) + oprot.writeFieldBegin('creationTime', TType.I64, 6) oprot.writeI64(self.creationTime) oprot.writeFieldEnd() if self.lastModifiedTime is not None: - oprot.writeFieldBegin('lastModifiedTime', TType.I64, 6) + oprot.writeFieldBegin('lastModifiedTime', TType.I64, 7) oprot.writeI64(self.lastModifiedTime) oprot.writeFieldEnd() oprot.writeFieldStop() @@ -131,6 +143,7 @@ class DataResourceModel: value = (value * 31) ^ hash(self.resourceId) value = (value * 31) ^ hash(self.resourceName) value = (value * 31) ^ hash(self.resourceDescription) + value = (value * 31) ^ hash(self.ownerName) value = (value * 31) ^ hash(self.resourceSize) value = (value * 31) ^ hash(self.creationTime) value = (value * 31) ^ hash(self.lastModifiedTime) http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/movement/SecurityProtocol.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/movement/SecurityProtocol.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/movement/SecurityProtocol.java index c1f5469..b0662bd 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/movement/SecurityProtocol.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/movement/SecurityProtocol.java @@ -29,7 +29,7 @@ import java.util.HashMap; import org.apache.thrift.TEnum; /** - * Enumeration of security authentication and authorization mechanisms supported by Airavata. This enumeration just + * Enumeration of security sshKeyAuthentication and authorization mechanisms supported by Airavata. This enumeration just * describes the supported mechanism. The corresponding security credentials are registered with Airavata Credential * store. * http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/resource/DataResourceModel.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/resource/DataResourceModel.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/resource/DataResourceModel.java index a0e21f2..85a09a7 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/resource/DataResourceModel.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/resource/DataResourceModel.java @@ -58,9 +58,10 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo private static final org.apache.thrift.protocol.TField RESOURCE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("resourceId", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField RESOURCE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("resourceName", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField RESOURCE_DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("resourceDescription", org.apache.thrift.protocol.TType.STRING, (short)3); - private static final org.apache.thrift.protocol.TField RESOURCE_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("resourceSize", org.apache.thrift.protocol.TType.I32, (short)4); - private static final org.apache.thrift.protocol.TField CREATION_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("creationTime", org.apache.thrift.protocol.TType.I64, (short)5); - private static final org.apache.thrift.protocol.TField LAST_MODIFIED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("lastModifiedTime", org.apache.thrift.protocol.TType.I64, (short)6); + private static final org.apache.thrift.protocol.TField OWNER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("ownerName", org.apache.thrift.protocol.TType.STRING, (short)4); + private static final org.apache.thrift.protocol.TField RESOURCE_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("resourceSize", org.apache.thrift.protocol.TType.I32, (short)5); + private static final org.apache.thrift.protocol.TField CREATION_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("creationTime", org.apache.thrift.protocol.TType.I64, (short)6); + private static final org.apache.thrift.protocol.TField LAST_MODIFIED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("lastModifiedTime", org.apache.thrift.protocol.TType.I64, (short)7); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -71,6 +72,7 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo private String resourceId; // optional private String resourceName; // optional private String resourceDescription; // optional + private String ownerName; // optional private int resourceSize; // optional private long creationTime; // optional private long lastModifiedTime; // optional @@ -80,9 +82,10 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo RESOURCE_ID((short)1, "resourceId"), RESOURCE_NAME((short)2, "resourceName"), RESOURCE_DESCRIPTION((short)3, "resourceDescription"), - RESOURCE_SIZE((short)4, "resourceSize"), - CREATION_TIME((short)5, "creationTime"), - LAST_MODIFIED_TIME((short)6, "lastModifiedTime"); + OWNER_NAME((short)4, "ownerName"), + RESOURCE_SIZE((short)5, "resourceSize"), + CREATION_TIME((short)6, "creationTime"), + LAST_MODIFIED_TIME((short)7, "lastModifiedTime"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -103,11 +106,13 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo return RESOURCE_NAME; case 3: // RESOURCE_DESCRIPTION return RESOURCE_DESCRIPTION; - case 4: // RESOURCE_SIZE + case 4: // OWNER_NAME + return OWNER_NAME; + case 5: // RESOURCE_SIZE return RESOURCE_SIZE; - case 5: // CREATION_TIME + case 6: // CREATION_TIME return CREATION_TIME; - case 6: // LAST_MODIFIED_TIME + case 7: // LAST_MODIFIED_TIME return LAST_MODIFIED_TIME; default: return null; @@ -153,7 +158,7 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo private static final int __CREATIONTIME_ISSET_ID = 1; private static final int __LASTMODIFIEDTIME_ISSET_ID = 2; private byte __isset_bitfield = 0; - private static final _Fields optionals[] = {_Fields.RESOURCE_ID,_Fields.RESOURCE_NAME,_Fields.RESOURCE_DESCRIPTION,_Fields.RESOURCE_SIZE,_Fields.CREATION_TIME,_Fields.LAST_MODIFIED_TIME}; + private static final _Fields optionals[] = {_Fields.RESOURCE_ID,_Fields.RESOURCE_NAME,_Fields.RESOURCE_DESCRIPTION,_Fields.OWNER_NAME,_Fields.RESOURCE_SIZE,_Fields.CREATION_TIME,_Fields.LAST_MODIFIED_TIME}; 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); @@ -163,6 +168,8 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.RESOURCE_DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("resourceDescription", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.OWNER_NAME, new org.apache.thrift.meta_data.FieldMetaData("ownerName", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.RESOURCE_SIZE, new org.apache.thrift.meta_data.FieldMetaData("resourceSize", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.CREATION_TIME, new org.apache.thrift.meta_data.FieldMetaData("creationTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, @@ -190,6 +197,9 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo if (other.isSetResourceDescription()) { this.resourceDescription = other.resourceDescription; } + if (other.isSetOwnerName()) { + this.ownerName = other.ownerName; + } this.resourceSize = other.resourceSize; this.creationTime = other.creationTime; this.lastModifiedTime = other.lastModifiedTime; @@ -204,6 +214,7 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo this.resourceId = null; this.resourceName = null; this.resourceDescription = null; + this.ownerName = null; setResourceSizeIsSet(false); this.resourceSize = 0; setCreationTimeIsSet(false); @@ -281,6 +292,29 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo } } + public String getOwnerName() { + return this.ownerName; + } + + public void setOwnerName(String ownerName) { + this.ownerName = ownerName; + } + + public void unsetOwnerName() { + this.ownerName = null; + } + + /** Returns true if field ownerName is set (has been assigned a value) and false otherwise */ + public boolean isSetOwnerName() { + return this.ownerName != null; + } + + public void setOwnerNameIsSet(boolean value) { + if (!value) { + this.ownerName = null; + } + } + public int getResourceSize() { return this.resourceSize; } @@ -373,6 +407,14 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo } break; + case OWNER_NAME: + if (value == null) { + unsetOwnerName(); + } else { + setOwnerName((String)value); + } + break; + case RESOURCE_SIZE: if (value == null) { unsetResourceSize(); @@ -411,6 +453,9 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo case RESOURCE_DESCRIPTION: return getResourceDescription(); + case OWNER_NAME: + return getOwnerName(); + case RESOURCE_SIZE: return Integer.valueOf(getResourceSize()); @@ -437,6 +482,8 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo return isSetResourceName(); case RESOURCE_DESCRIPTION: return isSetResourceDescription(); + case OWNER_NAME: + return isSetOwnerName(); case RESOURCE_SIZE: return isSetResourceSize(); case CREATION_TIME: @@ -487,6 +534,15 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo return false; } + boolean this_present_ownerName = true && this.isSetOwnerName(); + boolean that_present_ownerName = true && that.isSetOwnerName(); + if (this_present_ownerName || that_present_ownerName) { + if (!(this_present_ownerName && that_present_ownerName)) + return false; + if (!this.ownerName.equals(that.ownerName)) + return false; + } + boolean this_present_resourceSize = true && this.isSetResourceSize(); boolean that_present_resourceSize = true && that.isSetResourceSize(); if (this_present_resourceSize || that_present_resourceSize) { @@ -536,6 +592,11 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo if (present_resourceDescription) list.add(resourceDescription); + boolean present_ownerName = true && (isSetOwnerName()); + list.add(present_ownerName); + if (present_ownerName) + list.add(ownerName); + boolean present_resourceSize = true && (isSetResourceSize()); list.add(present_resourceSize); if (present_resourceSize) @@ -592,6 +653,16 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo return lastComparison; } } + lastComparison = Boolean.valueOf(isSetOwnerName()).compareTo(other.isSetOwnerName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetOwnerName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ownerName, other.ownerName); + if (lastComparison != 0) { + return lastComparison; + } + } lastComparison = Boolean.valueOf(isSetResourceSize()).compareTo(other.isSetResourceSize()); if (lastComparison != 0) { return lastComparison; @@ -671,6 +742,16 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo } first = false; } + if (isSetOwnerName()) { + if (!first) sb.append(", "); + sb.append("ownerName:"); + if (this.ownerName == null) { + sb.append("null"); + } else { + sb.append(this.ownerName); + } + first = false; + } if (isSetResourceSize()) { if (!first) sb.append(", "); sb.append("resourceSize:"); @@ -758,7 +839,15 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 4: // RESOURCE_SIZE + case 4: // OWNER_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.ownerName = iprot.readString(); + struct.setOwnerNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // RESOURCE_SIZE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.resourceSize = iprot.readI32(); struct.setResourceSizeIsSet(true); @@ -766,7 +855,7 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 5: // CREATION_TIME + case 6: // CREATION_TIME if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.creationTime = iprot.readI64(); struct.setCreationTimeIsSet(true); @@ -774,7 +863,7 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 6: // LAST_MODIFIED_TIME + case 7: // LAST_MODIFIED_TIME if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.lastModifiedTime = iprot.readI64(); struct.setLastModifiedTimeIsSet(true); @@ -816,6 +905,13 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo oprot.writeFieldEnd(); } } + if (struct.ownerName != null) { + if (struct.isSetOwnerName()) { + oprot.writeFieldBegin(OWNER_NAME_FIELD_DESC); + oprot.writeString(struct.ownerName); + oprot.writeFieldEnd(); + } + } if (struct.isSetResourceSize()) { oprot.writeFieldBegin(RESOURCE_SIZE_FIELD_DESC); oprot.writeI32(struct.resourceSize); @@ -858,16 +954,19 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo if (struct.isSetResourceDescription()) { optionals.set(2); } - if (struct.isSetResourceSize()) { + if (struct.isSetOwnerName()) { optionals.set(3); } - if (struct.isSetCreationTime()) { + if (struct.isSetResourceSize()) { optionals.set(4); } - if (struct.isSetLastModifiedTime()) { + if (struct.isSetCreationTime()) { optionals.set(5); } - oprot.writeBitSet(optionals, 6); + if (struct.isSetLastModifiedTime()) { + optionals.set(6); + } + oprot.writeBitSet(optionals, 7); if (struct.isSetResourceId()) { oprot.writeString(struct.resourceId); } @@ -877,6 +976,9 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo if (struct.isSetResourceDescription()) { oprot.writeString(struct.resourceDescription); } + if (struct.isSetOwnerName()) { + oprot.writeString(struct.ownerName); + } if (struct.isSetResourceSize()) { oprot.writeI32(struct.resourceSize); } @@ -891,7 +993,7 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo @Override public void read(org.apache.thrift.protocol.TProtocol prot, DataResourceModel struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(6); + BitSet incoming = iprot.readBitSet(7); if (incoming.get(0)) { struct.resourceId = iprot.readString(); struct.setResourceIdIsSet(true); @@ -905,14 +1007,18 @@ public class DataResourceModel implements org.apache.thrift.TBase<DataResourceMo struct.setResourceDescriptionIsSet(true); } if (incoming.get(3)) { + struct.ownerName = iprot.readString(); + struct.setOwnerNameIsSet(true); + } + if (incoming.get(4)) { struct.resourceSize = iprot.readI32(); struct.setResourceSizeIsSet(true); } - if (incoming.get(4)) { + if (incoming.get(5)) { struct.creationTime = iprot.readI64(); struct.setCreationTimeIsSet(true); } - if (incoming.get(5)) { + if (incoming.get(6)) { struct.lastModifiedTime = iprot.readI64(); struct.setLastModifiedTimeIsSet(true); } http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/error/AuthenticationException.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/error/AuthenticationException.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/error/AuthenticationException.java index 2358896..37df665 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/error/AuthenticationException.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/error/AuthenticationException.java @@ -52,7 +52,7 @@ import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) /** - * This exception is thrown for invalid authentication requests. + * This exception is thrown for invalid sshKeyAuthentication requests. * * message: contains the cause of the authorization failure. */ http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/modules/configuration/server/src/main/resources/airavata-server.properties ---------------------------------------------------------------------- diff --git a/modules/configuration/server/src/main/resources/airavata-server.properties b/modules/configuration/server/src/main/resources/airavata-server.properties index 870b229..e2ed68c 100644 --- a/modules/configuration/server/src/main/resources/airavata-server.properties +++ b/modules/configuration/server/src/main/resources/airavata-server.properties @@ -181,10 +181,10 @@ email.password=xxx email.ssl=true [email protected] -# SSH PKI key pair or ssh password can be used SSH based authentication is used. -# if user specify both password authentication gets the higher preference +# SSH PKI key pair or ssh password can be used SSH based sshKeyAuthentication is used. +# if user specify both password sshKeyAuthentication gets the higher preference -################# ---------- For ssh key pair authentication ------------------- ################ +################# ---------- For ssh key pair sshKeyAuthentication ------------------- ################ #ssh.public.key=/path to public key for ssh #ssh.private.key=/path to private key file for ssh #ssh.keypass=passphrase for the private key @@ -192,7 +192,7 @@ [email protected] ## If you set "yes" for ssh.strict.hostKey.checking, then you must provide known hosts file path #ssh.strict.hostKey.checking=yes/no #ssh.known.hosts.file=/path to known hosts file -### Incase of password authentication. +### Incase of password sshKeyAuthentication. #ssh.password=Password for ssh connection ################ ---------- BES Properties ------------------- ############### http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/modules/credential-store/credential-store-service/src/test/resources/airavata-server.properties ---------------------------------------------------------------------- diff --git a/modules/credential-store/credential-store-service/src/test/resources/airavata-server.properties b/modules/credential-store/credential-store-service/src/test/resources/airavata-server.properties index 7aadf21..e74016f 100644 --- a/modules/credential-store/credential-store-service/src/test/resources/airavata-server.properties +++ b/modules/credential-store/credential-store-service/src/test/resources/airavata-server.properties @@ -153,15 +153,15 @@ myproxy.life=3600 # XSEDE Trusted certificates can be downloaded from https://software.xsede.org/security/xsede-certs.tar.gz trusted.cert.location=/Users/lahirugunathilake/Downloads/certificates gfac.passive=false -# SSH PKI key pair or ssh password can be used SSH based authentication is used. -# if user specify both password authentication gets the higher preference +# SSH PKI key pair or ssh password can be used SSH based sshKeyAuthentication is used. +# if user specify both password sshKeyAuthentication gets the higher preference -################# ---------- For ssh key pair authentication ------------------- ################ +################# ---------- For ssh key pair sshKeyAuthentication ------------------- ################ #public.ssh.key=/path to public key for ssh #private.ssh.key=/path to private key file for ssh #ssh.keypass=passphrase for the private key #ssh.username=username for ssh connection -### Incase of password authentication. +### Incase of password sshKeyAuthentication. #ssh.password=Password for ssh connection http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManager.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManager.java b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManager.java index dde3ef1..ae525f1 100644 --- a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManager.java +++ b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManager.java @@ -73,12 +73,12 @@ public interface DataManager { * To copy an already existing resource from the specified replica location to a specified location. After successful * copying the new location will be added to the available replica locations of the resource * @param resourceId - * @param replicaLocationModel + * @param replicaId * @param destLocation * @return * @throws DataManagerException */ - boolean copyResource(String resourceId, DataReplicaLocationModel replicaLocationModel, String destLocation) + boolean copyResource(String resourceId, String replicaId, String destLocation) throws DataManagerException; /** http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerConstants.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerConstants.java b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerConstants.java index 567ee2c..ecfd163 100644 --- a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerConstants.java +++ b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerConstants.java @@ -27,4 +27,7 @@ public class DataManagerConstants { private final static Logger logger = LoggerFactory.getLogger(DataManagerConstants.class); public static final String SCP_URI_SCHEME = "scp"; + public static final String LOCAL_URI_SCHEME = "file"; + + public static final int DEFAULT_SSH_PORT = 22; } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerImpl.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerImpl.java b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerImpl.java index 696c6cd..972abfe 100644 --- a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerImpl.java +++ b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerImpl.java @@ -20,6 +20,9 @@ */ package org.apache.airavata.data.manager; +import org.apache.airavata.data.manager.utils.ssh.SSHAuthenticationUtils; +import org.apache.airavata.data.manager.utils.DataTransferUtils; +import org.apache.airavata.data.manager.utils.ssh.SSHKeyAuthentication; import org.apache.airavata.model.data.resource.DataReplicaLocationModel; import org.apache.airavata.model.data.resource.DataResourceModel; import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory; @@ -29,23 +32,29 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.net.URI; -import java.net.URISyntaxException; import java.util.List; public class DataManagerImpl implements DataManager{ private final static Logger logger = LoggerFactory.getLogger(DataManagerImpl.class); - private DataCatalog dataCatalog; + private final DataCatalog dataCatalog; + private final SSHKeyAuthentication sshKeyAuthentication; public DataManagerImpl() throws DataManagerException { try { this.dataCatalog = RegistryFactory.getDataCatalog(); - } catch (DataCatalogException e) { + this.sshKeyAuthentication = SSHAuthenticationUtils.getSSHKeyAuthentication(); + } catch (Exception e) { logger.error(e.getMessage(), e); throw new DataManagerException(e); } } + public DataManagerImpl(DataCatalog dataCatalog, SSHKeyAuthentication sshKeyAuthentication){ + this.dataCatalog = dataCatalog; + this.sshKeyAuthentication = sshKeyAuthentication; + } + /** * To create a replica entry for an already existing file(s). This is how the system comes to know about already * existing resources @@ -130,33 +139,34 @@ public class DataManagerImpl implements DataManager{ * copying the new location will be added to the available replica locations of the resource * * @param resourceId - * @param replicaLocationModel + * @param replicaId * @param destLocation * @return * @throws DataManagerException */ @Override - public boolean copyResource(String resourceId, DataReplicaLocationModel replicaLocationModel, String destLocation) + public boolean copyResource(String resourceId, String replicaId, String destLocation) throws DataManagerException { try { //FIXME Bellow implementation is a skeleton code only to support the current airavata usecase of one to one copy DataResourceModel resourceModel = getResource(resourceId); + DataReplicaLocationModel replicaLocationModel = getReplicaLocation(replicaId); if(resourceModel == null) throw new DataManagerException("Non existent resource id:"+resourceId); + if(replicaLocationModel == null) + throw new DataManagerException("Non existent replica id:"+replicaId); URI sourceUri = new URI(replicaLocationModel.getDataLocations().get(0)); URI destinationUri = new URI(destLocation); - if(sourceUri.getScheme().equals(destinationUri.getScheme()) && sourceUri.getScheme() - .equals(DataManagerConstants.SCP_URI_SCHEME)){ + DataTransferUtils dataTransferUtils = new DataTransferUtils(sshKeyAuthentication); + boolean result = dataTransferUtils.copyData(sourceUri, destinationUri); + if(result){ - }else{ - throw new DataManagerException("Unsupported Data Transfer protocol. Currently Data Manager only supports" + - " one to one SCP transfers"); } - } catch (URISyntaxException e) { + return result; + } catch (Exception e) { logger.error(e.getMessage(), e); throw new DataManagerException(e); } - return true; } /** http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/DataTransferUtils.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/DataTransferUtils.java b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/DataTransferUtils.java new file mode 100644 index 0000000..c005e9a --- /dev/null +++ b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/DataTransferUtils.java @@ -0,0 +1,142 @@ +/* + * + * 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.data.manager.utils; + +import com.jcraft.jsch.JSch; +import com.jcraft.jsch.JSchException; +import com.jcraft.jsch.Session; +import org.apache.airavata.data.manager.DataManagerConstants; +import org.apache.airavata.data.manager.DataManagerException; +import org.apache.airavata.data.manager.utils.ssh.SSHApiException; +import org.apache.airavata.data.manager.utils.ssh.SSHKeyAuthentication; +import org.apache.airavata.data.manager.utils.ssh.SSHUserInfo; +import org.apache.airavata.data.manager.utils.ssh.SSHUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; + +public class DataTransferUtils { + private final static Logger logger = LoggerFactory.getLogger(DataTransferUtils.class); + + private final SSHKeyAuthentication authentication; + private final JSch jSch; + + public DataTransferUtils(SSHKeyAuthentication authentication) throws DataManagerException { + try { + this.authentication = authentication; + this.jSch = new JSch(); + this.jSch.addIdentity(authentication.getPrivateKeyFilePath(), authentication.getPublicKeyFilePath(), + authentication.getPassphrase().getBytes()); + } catch (JSchException e) { + throw new DataManagerException("JSch initialization error ", e); + } + } + + public boolean copyData(URI srcUri, URI destUri) throws DataManagerException { + if(srcUri.getScheme().equals(DataManagerConstants.LOCAL_URI_SCHEME) + && destUri.getScheme().equals(DataManagerConstants.LOCAL_URI_SCHEME)){ + try{ + copyLocalToLocal(srcUri, destUri); + }catch (IOException e){ + throw new DataManagerException("Error while copying sourceFile: " + srcUri.getPath() + + ", to destinationFile: " + destUri.getPath(), e); + } + }else if(srcUri.getScheme().equals(DataManagerConstants.LOCAL_URI_SCHEME) + && destUri.getScheme().equals(DataManagerConstants.SCP_URI_SCHEME)){ + try { + copyLocalToScp(srcUri, destUri); + } catch (Exception e) { + throw new DataManagerException("Error while copying sourceFile: " + srcUri.getPath() + + ", to destinationFile: " + destUri.getPath(), e); + } + }else if(srcUri.getScheme().equals(DataManagerConstants.SCP_URI_SCHEME) + && destUri.getScheme().equals(DataManagerConstants.LOCAL_URI_SCHEME)){ + try { + copyScpToLocal(srcUri, destUri); + } catch (Exception e) { + throw new DataManagerException("Error while copying sourceFile: " + srcUri.getPath() + + ", to destinationFile: " + destUri.getPath(), e); + } + }else if(srcUri.getScheme().equals(DataManagerConstants.SCP_URI_SCHEME) + && destUri.getScheme().equals(DataManagerConstants.SCP_URI_SCHEME)){ + try { + copyScpToScp(srcUri, destUri); + } catch (Exception e) { + throw new DataManagerException("Error while copying sourceFile: " + srcUri.getPath() + + ", to destinationFile: " + destUri.getPath(), e); + } + }else{ + throw new DataManagerException("Unsupported Data Transfer protocol. Currently Data Manager only supports" + + " one to one SCP/LOCAL transfers"); + } + + return true; + } + + private void copyLocalToLocal(URI srcUri, URI destUri) throws IOException { + Path sourcePath = Paths.get(srcUri.getPath()); + Path targetPath = Paths.get(destUri.getPath()); + Files.copy(sourcePath, targetPath, StandardCopyOption.REPLACE_EXISTING); + } + + private void copyLocalToScp(URI srcUri, URI destUri) throws IOException, JSchException, SSHApiException { + Session destSession = getSSHSession(destUri); + destSession.connect(); + SSHUtils.scpTo(srcUri.getPath(), destUri.getPath(), destSession); + } + + private void copyScpToLocal(URI srcUri, URI destUri) throws IOException, JSchException, SSHApiException { + Session srcSession = getSSHSession(srcUri); + srcSession.connect(); + SSHUtils.scpFrom(srcUri.getPath(), destUri.getPath(), srcSession); + } + + private void copyScpToScp(URI srcUri, URI destUri) throws JSchException, IOException { + Session srcSession = getSSHSession(srcUri); + srcSession.connect(); + Session destSession = getSSHSession(destUri); + destSession.connect(); + SSHUtils.scpThirdParty(srcUri.getPath(), srcSession, destUri.getPath(), destSession); + } + + private Session getSSHSession(URI uri) throws JSchException { + int port; + if(uri.getPort() == -1){ + port = DataManagerConstants.DEFAULT_SSH_PORT; + }else{ + port = uri.getPort(); + } + Session session = jSch.getSession(authentication.getUserName(), uri.getHost(), port); + session.setUserInfo(new SSHUserInfo(authentication.getUserName(), null, authentication.getPassphrase())); + if (authentication.getStrictHostKeyChecking().equals("yes")) { + jSch.setKnownHosts(authentication.getKnownHostsFilePath()); + } else { + session.setConfig("StrictHostKeyChecking", "no"); + } + return session; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHApiException.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHApiException.java b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHApiException.java new file mode 100644 index 0000000..70219e5 --- /dev/null +++ b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHApiException.java @@ -0,0 +1,35 @@ +/* + * + * 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.data.manager.utils.ssh; + +/** + * An exception class to wrap SSH command execution related errors. + */ +public class SSHApiException extends Exception { + + public SSHApiException(String message) { + super(message); + } + + public SSHApiException(String message, Exception e) { + super(message, e); + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHAuthenticationUtils.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHAuthenticationUtils.java b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHAuthenticationUtils.java new file mode 100644 index 0000000..bd4d3f3 --- /dev/null +++ b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHAuthenticationUtils.java @@ -0,0 +1,45 @@ +/* + * + * 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.data.manager.utils.ssh; + +import org.apache.airavata.common.exception.ApplicationSettingsException; +import org.apache.airavata.common.utils.ServerSettings; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SSHAuthenticationUtils { + private final static Logger logger = LoggerFactory.getLogger(SSHAuthenticationUtils.class); + + public static SSHKeyAuthentication getSSHKeyAuthentication() throws ApplicationSettingsException { + SSHKeyAuthentication sshKA = new SSHKeyAuthentication(); + sshKA.setUserName(ServerSettings.getSetting("ssh.username")); + sshKA.setPassphrase(ServerSettings.getSetting("ssh.keypass")); + sshKA.setPrivateKeyFilePath(ServerSettings.getSetting("ssh.private.key")); + sshKA.setPublicKeyFilePath(ServerSettings.getSetting("ssh.public.key")); + sshKA.setStrictHostKeyChecking(ServerSettings.getSetting("ssh.strict.hostKey.checking", "no")); + sshKA.setKnownHostsFilePath(ServerSettings.getSetting("ssh.known.hosts.file", null)); + if (sshKA.getStrictHostKeyChecking().equals("yes") && sshKA.getKnownHostsFilePath() == null) { + throw new ApplicationSettingsException("If ssh scrict hostky checking property is set to yes, you must " + + "provid known host file path"); + } + return sshKA; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHCommandOutput.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHCommandOutput.java b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHCommandOutput.java new file mode 100644 index 0000000..a13995b --- /dev/null +++ b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHCommandOutput.java @@ -0,0 +1,55 @@ +/** + * 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.data.manager.utils.ssh; + +import com.jcraft.jsch.Channel; +import java.io.OutputStream; + +/** + * Output of a certain command. + */ +public interface SSHCommandOutput { + + /** + * Gets the output of the command as a stream. + * @param channel Command output as a stream. + */ + void onOutput(Channel channel); + + /** + * Gets standard error as a output stream. + * @return Command error as a stream. + */ + OutputStream getStandardError(); + + /** + * The command exit code. + * @param code The program exit code + */ + void exitCode(int code); + + /** + * Return the exit code of the command execution. + * @return exit code + */ + int getExitCode(); + +} http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHKeyAuthentication.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHKeyAuthentication.java b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHKeyAuthentication.java new file mode 100644 index 0000000..d4f2b12 --- /dev/null +++ b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHKeyAuthentication.java @@ -0,0 +1,83 @@ +/* + * + * 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.data.manager.utils.ssh; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SSHKeyAuthentication { + private final static Logger logger = LoggerFactory.getLogger(SSHKeyAuthentication.class); + + private String userName; + private String privateKeyFilePath; + private String publicKeyFilePath; + private String passphrase; + private String knownHostsFilePath; + private String strictHostKeyChecking; // yes or no + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPrivateKeyFilePath() { + return privateKeyFilePath; + } + + public void setPrivateKeyFilePath(String privateKeyFilePath) { + this.privateKeyFilePath = privateKeyFilePath; + } + + public String getPublicKeyFilePath() { + return publicKeyFilePath; + } + + public void setPublicKeyFilePath(String publicKeyFilePath) { + this.publicKeyFilePath = publicKeyFilePath; + } + + public String getPassphrase() { + return passphrase; + } + + public void setPassphrase(String passphrase) { + this.passphrase = passphrase; + } + + public String getKnownHostsFilePath() { + return knownHostsFilePath; + } + + public void setKnownHostsFilePath(String knownHostsFilePath) { + this.knownHostsFilePath = knownHostsFilePath; + } + + public String getStrictHostKeyChecking() { + return strictHostKeyChecking; + } + + public void setStrictHostKeyChecking(String strictHostKeyChecking) { + this.strictHostKeyChecking = strictHostKeyChecking; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHStandardOutReader.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHStandardOutReader.java b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHStandardOutReader.java new file mode 100644 index 0000000..5443691 --- /dev/null +++ b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHStandardOutReader.java @@ -0,0 +1,86 @@ +/* + * + * 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.data.manager.utils.ssh; + +import com.jcraft.jsch.Channel; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +public class SSHStandardOutReader implements SSHCommandOutput { + + private static final Logger logger = LoggerFactory.getLogger(SSHStandardOutReader.class); + String stdOutputString = null; + ByteArrayOutputStream errorStream = new ByteArrayOutputStream(); + private int exitCode; + + public void onOutput(Channel channel) { + try { + StringBuffer pbsOutput = new StringBuffer(""); + InputStream inputStream = channel.getInputStream(); + byte[] tmp = new byte[1024]; + do { + while (inputStream.available() > 0) { + int i = inputStream.read(tmp, 0, 1024); + if (i < 0) break; + pbsOutput.append(new String(tmp, 0, i)); + } + } while (!channel.isClosed()) ; + String output = pbsOutput.toString(); + this.setStdOutputString(output); + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + + } + + + public void exitCode(int code) { + System.out.println("Program exit code - " + code); + this.exitCode = code; + } + + @Override + public int getExitCode() { + return exitCode; + } + + public String getStdOutputString() { + return stdOutputString; + } + + public void setStdOutputString(String stdOutputString) { + this.stdOutputString = stdOutputString; + } + + public String getStdErrorString() { + return errorStream.toString(); + } + + public OutputStream getStandardError() { + return errorStream; + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/9bf53d2c/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHUserInfo.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHUserInfo.java b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHUserInfo.java new file mode 100644 index 0000000..a3d8e34 --- /dev/null +++ b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/utils/ssh/SSHUserInfo.java @@ -0,0 +1,70 @@ +/* + * + * 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.data.manager.utils.ssh; + +import com.jcraft.jsch.UserInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SSHUserInfo implements UserInfo { + + private final static Logger logger = LoggerFactory.getLogger(SSHUserInfo.class); + + private String userName; + private String password; + private String passphrase; + + public SSHUserInfo(String userName, String password, String passphrase) { + this.userName = userName; + this.password = password; + this.passphrase = passphrase; + } + + @Override + public String getPassphrase() { + return null; + } + + @Override + public String getPassword() { + return null; + } + + @Override + public boolean promptPassword(String s) { + return false; + } + + @Override + public boolean promptPassphrase(String s) { + return false; + } + + @Override + public boolean promptYesNo(String s) { + return false; + } + + @Override + public void showMessage(String s) { + + } +} \ No newline at end of file
