airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject svn commit: r1404987 - in /airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest: resourcemappings/ExperimentIDList.java resources/RegistryResource.java utils/DescriptorUtil.java
Date Fri, 02 Nov 2012 15:00:27 GMT
Author: chathuri
Date: Fri Nov  2 15:00:26 2012
New Revision: 1404987

URL: http://svn.apache.org/viewvc?rev=1404987&view=rev
Log:
adding application desc

Added:
    airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/ExperimentIDList.java
Modified:
    airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryResource.java
    airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/utils/DescriptorUtil.java

Added: airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/ExperimentIDList.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/ExperimentIDList.java?rev=1404987&view=auto
==============================================================================
--- airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/ExperimentIDList.java
(added)
+++ airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/ExperimentIDList.java
Fri Nov  2 15:00:26 2012
@@ -0,0 +1,43 @@
+/*
+ *
+ * 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.services.registry.rest.resourcemappings;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.List;
+
+@XmlRootElement(name = "experiments")
+public class ExperimentIDList {
+    @XmlElement(name = "experimentId")
+    List<String> experimentIDList;
+
+    public ExperimentIDList() {
+    }
+
+    public List<String> getExperimentIDList() {
+        return experimentIDList;
+    }
+
+    public void setExperimentIDList(List<String> experimentIDList) {
+        this.experimentIDList = experimentIDList;
+    }
+}

Modified: airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryResource.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryResource.java?rev=1404987&r1=1404986&r2=1404987&view=diff
==============================================================================
--- airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryResource.java
(original)
+++ airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryResource.java
Fri Nov  2 15:00:26 2012
@@ -904,11 +904,15 @@ public class RegistryResource {
                     serviceName = serviceDescriptor.getServiceName();
                 }
                 ServiceDescription serviceDescription = DescriptorUtil.createServiceDescription(serviceDescriptor);
-                airavataRegistry.addServiceDescriptor(serviceDescription);
+                if (!airavataRegistry.isServiceDescriptorExists(serviceName)) {
+                    airavataRegistry.addServiceDescriptor(serviceDescription);
+                }
             } else {
                 serviceName = applicationDescriptor.getName();
             }
             airavataRegistry.addApplicationDescriptor(serviceName, hostdescName, applicationDeploymentDescription);
+
+
             Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
             return builder.build();
         } catch (DescriptorAlreadyExistsException e) {
@@ -2107,12 +2111,16 @@ public class RegistryResource {
     }
 
     @GET
-    @Path("get/experimentID")
-    public ArrayList<String> getExperimentIdByUser(@QueryParam("username") String username)
{
+    @Path("get/experimentID/user")
+    @Produces(MediaType.APPLICATION_XML)
+    public ExperimentIDList getExperimentIdByUser(@QueryParam("username") String username)
{
         airavataRegistry = (AiravataRegistry2) context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
         try{
             ArrayList<String> experiments = (ArrayList)airavataRegistry.getExperimentIdByUser(username);
-            return experiments;
+            ExperimentIDList experimentIDList = new ExperimentIDList();
+            experimentIDList.setExperimentIDList(experiments);
+//            return experiments.toArray(new String[experiments.size()]);
+            return experimentIDList;
 //            if (experiments.size() != 0){
 //                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
 //                builder.entity(experiments);

Modified: airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/utils/DescriptorUtil.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/utils/DescriptorUtil.java?rev=1404987&r1=1404986&r2=1404987&view=diff
==============================================================================
--- airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/utils/DescriptorUtil.java
(original)
+++ airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/utils/DescriptorUtil.java
Fri Nov  2 15:00:26 2012
@@ -4,6 +4,7 @@ import org.apache.airavata.commons.gfac.
 import org.apache.airavata.commons.gfac.type.HostDescription;
 import org.apache.airavata.commons.gfac.type.ServiceDescription;
 import org.apache.airavata.schemas.gfac.*;
+import org.apache.airavata.schemas.gfac.impl.GramApplicationDeploymentTypeImpl;
 import org.apache.airavata.services.registry.rest.resourcemappings.ApplicationDescriptor;
 import org.apache.airavata.services.registry.rest.resourcemappings.HostDescriptor;
 import org.apache.airavata.services.registry.rest.resourcemappings.ServiceDescriptor;
@@ -238,16 +239,25 @@ public class DescriptorUtil {
         //set advanced options according app desc type
         if(applicationDescriptor.getApplicationDescType() != null && !applicationDescriptor.getApplicationDescType().isEmpty()){
             if (applicationDescriptor.getApplicationDescType().equals(ApplicationDescriptorTypes.GRAM_APP_DEP_DESC_TYPE)){
-                GramApplicationDeploymentType applicationDeploymentType = (GramApplicationDeploymentType)applicationDeploymentDescription.getType();
-                applicationDeploymentType.setCpuCount(applicationDescriptor.getCpuCount());
-                applicationDeploymentType.setJobType(JobTypeType.Enum.forString(applicationDescriptor.getJobType()));
-                applicationDeploymentType.setMaxMemory(applicationDescriptor.getMaxMemory());
-                applicationDeploymentType.setMinMemory(applicationDescriptor.getMinMemory());
-                applicationDeploymentType.setMaxWallTime(applicationDescriptor.getMaxWallTime());
-                applicationDeploymentType.setNodeCount(applicationDescriptor.getNodeCount());
-                applicationDeploymentType.setProcessorsPerNode(applicationDescriptor.getProcessorsPerNode());
+                ApplicationDeploymentDescription appDesc = new ApplicationDeploymentDescription(GramApplicationDeploymentType.type);
+                appDesc.getType().setApplicationName(name);
+                appDesc.getType().setExecutableLocation(applicationDescriptor.getExecutablePath());
+                appDesc.getType().setOutputDataDirectory(applicationDescriptor.getWorkingDir());
+                GramApplicationDeploymentType app = (GramApplicationDeploymentType) appDesc.getType();
+                app.setCpuCount(applicationDescriptor.getCpuCount());
+                app.setJobType(JobTypeType.Enum.forString(applicationDescriptor.getJobType()));
+                app.setMaxMemory(applicationDescriptor.getMaxMemory());
+                app.setMinMemory(applicationDescriptor.getMinMemory());
+                app.setMaxWallTime(applicationDescriptor.getMaxWallTime());
+                app.setNodeCount(applicationDescriptor.getNodeCount());
+                app.setProcessorsPerNode(applicationDescriptor.getProcessorsPerNode());
+                return appDesc;
             } else if (applicationDescriptor.getApplicationDescType().equals(ApplicationDescriptorTypes.BATCH_APP_DEP_DESC_TYPE)){
-                BatchApplicationDeploymentDescriptionType applicationDeploymentType = (BatchApplicationDeploymentDescriptionType)applicationDeploymentDescription.getType();
+                ApplicationDeploymentDescription appDesc = new ApplicationDeploymentDescription(BatchApplicationDeploymentDescriptionType.type);
+                appDesc.getType().setApplicationName(name);
+                appDesc.getType().setExecutableLocation(applicationDescriptor.getExecutablePath());
+                appDesc.getType().setOutputDataDirectory(applicationDescriptor.getWorkingDir());
+                BatchApplicationDeploymentDescriptionType applicationDeploymentType = (BatchApplicationDeploymentDescriptionType)
appDesc.getType();
                 applicationDeploymentType.setCpuCount(applicationDescriptor.getCpuCount());
                 applicationDeploymentType.setJobType(JobTypeType.Enum.forString(applicationDescriptor.getJobType()));
                 applicationDeploymentType.setMaxMemory(applicationDescriptor.getMaxMemory());
@@ -255,6 +265,7 @@ public class DescriptorUtil {
                 applicationDeploymentType.setMaxWallTime(applicationDescriptor.getMaxWallTime());
                 applicationDeploymentType.setNodeCount(applicationDescriptor.getNodeCount());
                 applicationDeploymentType.setProcessorsPerNode(applicationDescriptor.getProcessorsPerNode());
+                return appDesc;
             }
         }
         return applicationDeploymentDescription;



Mime
View raw message