Author: chathuri
Date: Thu Nov  8 14:17:39 2012
New Revision: 1407091

URL: http://svn.apache.org/viewvc?rev=1407091&view=rev
Log:
adding missing methods from registry API

Modified:
    
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/DescriptorRegistryResource.java
    
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/ProjectRegistryResource.java
    
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/ProvenanceRegistryResource.java
    
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/utils/ResourcePathConstants.java

Modified: 
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/DescriptorRegistryResource.java
URL: 
http://svn.apache.org/viewvc/airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/DescriptorRegistryResource.java?rev=1407091&r1=1407090&r2=1407091&view=diff
==============================================================================
--- 
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/DescriptorRegistryResource.java
 (original)
+++ 
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/DescriptorRegistryResource.java
 Thu Nov  8 14:17:39 2012
@@ -308,7 +308,7 @@ public class DescriptorRegistryResource 
     @Path(ResourcePathConstants.DecResourcePathConstants.SERVICE_DESC_SAVE)
     @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
     @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-    public Response addJSONServiceDescriptor(ServiceDescriptor service) {
+    public Response addServiceDescriptor(ServiceDescriptor service) {
         airavataRegistry = (AiravataRegistry2) 
context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
         try {
             ServiceDescription serviceDescription = 
DescriptorUtil.createServiceDescription(service);
@@ -543,7 +543,7 @@ public class DescriptorRegistryResource 
     @Path(ResourcePathConstants.DecResourcePathConstants.APP_DESC_UPDATE)
     @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
     @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
-    public Response 
udpateApplicationDescriptorByDescriptors(ApplicationDescriptor 
applicationDescriptor) {
+    public Response udpateApplicationDescriptor(ApplicationDescriptor 
applicationDescriptor) {
         airavataRegistry = (AiravataRegistry2) 
context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
         try {
             String hostdescName = applicationDescriptor.getHostdescName();

Modified: 
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/ProjectRegistryResource.java
URL: 
http://svn.apache.org/viewvc/airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/ProjectRegistryResource.java?rev=1407091&r1=1407090&r2=1407091&view=diff
==============================================================================
--- 
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/ProjectRegistryResource.java
 (original)
+++ 
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/ProjectRegistryResource.java
 Thu Nov  8 14:17:39 2012
@@ -90,7 +90,7 @@ public class ProjectRegistryResource {
     @POST
     
@Path(ResourcePathConstants.ProjectResourcePathConstants.PROJECT_EXIST_CREATE)
     @Produces(MediaType.TEXT_PLAIN)
-    public Response isWorkspaceProjectExists(@FormParam("projectName") String 
projectName,
+    public Response isWorkspaceProjectExistsCreate(@FormParam("projectName") 
String projectName,
                                              @FormParam("createIfNotExists") 
String createIfNotExists) {
         boolean createIfNotExistStatus = false;
         if (createIfNotExists.equals("true")) {

Modified: 
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/ProvenanceRegistryResource.java
URL: 
http://svn.apache.org/viewvc/airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/ProvenanceRegistryResource.java?rev=1407091&r1=1407090&r2=1407091&view=diff
==============================================================================
--- 
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/ProvenanceRegistryResource.java
 (original)
+++ 
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/ProvenanceRegistryResource.java
 Thu Nov  8 14:17:39 2012
@@ -1068,4 +1068,137 @@ public class ProvenanceRegistryResource 
         }
     }
 
+
+    /**
+     * This method wil check whether the experiment name exists
+     * @param experimentName experiment name
+     * @return HTTP response
+     */
+    @GET
+    
@Path(ResourcePathConstants.ProvenanceResourcePathConstants.EXPERIMENTNAME_EXISTS)
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response isExperimentNameExist(@QueryParam("experimentName") String 
experimentName){
+        airavataRegistry = (AiravataRegistry2) 
context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
+        try{
+            boolean experimentNameExist = 
airavataRegistry.isExperimentNameExist(experimentName);
+            if (experimentNameExist){
+                Response.ResponseBuilder builder = 
Response.status(Response.Status.OK);
+                builder.entity("Experiment name exists...");
+                return builder.build();
+            } else {
+                Response.ResponseBuilder builder = 
Response.status(Response.Status.NO_CONTENT);
+                builder.entity("Experiment name does not exists...");
+                return builder.build();
+            }
+
+        } catch (RegistryException e) {
+            Response.ResponseBuilder builder = 
Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+            builder.entity(e.getMessage());
+            return builder.build();
+        }
+
+    }
+
+    /**
+     * This method will return only information regarding to the experiment. 
Node information will
+     * not be retrieved
+     * @param experimentId experiment ID
+     * @return HTTP response
+     */
+    @GET
+    
@Path(ResourcePathConstants.ProvenanceResourcePathConstants.GET_EXPERIMENT_METAINFORMATION)
+    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+    public Response getExperimentMetaInformation(@QueryParam("experimentId") 
String experimentId){
+        airavataRegistry = (AiravataRegistry2) 
context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
+        try{
+            ExperimentDataImpl experimentMetaInformation = 
(ExperimentDataImpl)airavataRegistry.getExperimentMetaInformation(experimentId);
+            if (experimentMetaInformation != null){
+                Response.ResponseBuilder builder = 
Response.status(Response.Status.OK);
+                builder.entity(experimentMetaInformation);
+                return builder.build();
+            } else {
+                Response.ResponseBuilder builder = 
Response.status(Response.Status.NO_CONTENT);
+                builder.entity("Could not retrieve experiment meta 
information...");
+                return builder.build();
+            }
+        } catch (RegistryException e) {
+            Response.ResponseBuilder builder = 
Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+            builder.entity(e.getMessage());
+            return builder.build();
+        }
+    }
+
+    /**
+     * This method will return all meta information for all the experiments
+     * @param user experiment execution user
+     * @return HTTP response
+     */
+    @GET
+    
@Path(ResourcePathConstants.ProvenanceResourcePathConstants.GET_ALL_EXPERIMENT_METAINFORMATION)
+    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+    public Response getAllExperimentMetaInformation(@QueryParam("user") String 
user){
+        airavataRegistry = (AiravataRegistry2) 
context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
+        try{
+            List<ExperimentData> allExperimentMetaInformation = 
airavataRegistry.getAllExperimentMetaInformation(user);
+            ExperimentDataList experimentDataList = new ExperimentDataList();
+            List<ExperimentDataImpl> experimentDatas = new 
ArrayList<ExperimentDataImpl>();
+            for (ExperimentData experimentData : allExperimentMetaInformation){
+                experimentDatas.add((ExperimentDataImpl)experimentData);
+            }
+            experimentDataList.setExperimentDataList(experimentDatas);
+            if (allExperimentMetaInformation.size() != 0){
+                Response.ResponseBuilder builder = 
Response.status(Response.Status.OK);
+                builder.entity(experimentDataList);
+                return builder.build();
+            } else {
+                Response.ResponseBuilder builder = 
Response.status(Response.Status.NO_CONTENT);
+                builder.entity("No experiment data available...");
+                return builder.build();
+            }
+        } catch (RegistryException e) {
+            Response.ResponseBuilder builder = 
Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+            builder.entity(e.getMessage());
+            return builder.build();
+        }
+    }
+
+    /**
+     * This method will search all the experiments which has the name like 
given experiment name for
+     * a given experiment execution user
+     * @param user experiment execution user
+     * @param experimentNameRegex experiment name
+     * @return  HTTP response
+     */
+    @GET
+    
@Path(ResourcePathConstants.ProvenanceResourcePathConstants.SEARCH_EXPERIMENTS)
+    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+    public Response searchExperiments(@QueryParam("user") String user,
+                                      @QueryParam("experimentNameRegex") 
String experimentNameRegex){
+        airavataRegistry = (AiravataRegistry2) 
context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
+        try{
+            List<ExperimentData> experimentDataList = 
airavataRegistry.searchExperiments(user, experimentNameRegex);
+            ExperimentDataList experimentData = new ExperimentDataList();
+            List<ExperimentDataImpl> experimentDatas = new 
ArrayList<ExperimentDataImpl>();
+            for (ExperimentData experimentData1 : experimentDataList){
+                experimentDatas.add((ExperimentDataImpl)experimentData1);
+            }
+            experimentData.setExperimentDataList(experimentDatas);
+            if (experimentDataList.size() != 0){
+                Response.ResponseBuilder builder = 
Response.status(Response.Status.OK);
+                builder.entity(experimentData);
+                return builder.build();
+            } else {
+                Response.ResponseBuilder builder = 
Response.status(Response.Status.NO_CONTENT);
+                builder.entity("No experiment data available...");
+                return builder.build();
+            }
+        } catch (RegistryException e) {
+            Response.ResponseBuilder builder = 
Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+            builder.entity(e.getMessage());
+            return builder.build();
+        }
+
+    }
+
+
 }

Modified: 
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/utils/ResourcePathConstants.java
URL: 
http://svn.apache.org/viewvc/airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/utils/ResourcePathConstants.java?rev=1407091&r1=1407090&r2=1407091&view=diff
==============================================================================
--- 
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/utils/ResourcePathConstants.java
 (original)
+++ 
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/utils/ResourcePathConstants.java
 Thu Nov  8 14:17:39 2012
@@ -134,6 +134,11 @@ public class ResourcePathConstants {
         public static final String ADD_WORKFLOWINSTANCE = 
"add/workflowinstance";
         public static final String UPDATE_WORKFLOWNODETYPE = 
"update/workflownodetype";
         public static final String ADD_WORKFLOWINSTANCENODE = 
"add/workflowinstancenode";
+        public static final String EXPERIMENTNAME_EXISTS = 
"experimentname/exists";
+
+        public static final String GET_EXPERIMENT_METAINFORMATION = 
"get/experiment/metainformation";
+        public static final String GET_ALL_EXPERIMENT_METAINFORMATION = 
"get/all/experiment/metainformation";
+        public static final String SEARCH_EXPERIMENTS = "search/experiments";
     }
 
     public final class PublishedWFConstants {


Reply via email to