airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject [01/55] [abbrv] airavata git commit: adding replica catalog related API methods
Date Fri, 25 Mar 2016 21:22:24 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 7e7e3a969 -> ab262c706


http://git-wip-us.apache.org/repos/asf/airavata/blob/6c5645d3/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/appcatalog/computeresource/ttypes.py
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/appcatalog/computeresource/ttypes.py
b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/appcatalog/computeresource/ttypes.py
index 07cda34..e129db4 100644
--- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/appcatalog/computeresource/ttypes.py
+++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/appcatalog/computeresource/ttypes.py
@@ -596,21 +596,21 @@ class LOCALSubmission:
 
   Attributes:
    - jobSubmissionInterfaceId
-   - securityProtocol
    - resourceJobManager
+   - securityProtocol
   """
 
   thrift_spec = (
     None, # 0
     (1, TType.STRING, 'jobSubmissionInterfaceId', None, "DO_NOT_SET_AT_CLIENTS", ), # 1
-    (2, TType.I32, 'securityProtocol', None, None, ), # 2
-    (3, TType.STRUCT, 'resourceJobManager', (ResourceJobManager, ResourceJobManager.thrift_spec),
None, ), # 3
+    (2, TType.STRUCT, 'resourceJobManager', (ResourceJobManager, ResourceJobManager.thrift_spec),
None, ), # 2
+    (3, TType.I32, 'securityProtocol', None, None, ), # 3
   )
 
-  def __init__(self, jobSubmissionInterfaceId=thrift_spec[1][4], securityProtocol=None, resourceJobManager=None,):
+  def __init__(self, jobSubmissionInterfaceId=thrift_spec[1][4], resourceJobManager=None,
securityProtocol=None,):
     self.jobSubmissionInterfaceId = jobSubmissionInterfaceId
-    self.securityProtocol = securityProtocol
     self.resourceJobManager = resourceJobManager
+    self.securityProtocol = securityProtocol
 
   def read(self, iprot):
     if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans,
TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
@@ -627,16 +627,16 @@ class LOCALSubmission:
         else:
           iprot.skip(ftype)
       elif fid == 2:
-        if ftype == TType.I32:
-          self.securityProtocol = iprot.readI32()
-        else:
-          iprot.skip(ftype)
-      elif fid == 3:
         if ftype == TType.STRUCT:
           self.resourceJobManager = ResourceJobManager()
           self.resourceJobManager.read(iprot)
         else:
           iprot.skip(ftype)
+      elif fid == 3:
+        if ftype == TType.I32:
+          self.securityProtocol = iprot.readI32()
+        else:
+          iprot.skip(ftype)
       else:
         iprot.skip(ftype)
       iprot.readFieldEnd()
@@ -651,22 +651,20 @@ class LOCALSubmission:
       oprot.writeFieldBegin('jobSubmissionInterfaceId', TType.STRING, 1)
       oprot.writeString(self.jobSubmissionInterfaceId)
       oprot.writeFieldEnd()
-    if self.securityProtocol is not None:
-      oprot.writeFieldBegin('securityProtocol', TType.I32, 2)
-      oprot.writeI32(self.securityProtocol)
-      oprot.writeFieldEnd()
     if self.resourceJobManager is not None:
-      oprot.writeFieldBegin('resourceJobManager', TType.STRUCT, 3)
+      oprot.writeFieldBegin('resourceJobManager', TType.STRUCT, 2)
       self.resourceJobManager.write(oprot)
       oprot.writeFieldEnd()
+    if self.securityProtocol is not None:
+      oprot.writeFieldBegin('securityProtocol', TType.I32, 3)
+      oprot.writeI32(self.securityProtocol)
+      oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
 
   def validate(self):
     if self.jobSubmissionInterfaceId is None:
       raise TProtocol.TProtocolException(message='Required field jobSubmissionInterfaceId
is unset!')
-    if self.securityProtocol is None:
-      raise TProtocol.TProtocolException(message='Required field securityProtocol is unset!')
     if self.resourceJobManager is None:
       raise TProtocol.TProtocolException(message='Required field resourceJobManager is unset!')
     return
@@ -675,8 +673,8 @@ class LOCALSubmission:
   def __hash__(self):
     value = 17
     value = (value * 31) ^ hash(self.jobSubmissionInterfaceId)
-    value = (value * 31) ^ hash(self.securityProtocol)
     value = (value * 31) ^ hash(self.resourceJobManager)
+    value = (value * 31) ^ hash(self.securityProtocol)
     return value
 
   def __repr__(self):

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c5645d3/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/DataCatalogSample.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/DataCatalogSample.java
b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/DataCatalogSample.java
new file mode 100644
index 0000000..c26d371
--- /dev/null
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/DataCatalogSample.java
@@ -0,0 +1,73 @@
+/*
+ *
+ * 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.client.samples;
+
+import org.apache.airavata.api.Airavata;
+import org.apache.airavata.api.client.AiravataClientFactory;
+import org.apache.airavata.model.data.product.*;
+import org.apache.airavata.model.security.AuthzToken;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DataCatalogSample {
+    private final static Logger logger = LoggerFactory.getLogger(DataCatalogSample.class);
+
+    public static final String THRIFT_SERVER_HOST = "gw56.iu.xsede.org";
+    public static final int THRIFT_SERVER_PORT = 8930;
+    private static final String USER_NAME = "master";
+    private static final String DEFAULT_GATEWAY = "default";
+    private static final String STORAGE_RESOURCE_ID = "gw75.iu.xsede.org_3e40e62b-be11-4590-bf24-b1b6796c3572";
+    private static final AuthzToken authzToken = new AuthzToken("empty-token");
+    private static Airavata.Client client;
+
+    public static void main(String[] args) {
+        try {
+            client = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT);
+            System.out.println(client.getAPIVersion(authzToken));
+
+            DataProductModel dataProductModel = new DataProductModel();
+            dataProductModel.setGatewayId(DEFAULT_GATEWAY);
+            dataProductModel.setOwnerName(USER_NAME);
+            dataProductModel.setProductName("test-1");
+            dataProductModel.setLogicalPath("/test/test/test");
+            dataProductModel.setDataProductType(DataProductType.FILE);
+
+            DataReplicaLocationModel replicaLocationModel = new DataReplicaLocationModel();
+            replicaLocationModel.setStorageResourceId(STORAGE_RESOURCE_ID);
+            replicaLocationModel.setReplicaName("test-1-replica-1");
+            replicaLocationModel.setReplicaLocationCategory(ReplicaLocationCategory.GATEWAY_DATA_STORE);
+            replicaLocationModel.setReplicaPersistentType(ReplicaPersistentType.PERSISTENT);
+            replicaLocationModel.setFilePath("/var/www/portals/gateway-user-data/testdrive/test.txt");
+
+            dataProductModel.addToReplicaLocations(replicaLocationModel);
+
+            String productUri = client.registerDataProduct(authzToken, dataProductModel);
+            System.out.println(productUri);
+
+
+            dataProductModel = client.getDataProduct(authzToken, productUri);
+            System.out.println(dataProductModel.getReplicaLocations().size());
+        } catch (Exception e) {
+            logger.error("Error while connecting with server", e.getMessage());
+            e.printStackTrace();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c5645d3/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/computeresource/LOCALSubmission.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/computeresource/LOCALSubmission.java
b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/computeresource/LOCALSubmission.java
index d1be73d..3171c2e 100644
--- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/computeresource/LOCALSubmission.java
+++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/computeresource/LOCALSubmission.java
@@ -65,8 +65,8 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("LOCALSubmission");
 
   private static final org.apache.thrift.protocol.TField JOB_SUBMISSION_INTERFACE_ID_FIELD_DESC
= new org.apache.thrift.protocol.TField("jobSubmissionInterfaceId", org.apache.thrift.protocol.TType.STRING,
(short)1);
-  private static final org.apache.thrift.protocol.TField SECURITY_PROTOCOL_FIELD_DESC = new
org.apache.thrift.protocol.TField("securityProtocol", org.apache.thrift.protocol.TType.I32,
(short)2);
-  private static final org.apache.thrift.protocol.TField RESOURCE_JOB_MANAGER_FIELD_DESC
= new org.apache.thrift.protocol.TField("resourceJobManager", org.apache.thrift.protocol.TType.STRUCT,
(short)3);
+  private static final org.apache.thrift.protocol.TField RESOURCE_JOB_MANAGER_FIELD_DESC
= new org.apache.thrift.protocol.TField("resourceJobManager", org.apache.thrift.protocol.TType.STRUCT,
(short)2);
+  private static final org.apache.thrift.protocol.TField SECURITY_PROTOCOL_FIELD_DESC = new
org.apache.thrift.protocol.TField("securityProtocol", org.apache.thrift.protocol.TType.I32,
(short)3);
 
   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
new HashMap<Class<? extends IScheme>, SchemeFactory>();
   static {
@@ -75,18 +75,18 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
   }
 
   private String jobSubmissionInterfaceId; // required
-  private org.apache.airavata.model.data.movement.SecurityProtocol securityProtocol; // required
   private ResourceJobManager resourceJobManager; // required
+  private org.apache.airavata.model.data.movement.SecurityProtocol securityProtocol; // optional
 
   /** The set of fields this struct contains, along with convenience methods for finding
and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
     JOB_SUBMISSION_INTERFACE_ID((short)1, "jobSubmissionInterfaceId"),
+    RESOURCE_JOB_MANAGER((short)2, "resourceJobManager"),
     /**
      * 
      * @see org.apache.airavata.model.data.movement.SecurityProtocol
      */
-    SECURITY_PROTOCOL((short)2, "securityProtocol"),
-    RESOURCE_JOB_MANAGER((short)3, "resourceJobManager");
+    SECURITY_PROTOCOL((short)3, "securityProtocol");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -103,10 +103,10 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
       switch(fieldId) {
         case 1: // JOB_SUBMISSION_INTERFACE_ID
           return JOB_SUBMISSION_INTERFACE_ID;
-        case 2: // SECURITY_PROTOCOL
-          return SECURITY_PROTOCOL;
-        case 3: // RESOURCE_JOB_MANAGER
+        case 2: // RESOURCE_JOB_MANAGER
           return RESOURCE_JOB_MANAGER;
+        case 3: // SECURITY_PROTOCOL
+          return SECURITY_PROTOCOL;
         default:
           return null;
       }
@@ -147,15 +147,16 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
   }
 
   // isset id assignments
+  private static final _Fields optionals[] = {_Fields.SECURITY_PROTOCOL};
   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields,
org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
     tmpMap.put(_Fields.JOB_SUBMISSION_INTERFACE_ID, new org.apache.thrift.meta_data.FieldMetaData("jobSubmissionInterfaceId",
org.apache.thrift.TFieldRequirementType.REQUIRED, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.SECURITY_PROTOCOL, new org.apache.thrift.meta_data.FieldMetaData("securityProtocol",
org.apache.thrift.TFieldRequirementType.REQUIRED, 
-        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM,
org.apache.airavata.model.data.movement.SecurityProtocol.class)));
     tmpMap.put(_Fields.RESOURCE_JOB_MANAGER, new org.apache.thrift.meta_data.FieldMetaData("resourceJobManager",
org.apache.thrift.TFieldRequirementType.REQUIRED, 
         new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
ResourceJobManager.class)));
+    tmpMap.put(_Fields.SECURITY_PROTOCOL, new org.apache.thrift.meta_data.FieldMetaData("securityProtocol",
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM,
org.apache.airavata.model.data.movement.SecurityProtocol.class)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(LOCALSubmission.class,
metaDataMap);
   }
@@ -167,12 +168,10 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
 
   public LOCALSubmission(
     String jobSubmissionInterfaceId,
-    org.apache.airavata.model.data.movement.SecurityProtocol securityProtocol,
     ResourceJobManager resourceJobManager)
   {
     this();
     this.jobSubmissionInterfaceId = jobSubmissionInterfaceId;
-    this.securityProtocol = securityProtocol;
     this.resourceJobManager = resourceJobManager;
   }
 
@@ -183,12 +182,12 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
     if (other.isSetJobSubmissionInterfaceId()) {
       this.jobSubmissionInterfaceId = other.jobSubmissionInterfaceId;
     }
-    if (other.isSetSecurityProtocol()) {
-      this.securityProtocol = other.securityProtocol;
-    }
     if (other.isSetResourceJobManager()) {
       this.resourceJobManager = new ResourceJobManager(other.resourceJobManager);
     }
+    if (other.isSetSecurityProtocol()) {
+      this.securityProtocol = other.securityProtocol;
+    }
   }
 
   public LOCALSubmission deepCopy() {
@@ -199,8 +198,8 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
   public void clear() {
     this.jobSubmissionInterfaceId = "DO_NOT_SET_AT_CLIENTS";
 
-    this.securityProtocol = null;
     this.resourceJobManager = null;
+    this.securityProtocol = null;
   }
 
   public String getJobSubmissionInterfaceId() {
@@ -226,6 +225,29 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
     }
   }
 
+  public ResourceJobManager getResourceJobManager() {
+    return this.resourceJobManager;
+  }
+
+  public void setResourceJobManager(ResourceJobManager resourceJobManager) {
+    this.resourceJobManager = resourceJobManager;
+  }
+
+  public void unsetResourceJobManager() {
+    this.resourceJobManager = null;
+  }
+
+  /** Returns true if field resourceJobManager is set (has been assigned a value) and false
otherwise */
+  public boolean isSetResourceJobManager() {
+    return this.resourceJobManager != null;
+  }
+
+  public void setResourceJobManagerIsSet(boolean value) {
+    if (!value) {
+      this.resourceJobManager = null;
+    }
+  }
+
   /**
    * 
    * @see org.apache.airavata.model.data.movement.SecurityProtocol
@@ -257,29 +279,6 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
     }
   }
 
-  public ResourceJobManager getResourceJobManager() {
-    return this.resourceJobManager;
-  }
-
-  public void setResourceJobManager(ResourceJobManager resourceJobManager) {
-    this.resourceJobManager = resourceJobManager;
-  }
-
-  public void unsetResourceJobManager() {
-    this.resourceJobManager = null;
-  }
-
-  /** Returns true if field resourceJobManager is set (has been assigned a value) and false
otherwise */
-  public boolean isSetResourceJobManager() {
-    return this.resourceJobManager != null;
-  }
-
-  public void setResourceJobManagerIsSet(boolean value) {
-    if (!value) {
-      this.resourceJobManager = null;
-    }
-  }
-
   public void setFieldValue(_Fields field, Object value) {
     switch (field) {
     case JOB_SUBMISSION_INTERFACE_ID:
@@ -290,19 +289,19 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
       }
       break;
 
-    case SECURITY_PROTOCOL:
+    case RESOURCE_JOB_MANAGER:
       if (value == null) {
-        unsetSecurityProtocol();
+        unsetResourceJobManager();
       } else {
-        setSecurityProtocol((org.apache.airavata.model.data.movement.SecurityProtocol)value);
+        setResourceJobManager((ResourceJobManager)value);
       }
       break;
 
-    case RESOURCE_JOB_MANAGER:
+    case SECURITY_PROTOCOL:
       if (value == null) {
-        unsetResourceJobManager();
+        unsetSecurityProtocol();
       } else {
-        setResourceJobManager((ResourceJobManager)value);
+        setSecurityProtocol((org.apache.airavata.model.data.movement.SecurityProtocol)value);
       }
       break;
 
@@ -314,12 +313,12 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
     case JOB_SUBMISSION_INTERFACE_ID:
       return getJobSubmissionInterfaceId();
 
-    case SECURITY_PROTOCOL:
-      return getSecurityProtocol();
-
     case RESOURCE_JOB_MANAGER:
       return getResourceJobManager();
 
+    case SECURITY_PROTOCOL:
+      return getSecurityProtocol();
+
     }
     throw new IllegalStateException();
   }
@@ -333,10 +332,10 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
     switch (field) {
     case JOB_SUBMISSION_INTERFACE_ID:
       return isSetJobSubmissionInterfaceId();
-    case SECURITY_PROTOCOL:
-      return isSetSecurityProtocol();
     case RESOURCE_JOB_MANAGER:
       return isSetResourceJobManager();
+    case SECURITY_PROTOCOL:
+      return isSetSecurityProtocol();
     }
     throw new IllegalStateException();
   }
@@ -363,15 +362,6 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
         return false;
     }
 
-    boolean this_present_securityProtocol = true && this.isSetSecurityProtocol();
-    boolean that_present_securityProtocol = true && that.isSetSecurityProtocol();
-    if (this_present_securityProtocol || that_present_securityProtocol) {
-      if (!(this_present_securityProtocol && that_present_securityProtocol))
-        return false;
-      if (!this.securityProtocol.equals(that.securityProtocol))
-        return false;
-    }
-
     boolean this_present_resourceJobManager = true && this.isSetResourceJobManager();
     boolean that_present_resourceJobManager = true && that.isSetResourceJobManager();
     if (this_present_resourceJobManager || that_present_resourceJobManager) {
@@ -381,6 +371,15 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
         return false;
     }
 
+    boolean this_present_securityProtocol = true && this.isSetSecurityProtocol();
+    boolean that_present_securityProtocol = true && that.isSetSecurityProtocol();
+    if (this_present_securityProtocol || that_present_securityProtocol) {
+      if (!(this_present_securityProtocol && that_present_securityProtocol))
+        return false;
+      if (!this.securityProtocol.equals(that.securityProtocol))
+        return false;
+    }
+
     return true;
   }
 
@@ -393,16 +392,16 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
     if (present_jobSubmissionInterfaceId)
       list.add(jobSubmissionInterfaceId);
 
-    boolean present_securityProtocol = true && (isSetSecurityProtocol());
-    list.add(present_securityProtocol);
-    if (present_securityProtocol)
-      list.add(securityProtocol.getValue());
-
     boolean present_resourceJobManager = true && (isSetResourceJobManager());
     list.add(present_resourceJobManager);
     if (present_resourceJobManager)
       list.add(resourceJobManager);
 
+    boolean present_securityProtocol = true && (isSetSecurityProtocol());
+    list.add(present_securityProtocol);
+    if (present_securityProtocol)
+      list.add(securityProtocol.getValue());
+
     return list.hashCode();
   }
 
@@ -424,22 +423,22 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
         return lastComparison;
       }
     }
-    lastComparison = Boolean.valueOf(isSetSecurityProtocol()).compareTo(other.isSetSecurityProtocol());
+    lastComparison = Boolean.valueOf(isSetResourceJobManager()).compareTo(other.isSetResourceJobManager());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetSecurityProtocol()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.securityProtocol, other.securityProtocol);
+    if (isSetResourceJobManager()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.resourceJobManager, other.resourceJobManager);
       if (lastComparison != 0) {
         return lastComparison;
       }
     }
-    lastComparison = Boolean.valueOf(isSetResourceJobManager()).compareTo(other.isSetResourceJobManager());
+    lastComparison = Boolean.valueOf(isSetSecurityProtocol()).compareTo(other.isSetSecurityProtocol());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetResourceJobManager()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.resourceJobManager, other.resourceJobManager);
+    if (isSetSecurityProtocol()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.securityProtocol, other.securityProtocol);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -472,14 +471,6 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
     }
     first = false;
     if (!first) sb.append(", ");
-    sb.append("securityProtocol:");
-    if (this.securityProtocol == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.securityProtocol);
-    }
-    first = false;
-    if (!first) sb.append(", ");
     sb.append("resourceJobManager:");
     if (this.resourceJobManager == null) {
       sb.append("null");
@@ -487,6 +478,16 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
       sb.append(this.resourceJobManager);
     }
     first = false;
+    if (isSetSecurityProtocol()) {
+      if (!first) sb.append(", ");
+      sb.append("securityProtocol:");
+      if (this.securityProtocol == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.securityProtocol);
+      }
+      first = false;
+    }
     sb.append(")");
     return sb.toString();
   }
@@ -497,10 +498,6 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
       throw new org.apache.thrift.protocol.TProtocolException("Required field 'jobSubmissionInterfaceId'
is unset! Struct:" + toString());
     }
 
-    if (!isSetSecurityProtocol()) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'securityProtocol'
is unset! Struct:" + toString());
-    }
-
     if (!isSetResourceJobManager()) {
       throw new org.apache.thrift.protocol.TProtocolException("Required field 'resourceJobManager'
is unset! Struct:" + toString());
     }
@@ -553,15 +550,7 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
-          case 2: // SECURITY_PROTOCOL
-            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
-              struct.securityProtocol = org.apache.airavata.model.data.movement.SecurityProtocol.findByValue(iprot.readI32());
-              struct.setSecurityProtocolIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 3: // RESOURCE_JOB_MANAGER
+          case 2: // RESOURCE_JOB_MANAGER
             if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
               struct.resourceJobManager = new ResourceJobManager();
               struct.resourceJobManager.read(iprot);
@@ -570,6 +559,14 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
+          case 3: // SECURITY_PROTOCOL
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.securityProtocol = org.apache.airavata.model.data.movement.SecurityProtocol.findByValue(iprot.readI32());
+              struct.setSecurityProtocolIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
           default:
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
@@ -588,16 +585,18 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
         oprot.writeString(struct.jobSubmissionInterfaceId);
         oprot.writeFieldEnd();
       }
-      if (struct.securityProtocol != null) {
-        oprot.writeFieldBegin(SECURITY_PROTOCOL_FIELD_DESC);
-        oprot.writeI32(struct.securityProtocol.getValue());
-        oprot.writeFieldEnd();
-      }
       if (struct.resourceJobManager != null) {
         oprot.writeFieldBegin(RESOURCE_JOB_MANAGER_FIELD_DESC);
         struct.resourceJobManager.write(oprot);
         oprot.writeFieldEnd();
       }
+      if (struct.securityProtocol != null) {
+        if (struct.isSetSecurityProtocol()) {
+          oprot.writeFieldBegin(SECURITY_PROTOCOL_FIELD_DESC);
+          oprot.writeI32(struct.securityProtocol.getValue());
+          oprot.writeFieldEnd();
+        }
+      }
       oprot.writeFieldStop();
       oprot.writeStructEnd();
     }
@@ -616,8 +615,15 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
     public void write(org.apache.thrift.protocol.TProtocol prot, LOCALSubmission struct)
throws org.apache.thrift.TException {
       TTupleProtocol oprot = (TTupleProtocol) prot;
       oprot.writeString(struct.jobSubmissionInterfaceId);
-      oprot.writeI32(struct.securityProtocol.getValue());
       struct.resourceJobManager.write(oprot);
+      BitSet optionals = new BitSet();
+      if (struct.isSetSecurityProtocol()) {
+        optionals.set(0);
+      }
+      oprot.writeBitSet(optionals, 1);
+      if (struct.isSetSecurityProtocol()) {
+        oprot.writeI32(struct.securityProtocol.getValue());
+      }
     }
 
     @Override
@@ -625,11 +631,14 @@ public class LOCALSubmission implements org.apache.thrift.TBase<LOCALSubmission,
       TTupleProtocol iprot = (TTupleProtocol) prot;
       struct.jobSubmissionInterfaceId = iprot.readString();
       struct.setJobSubmissionInterfaceIdIsSet(true);
-      struct.securityProtocol = org.apache.airavata.model.data.movement.SecurityProtocol.findByValue(iprot.readI32());
-      struct.setSecurityProtocolIsSet(true);
       struct.resourceJobManager = new ResourceJobManager();
       struct.resourceJobManager.read(iprot);
       struct.setResourceJobManagerIsSet(true);
+      BitSet incoming = iprot.readBitSet(1);
+      if (incoming.get(0)) {
+        struct.securityProtocol = org.apache.airavata.model.data.movement.SecurityProtocol.findByValue(iprot.readI32());
+        struct.setSecurityProtocolIsSet(true);
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c5645d3/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/impl/DataCatalogImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/impl/DataCatalogImpl.java
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/impl/DataCatalogImpl.java
index 31148ab..be0cb40 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/impl/DataCatalogImpl.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/data/catalog/impl/DataCatalogImpl.java
@@ -43,7 +43,18 @@ public class DataCatalogImpl implements DataCatalog {
 
     @Override
     public String registerDataProduct(DataProductModel productModel) throws DataCatalogException
{
-        String productUri = UUID.randomUUID().toString();
+        if(productModel.getOwnerName() == null || productModel.getGatewayId() == null ||
productModel
+                .getLogicalPath() == null || !productModel.getLogicalPath().startsWith("/")){
+            throw new DataCatalogException("owner name, gateway id and logical path should
be non empty and logical path" +
+                    " should start with /");
+        }
+        if(!productModel.getLogicalPath().endsWith(productModel.getProductName())){
+            if(!productModel.getLogicalPath().endsWith("/"))
+                productModel.setLogicalPath(productModel.getLogicalPath()+"/");
+            productModel.setLogicalPath(productModel.getLogicalPath()+productModel.getProductName());
+        }
+        String productUri = DataCatalog.schema + "://" + productModel.getOwnerName() + "@"
+ productModel.getGatewayId()
+                + productModel.getLogicalPath();
         productModel.setProductUri(productUri);
         long currentTime = System.currentTimeMillis();
         productModel.setCreationTime(currentTime);
@@ -260,8 +271,7 @@ public class DataCatalogImpl implements DataCatalog {
     }
 
     @Override
-    public List<DataReplicaLocationModel> getAllReplicaLocations(String
-                                                                             productUri)
throws DataCatalogException {
+    public List<DataReplicaLocationModel> getAllReplicaLocations(String productUri)
throws DataCatalogException {
         EntityManager em = null;
         try {
             em = DataCatalogJPAUtils.getEntityManager();

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c5645d3/modules/registry/registry-core/src/test/java/org/apache/airavata/data/catalog/DataCatalogTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/data/catalog/DataCatalogTest.java
b/modules/registry/registry-core/src/test/java/org/apache/airavata/data/catalog/DataCatalogTest.java
index 9c86c60..287a400 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/data/catalog/DataCatalogTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/data/catalog/DataCatalogTest.java
@@ -21,7 +21,10 @@
 package org.apache.airavata.data.catalog;
 
 import org.apache.airavata.data.catalog.util.Initialize;
-import org.apache.airavata.model.data.product.*;
+import org.apache.airavata.model.data.product.DataProductModel;
+import org.apache.airavata.model.data.product.DataReplicaLocationModel;
+import org.apache.airavata.model.data.product.ReplicaLocationCategory;
+import org.apache.airavata.model.data.product.ReplicaPersistentType;
 import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
 import org.apache.airavata.registry.cpi.DataCatalog;
 import org.apache.airavata.registry.cpi.DataCatalogException;
@@ -33,8 +36,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.HashMap;
-import java.util.List;
-import java.util.UUID;
 
 public class DataCatalogTest {
     private final static Logger logger = LoggerFactory.getLogger(DataCatalogTest.class);
@@ -52,6 +53,9 @@ public class DataCatalogTest {
             datacatalog = RegistryFactory.getDataCatalog();
             dataProductModel = new DataProductModel();
             dataProductModel.setProductName("test-file.txt");
+            dataProductModel.setOwnerName("scnakandala");
+            dataProductModel.setGatewayId("default");
+            dataProductModel.setLogicalPath("/test/test/test");
             HashMap<String, String> resMetadata = new HashMap<>();
             resMetadata.put("name", "name");
             dataProductModel.setProductMetadata(resMetadata);
@@ -76,22 +80,15 @@ public class DataCatalogTest {
     }
 
     @Test
-    public void testPublishDataProduct(){
+    public void testDataCatalog(){
         try {
             String productUri = datacatalog.registerDataProduct(dataProductModel);
             org.junit.Assert.assertNotNull(productUri);
-        } catch (DataCatalogException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-
-    @Test
-    public void testRemoveDataProduct(){
-        try {
-            boolean result = datacatalog.removeDataProduct("234234234");
-            Assert.assertFalse(result);
-            String productUri = datacatalog.registerDataProduct(dataProductModel);
+            dataProductModel = datacatalog.getDataProduct(productUri);
+            Assert.assertNotNull(dataProductModel);
+            boolean result = datacatalog.removeDataProduct(productUri);
+            Assert.assertTrue(result);
+            productUri = datacatalog.registerDataProduct(dataProductModel);
             Assert.assertNotNull(productUri);
             result = datacatalog.removeDataProduct(productUri);
             Assert.assertTrue(result);
@@ -102,121 +99,4 @@ public class DataCatalogTest {
             Assert.fail();
         }
     }
-
-    @Test
-    public void testGetDataProduct(){
-        try {
-            dataProductModel.setDataProductType(DataProductType.COLLECTION);
-            String productUri = datacatalog.registerDataProduct(dataProductModel);
-            Assert.assertNotNull(productUri);
-            DataProductModel persistedCopy = datacatalog.getDataProduct(productUri);
-            Assert.assertNotNull(persistedCopy);
-            dataProductModel.setParentProductUri(productUri);
-            dataProductModel.setDataProductType(DataProductType.FILE);
-            datacatalog.registerDataProduct(dataProductModel);
-            datacatalog.registerDataProduct(dataProductModel);
-            persistedCopy = datacatalog.getDataProduct(productUri);
-            Assert.assertTrue(persistedCopy.getChildProducts().size()==2);
-        } catch (DataCatalogException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-
-    @Test
-    public void testUpdateDataProduct(){
-        try {
-            dataProductModel.setProductUri(UUID.randomUUID().toString());
-            boolean result = datacatalog.updateDataProduct(dataProductModel);
-            Assert.assertFalse(result);
-            datacatalog.registerDataProduct(dataProductModel);
-            dataProductModel.setProductName("updated-name");
-            datacatalog.updateDataProduct(dataProductModel);
-            dataProductModel = datacatalog.getDataProduct(dataProductModel.getProductUri());
-            Assert.assertTrue(dataProductModel.getProductName().equals("updated-name"));
-            Assert.assertTrue(dataProductModel.getProductMetadata().size()==1);
-            dataProductModel.getProductMetadata().put("name2","name2");
-            datacatalog.updateDataProduct(dataProductModel);
-            dataProductModel = datacatalog.getDataProduct(dataProductModel.getProductUri());
-            Assert.assertTrue(dataProductModel.getProductMetadata().size()==2);
-        } catch (DataCatalogException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-
-    @Test
-    public void testPublishReplicaLocation(){
-        try {
-            String productUri = datacatalog.registerDataProduct(dataProductModel);
-            replicaLocationModel.setProductUri(productUri);
-            String replicaId = datacatalog.registerReplicaLocation(replicaLocationModel);
-            Assert.assertNotNull(replicaId);;
-        } catch (DataCatalogException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-
-    @Test
-    public void testRemoveReplicaLocation(){
-        try {
-            String productUri = datacatalog.registerDataProduct(dataProductModel);
-            replicaLocationModel.setProductUri(productUri);
-            String replicaId = datacatalog.registerReplicaLocation(replicaLocationModel);
-            boolean result = datacatalog.removeReplicaLocation(replicaId);
-            Assert.assertTrue(result);
-            result = datacatalog.removeReplicaLocation(replicaLocationModel.getReplicaId());
-            Assert.assertFalse(result);
-        } catch (DataCatalogException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-
-    @Test
-    public void testGetReplicaLocation(){
-        try {
-            String productUri = datacatalog.registerDataProduct(dataProductModel);
-            replicaLocationModel.setProductUri(productUri);
-            String replicaId = datacatalog.registerReplicaLocation(replicaLocationModel);
-            DataReplicaLocationModel persistedCopy = datacatalog.getReplicaLocation(replicaId);
-            Assert.assertNotNull(persistedCopy);
-        } catch (DataCatalogException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-
-    @Test
-    public void testUpdateReplicaLocation(){
-        try {
-            String productUri = datacatalog.registerDataProduct(dataProductModel);
-            replicaLocationModel.setProductUri(productUri);
-            String replicaId = datacatalog.registerReplicaLocation(replicaLocationModel);
-            DataReplicaLocationModel persistedCopy = datacatalog.getReplicaLocation(replicaId);
-            persistedCopy.setReplicaDescription("updated-description");
-            datacatalog.updateReplicaLocation(persistedCopy);
-            persistedCopy = datacatalog.getReplicaLocation(replicaId);
-            Assert.assertTrue(persistedCopy.getReplicaDescription().equals("updated-description"));
-            Assert.assertEquals(persistedCopy.getReplicaLocationCategory(), replicaLocationModel.getReplicaLocationCategory());
-        } catch (DataCatalogException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-
-    @Test
-    public void testGetAllReplicaLocations(){
-        try {
-            String productUri = datacatalog.registerDataProduct(dataProductModel);
-            replicaLocationModel.setProductUri(productUri);
-            datacatalog.registerReplicaLocation(replicaLocationModel);
-            List<DataReplicaLocationModel> replicaLocationModelList = datacatalog.getAllReplicaLocations(productUri);
-            Assert.assertNotNull(replicaLocationModelList.get(0).getReplicaId());
-        } catch (DataCatalogException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c5645d3/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DataCatalog.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DataCatalog.java
b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DataCatalog.java
index 49ae6f5..89b0cc8 100644
--- a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DataCatalog.java
+++ b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DataCatalog.java
@@ -26,6 +26,7 @@ import org.apache.airavata.model.data.product.DataReplicaLocationModel;
 import java.util.List;
 
 public interface DataCatalog {
+    String schema = "airavata-dp";
 
     String registerDataProduct(DataProductModel resource) throws DataCatalogException;
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/6c5645d3/thrift-interface-descriptions/airavata-apis/airavata_api.thrift
----------------------------------------------------------------------
diff --git a/thrift-interface-descriptions/airavata-apis/airavata_api.thrift b/thrift-interface-descriptions/airavata-apis/airavata_api.thrift
index 6e6f38f..3835c8e 100644
--- a/thrift-interface-descriptions/airavata-apis/airavata_api.thrift
+++ b/thrift-interface-descriptions/airavata-apis/airavata_api.thrift
@@ -2959,6 +2959,29 @@ service Airavata {
                   2: airavata_errors.AiravataClientException ace,
                   3: airavata_errors.AiravataSystemException ase,
                   4: airavata_errors.AuthorizationException ae)
+
+
+ /**
+ * API Methods related to data catalog
+ **/
+ string registerDataProduct(1: required security_model.AuthzToken authzToken, 2: required
 data_catalog_models.DataProductModel dataProductModel)
+            throws (1: airavata_errors.InvalidRequestException ire,
+                              2: airavata_errors.AiravataClientException ace,
+                              3: airavata_errors.AiravataSystemException ase,
+                              4: airavata_errors.AuthorizationException ae)
+
+ data_catalog_models.DataProductModel getDataProduct(1: required security_model.AuthzToken
authzToken, 2: required  string dataProductUri)
+             throws (1: airavata_errors.InvalidRequestException ire,
+                               2: airavata_errors.AiravataClientException ace,
+                               3: airavata_errors.AiravataSystemException ase,
+                               4: airavata_errors.AuthorizationException ae)
+
+ string registerReplicaLocation(1: required security_model.AuthzToken authzToken, 2: required
 data_catalog_models.DataReplicaLocationModel replicaLocationModel)
+              throws (1: airavata_errors.InvalidRequestException ire,
+                                2: airavata_errors.AiravataClientException ace,
+                                3: airavata_errors.AiravataSystemException ase,
+                                4: airavata_errors.AuthorizationException ae)
+
  //End of API
  }
 


Mime
View raw message