airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject airavata git commit: fixing bugs in data manager
Date Thu, 17 Dec 2015 18:22:57 GMT
Repository: airavata
Updated Branches:
  refs/heads/master de9fe01c3 -> e3a183e8a


fixing bugs in data manager


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/e3a183e8
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/e3a183e8
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/e3a183e8

Branch: refs/heads/master
Commit: e3a183e8a2210052d9eb28ea35eaa138cf96e4ce
Parents: de9fe01
Author: scnakandala <supun.nakandala@gmail.com>
Authored: Thu Dec 17 13:22:52 2015 -0500
Committer: scnakandala <supun.nakandala@gmail.com>
Committed: Thu Dec 17 13:22:52 2015 -0500

----------------------------------------------------------------------
 .../client/samples/DataManagerSample.java       |  4 +--
 .../data/manager/core/DataManagerImpl.java      | 27 +++++++++++++-------
 2 files changed, 20 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/e3a183e8/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/DataManagerSample.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/DataManagerSample.java
b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/DataManagerSample.java
index 655ccf6..fb820a1 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/DataManagerSample.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/DataManagerSample.java
@@ -62,8 +62,8 @@ public class DataManagerSample {
             String resourceId = client.registerDataResource(authzToken, dataResourceModel);
             System.out.println(resourceId);
 
-//            String replicaId = client.copyDataResource(authzToken, resourceId, STORAGE_RESOURCE_ID,
"/var/www/portals/gateway-user-data/test-dest");
-//            System.out.println(replicaId);
+            String replicaId = client.copyDataResource(authzToken, resourceId, STORAGE_RESOURCE_ID,
"/var/www/portals/gateway-user-data/test-dest");
+            System.out.println(replicaId);
 
             GatewayResourceProfile gatewayResourceProfile = client.getGatewayResourceProfile(authzToken,
DEFAULT_GATEWAY);
             System.out.println(gatewayResourceProfile.getGatewayID());

http://git-wip-us.apache.org/repos/asf/airavata/blob/e3a183e8/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerImpl.java
b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerImpl.java
index 7c600d7..b7566ed 100644
--- a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerImpl.java
+++ b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerImpl.java
@@ -278,21 +278,30 @@ public class DataManagerImpl implements DataManager {
             //Finding the gateway specific storage preferences for resources
             GatewayResourceProfile gatewayProfile = appCatalog.getGatewayProfile().getGatewayProfile(dataResourceModel.getGatewayId());
             List<StoragePreference> storagePreferences = gatewayProfile.getStoragePreferences();
-            Optional<StoragePreference> sourceResourcePreference = storagePreferences.stream()
-                    .filter(sp -> sp.getStorageResourceId().equals(sourceStorageResource.getStorageResourceId())).findFirst();
-            if(!sourceResourcePreference.isPresent())
+            StoragePreference sourceResourcePreference = null;
+            for(StoragePreference sp : storagePreferences) {
+                if (sp.getStorageResourceId().equals(sourceStorageResource.getStorageResourceId()))
{
+                    sourceResourcePreference = sp;
+                    break;
+                }
+            }
+            if(sourceResourcePreference == null)
                 throw new DataCatalogException("Could not find storage preference for storage
resource id:"
                         + sourceStorageResource.getStorageResourceId());
-            Optional<StoragePreference> destResourcePreference = storagePreferences.stream()
-                    .filter(sp -> sp.getStorageResourceId().equals(destinationStorageResource.getStorageResourceId())).findFirst();
-            if(!destResourcePreference.isPresent())
+            StoragePreference destResourcePreference = null;
+            for(StoragePreference sp : storagePreferences) {
+                if (sp.getStorageResourceId().equals(destStorageResourceId)) {
+                    destResourcePreference = sp;
+                    break;
+                }
+            }
+            if(destResourcePreference == null)
                 throw new DataCatalogException("Could not find storage preference for storage
resource id:"
                         + destinationStorageResource.getStorageResourceId());
 
-
             String destFilePath = copyUsingScp(gatewayProfile, sourceStorageResource, sourceDataMovementInterface.get(),
-                    sourceResourcePreference.get(), sourceReplica, destinationStorageResource,
destDataMovementInterface.get(),
-                    destResourcePreference.get(), destinationParentPath);
+                    sourceResourcePreference, sourceReplica, destinationStorageResource,
destDataMovementInterface.get(),
+                    destResourcePreference, destinationParentPath);
 
             DataReplicaLocationModel dataReplicaLocationModel = new DataReplicaLocationModel();
             dataReplicaLocationModel.setResourceId(dataResourceId);


Mime
View raw message