You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2012/11/01 22:25:48 UTC

svn commit: r1404771 - in /airavata/sandbox/airavata-registry-rest: pom.xml src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryResource.java

Author: chathuri
Date: Thu Nov  1 21:25:47 2012
New Revision: 1404771

URL: http://svn.apache.org/viewvc?rev=1404771&view=rev
Log: (empty)

Modified:
    airavata/sandbox/airavata-registry-rest/pom.xml
    airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryResource.java

Modified: airavata/sandbox/airavata-registry-rest/pom.xml
URL: http://svn.apache.org/viewvc/airavata/sandbox/airavata-registry-rest/pom.xml?rev=1404771&r1=1404770&r2=1404771&view=diff
==============================================================================
--- airavata/sandbox/airavata-registry-rest/pom.xml (original)
+++ airavata/sandbox/airavata-registry-rest/pom.xml Thu Nov  1 21:25:47 2012
@@ -180,7 +180,7 @@
 		<grizzly.version>2.0.0-M3</grizzly.version>
 		<org.slf4j.version>1.6.1</org.slf4j.version>
 		<log4j.version>1.2.16</log4j.version>
-		<airavata.version>0.5-SNAPSHOT</airavata.version>
+		<airavata.version>0.6-SNAPSHOT</airavata.version>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 		<cargo.version>1.2.1</cargo.version>
 		<!-- if you want a remote debugging on a different a address override on

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=1404771&r1=1404770&r2=1404771&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 Thu Nov  1 21:25:47 2012
@@ -8,6 +8,7 @@ import org.apache.airavata.persistance.r
 import org.apache.airavata.registry.api.*;
 import org.apache.airavata.registry.api.exception.gateway.*;
 import org.apache.airavata.registry.api.exception.worker.*;
+import org.apache.airavata.registry.api.impl.ExperimentDataImpl;
 import org.apache.airavata.registry.api.workflow.*;
 import org.apache.airavata.schemas.gfac.*;
 import org.apache.airavata.services.registry.rest.resourcemappings.*;
@@ -1934,6 +1935,7 @@ public class RegistryResource {
         }
     }
 
+    /*
     @GET
     @Path("search/workflowinstancenodeinput")
     @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@@ -2013,6 +2015,7 @@ public class RegistryResource {
     @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
     public Response getWorkflowInstanceNodeInput(@QueryParam("workflowInstanceId") String workflowInstanceId,
                                                  @QueryParam("nodeType") String nodeType) {
+        // Airavata JPA Registry method returns null at the moment
         airavataRegistry = (AiravataRegistry2) context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
         try {
             List<WorkflowNodeIOData> workflowNodeIODataList = airavataRegistry.getWorkflowInstanceNodeInput(workflowInstanceId, nodeType);
@@ -2079,14 +2082,48 @@ public class RegistryResource {
             return builder.build();
         }
     }
+    */
 
     @GET
-    public Response getExperiment(String s) throws RegistryException {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    @Path("get/experiment")
+    @Produces(MediaType.APPLICATION_XML)
+    public ExperimentDataImpl getExperiment(@QueryParam("experimentId") String experimentId) {
+        airavataRegistry = (AiravataRegistry2) context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
+        try{
+            ExperimentDataImpl experimentData = (ExperimentDataImpl)airavataRegistry.getExperiment(experimentId);
+            return experimentData;
+//            if (experimentData != null){
+//                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+//                builder.entity(experimentData);
+//                return builder.build();
+//            } else {
+//                Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
+//                return builder.build();
+//            }
+        } catch (RegistryException e) {
+//            Response.ResponseBuilder builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+            throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
+        }
     }
 
-    public Response getExperimentIdByUser(String s) throws RegistryException {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    @GET
+    @Path("get/experimentID")
+    public ArrayList<String> getExperimentIdByUser(@QueryParam("username") String username) {
+        airavataRegistry = (AiravataRegistry2) context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
+        try{
+            ArrayList<String> experiments = (ArrayList)airavataRegistry.getExperimentIdByUser(username);
+            return experiments;
+//            if (experiments.size() != 0){
+//                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+//                builder.entity(experiments);
+//                return builder.build();
+//            } else {
+//                Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
+//                return builder.build();
+//            }
+        } catch (RegistryException e) {
+            throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
+        }
     }
 
     public Response getExperimentByUser(String s) throws RegistryException {