airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramin...@apache.org
Subject svn commit: r1402561 - in /airavata/sandbox/airavata-registry-rest: README.txt src/main/java/org/apache/airavata/services/registry/rest/resources/ApplicationRegistration.java
Date Fri, 26 Oct 2012 16:20:14 GMT
Author: raminder
Date: Fri Oct 26 16:20:13 2012
New Revision: 1402561

URL: http://svn.apache.org/viewvc?rev=1402561&view=rev
Log:
service and a JSON sample to create application

Modified:
    airavata/sandbox/airavata-registry-rest/README.txt
    airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/ApplicationRegistration.java

Modified: airavata/sandbox/airavata-registry-rest/README.txt
URL: http://svn.apache.org/viewvc/airavata/sandbox/airavata-registry-rest/README.txt?rev=1402561&r1=1402560&r2=1402561&view=diff
==============================================================================
--- airavata/sandbox/airavata-registry-rest/README.txt (original)
+++ airavata/sandbox/airavata-registry-rest/README.txt Fri Oct 26 16:20:13 2012
@@ -97,7 +97,48 @@ To test
     curl -H "Accept: text/plain" -X POST -d 'experimentId=testWFInstanceID&workflowInstanceId=testWFInstanceID&executionStatus=STARTED&statusUpdateTime=2012-10-23
00:00:00' http://localhost:9080/airavata-services/registry/api/update/workflowinstancestatus/experimentid
     curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/workflowinstancestatus?instanceId=testWFInstanceID'
 
+********* Sample JSON message for Application *****************
 
+{
+   "applicationName":"Tesing",
+   "cpuCount":"12",
+   "hostdescName":"localhost",
+   "maxMemory":"0",
+   "maxWallTime":"0",
+   "minMemory":"0",
+   "nodeCount":"1",
+   "processorsPerNode":"12",
+   "serviceDesc":{
+      "inputParams":[
+         {
+            "dataType":"input",
+            "description":"my input",
+            "name":"myinput",
+            "type":"String"
+         },
+         {
+            "dataType":"input",
+            "description":"my input",
+            "name":"myinput",
+            "type":"String"
+         }
+      ],
+      "outputParams":[
+         {
+            "dataType":"output",
+            "description":"my output",
+            "name":"myoutput",
+            "type":"String"
+         },
+         {
+            "dataType":"output",
+            "description":"my output",
+            "name":"myoutput",
+            "type":"String"
+         }
+      ]
+   }
+}
 
 
 

Modified: airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/ApplicationRegistration.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/ApplicationRegistration.java?rev=1402561&r1=1402560&r2=1402561&view=diff
==============================================================================
--- airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/ApplicationRegistration.java
(original)
+++ airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/ApplicationRegistration.java
Fri Oct 26 16:20:13 2012
@@ -1,5 +1,8 @@
 package org.apache.airavata.services.registry.rest.resources;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import javax.servlet.ServletContext;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
@@ -11,8 +14,11 @@ import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
 import org.apache.airavata.registry.api.AiravataRegistry2;
 import org.apache.airavata.services.registry.rest.resourcemappings.ApplicationDescriptor;
+import org.apache.airavata.services.registry.rest.resourcemappings.ServiceDescriptor;
+import org.apache.airavata.services.registry.rest.resourcemappings.ServiceParameters;
 import org.apache.airavata.services.registry.rest.utils.RestServicesConstants;
 
 @Path("/api/application")
@@ -49,6 +55,45 @@ public class ApplicationRegistration {
         try{
         	ApplicationDescriptor application = new ApplicationDescriptor();
         	application.setApplicationName(applicationName);
+        	ServiceDescriptor descriptor = new ServiceDescriptor();
+
+        	ServiceParameters parameters = new ServiceParameters();
+        	parameters.setName("myinput");
+        	parameters.setDataType("input");
+        	parameters.setDescription("my input");
+        	parameters.setType("String");
+
+        	ServiceParameters parameters1 = new ServiceParameters();
+        	parameters1.setName("myinput");
+        	parameters1.setDataType("input");
+        	parameters1.setDescription("my input");
+        	parameters1.setType("String");
+
+        	List<ServiceParameters> inputlist = new ArrayList<ServiceParameters>();
+        	inputlist.add(parameters);
+        	inputlist.add(parameters1);
+
+        	ServiceParameters parameters2 = new ServiceParameters();
+        	parameters2.setName("myoutput");
+        	parameters2.setDataType("output");
+        	parameters2.setDescription("my output");
+        	parameters2.setType("String");
+
+        	ServiceParameters parameters3 = new ServiceParameters();
+        	parameters3.setName("myoutput");
+        	parameters3.setDataType("output");
+        	parameters3.setDescription("my output");
+        	parameters3.setType("String");
+
+        	List<ServiceParameters> outputlist = new ArrayList<ServiceParameters>();
+        	outputlist.add(parameters2);
+        	outputlist.add(parameters3);
+
+        	descriptor.setInputParams(inputlist);
+        	descriptor.setOutputParams(outputlist);
+
+        	application.setServiceDesc(descriptor);
+        	application.setHostdescName("localhost");
             return application;
         } catch (Exception e) {
         	throw new WebApplicationException(e,Response.Status.INTERNAL_SERVER_ERROR);



Mime
View raw message