airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject svn commit: r1485807 - in /airavata/trunk/modules: registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ reg...
Date Thu, 23 May 2013 18:23:06 GMT
Author: chathuri
Date: Thu May 23 18:23:05 2013
New Revision: 1485807

URL: http://svn.apache.org/r1485807
Log:
adding REST service side changes to AIRAVATA-859

Added:
    airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/GFacJobList.java
Modified:
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/GFac_Job_Data.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GFacJobDataResource.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
    airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql
    airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/data-derby.sql
    airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/GFacJob.java
    airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/utils/ResourcePathConstants.java
    airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ProvenanceRegistryResource.java

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/GFac_Job_Data.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/GFac_Job_Data.java?rev=1485807&r1=1485806&r2=1485807&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/GFac_Job_Data.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/GFac_Job_Data.java
Thu May 23 18:23:05 2013
@@ -38,7 +38,7 @@ public class GFac_Job_Data {
     private String local_Job_ID;
     private Timestamp  submitted_time;
     private Timestamp  completed_time;
-    private int status;
+    private String status;
     @Lob
     private String metadata;
 
@@ -90,7 +90,7 @@ public class GFac_Job_Data {
         return completed_time;
     }
 
-    public int getStatus() {
+    public String getStatus() {
         return status;
     }
 
@@ -146,7 +146,7 @@ public class GFac_Job_Data {
         this.completed_time = completed_time;
     }
 
-    public void setStatus(int status) {
+    public void setStatus(String status) {
         this.status = status;
     }
 

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GFacJobDataResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GFacJobDataResource.java?rev=1485807&r1=1485806&r2=1485807&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GFacJobDataResource.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GFacJobDataResource.java
Thu May 23 18:23:05 2013
@@ -46,7 +46,7 @@ public class GFacJobDataResource extends
     private String localJobID;
     private Timestamp submittedTime;
     private Timestamp completedTime;
-    private int status;
+    private String status;
     private String metadata;
 
     public ExperimentDataResource getExperimentDataResource() {
@@ -89,7 +89,7 @@ public class GFacJobDataResource extends
         return completedTime;
     }
 
-    public int getStatus() {
+    public String getStatus() {
         return status;
     }
 
@@ -137,7 +137,7 @@ public class GFacJobDataResource extends
         this.completedTime = completedTime;
     }
 
-    public void setStatus(int status) {
+    public void setStatus(String status) {
         this.status = status;
     }
 

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java?rev=1485807&r1=1485806&r2=1485807&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
Thu May 23 18:23:05 2013
@@ -182,6 +182,14 @@ public class WorkerResource extends Abst
                 WorkflowDataResource workflowDataResource = (WorkflowDataResource)Utils.getResource(ResourceType.WORKFLOW_DATA,
eworkflowData);
                 result= workflowDataResource;
                 break;
+            case GFAC_JOB_DATA:
+                generator = new QueryGenerator(GFAC_JOB_DATA);
+                generator.setParameter(GFacJobDataConstants.LOCAL_JOB_ID, name);
+                q = generator.selectQuery(em);
+                GFac_Job_Data gFacJobData = (GFac_Job_Data)q.getSingleResult();
+                GFacJobDataResource gFacJobDataResource = (GFacJobDataResource)Utils.getResource(ResourceType.GFAC_JOB_DATA,
gFacJobData);
+                result= gFacJobDataResource;
+                break;
 			default:
                 logger.error("Unsupported resource type for worker resource.", new IllegalArgumentException());
                 break;

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql?rev=1485807&r1=1485806&r2=1485807&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-derby.sql
Thu May 23 18:23:05 2013
@@ -208,7 +208,7 @@ create table GFac_Job_Data
        local_Job_ID varchar(255),
        submitted_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
        completed_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-       status INT,
+       status varchar(255),
        metadata CLOB,
        PRIMARY KEY(local_Job_ID),
        FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID),

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql?rev=1485807&r1=1485806&r2=1485807&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data-mysql.sql
Thu May 23 18:23:05 2013
@@ -205,7 +205,7 @@ create table GFac_Job_Data
        local_Job_ID varchar(255),
        submitted_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
        completed_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-       status INT,
+       status varchar(255),
        metadata LONGTEXT,
        PRIMARY KEY(local_Job_ID),
        FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID),

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql?rev=1485807&r1=1485806&r2=1485807&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/test/resources/data-derby.sql
Thu May 23 18:23:05 2013
@@ -207,7 +207,7 @@ create table GFac_Job_Data
        local_Job_ID varchar(255),
        submitted_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
        completed_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-       status INT,
+       status varchar(255),
        metadata CLOB,
        PRIMARY KEY(local_Job_ID),
        FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID),

Modified: airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/data-derby.sql
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/data-derby.sql?rev=1485807&r1=1485806&r2=1485807&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/data-derby.sql
(original)
+++ airavata/trunk/modules/registry/airavata-registry-test/src/test/resources/data-derby.sql
Thu May 23 18:23:05 2013
@@ -207,7 +207,7 @@ create table GFac_Job_Data
        local_Job_ID varchar(255),
        submitted_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
        completed_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
-       status INT,
+       status varchar(255),
        metadata CLOB,
        PRIMARY KEY(local_Job_ID),
        FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID),

Modified: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/GFacJob.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/GFacJob.java?rev=1485807&r1=1485806&r2=1485807&view=diff
==============================================================================
--- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/GFacJob.java
(original)
+++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/GFacJob.java
Thu May 23 18:23:05 2013
@@ -21,8 +21,13 @@
 
 package org.apache.airavata.registry.api.workflow;
 
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
 import java.util.Date;
 
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.FIELD)
 public class GFacJob {
 	public static enum GFacJobStatus{
 		SUBMITTED, //job is submitted, possibly waiting to start executing

Added: airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/GFacJobList.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/GFacJobList.java?rev=1485807&view=auto
==============================================================================
--- airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/GFacJobList.java
(added)
+++ airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/GFacJobList.java
Thu May 23 18:23:05 2013
@@ -0,0 +1,40 @@
+/*
+ *
+ * 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.rest.mappings.resourcemappings;
+
+import org.apache.airavata.registry.api.workflow.GFacJob;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.List;
+
+@XmlRootElement
+public class GFacJobList {
+    List<GFacJob> jobList = new ArrayList<GFacJob>();
+
+    public List<GFacJob> getJobList() {
+        return jobList;
+    }
+
+    public void setJobList(List<GFacJob> jobList) {
+        this.jobList = jobList;
+    }
+}

Modified: airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/utils/ResourcePathConstants.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/utils/ResourcePathConstants.java?rev=1485807&r1=1485806&r2=1485807&view=diff
==============================================================================
--- airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/utils/ResourcePathConstants.java
(original)
+++ airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/utils/ResourcePathConstants.java
Thu May 23 18:23:05 2013
@@ -152,6 +152,17 @@ public class ResourcePathConstants {
         public static final String ADD_WORKFLOW_ERROR = "add/workflow/errors";
         public static final String ADD_NODE_ERROR = "add/node/errors";
         public static final String ADD_GFAC_ERROR = "add/gfac/errors";
+        public static final String ADD_GFAC_JOB = "add/gfac/job";
+        public static final String UPDATE_GFAC_JOB = "update/gfac/job";
+        public static final String UPDATE_GFAC_JOB_STATUS = "update/gfac/jobstatus";
+        public static final String UPDATE_GFAC_JOB_DATA = "update/gfac/jobdata";
+        public static final String UPDATE_GFAC_JOB_SUBMITTED_TIME = "update/gfac/job/submit";
+        public static final String UPDATE_GFAC_JOB_COMPLETED_TIME = "update/gfac/job/complete";
+        public static final String UPDATE_GFAC_JOB_METADATA = "update/gfac/job/metadata";
+        public static final String GET_GFAC_JOB = "get/gfac/job";
+        public static final String GET_GFAC_JOBS_FOR_DESCRIPTORS = "get/gfac/jobs/descriptors";
+        public static final String GET_GFAC_JOBS = "get/gfac/jobs";
+        public static final String GFAC_JOB_EXIST = "gfac/job/exists";
     }
 
     public final class PublishedWFConstants {

Modified: airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ProvenanceRegistryResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ProvenanceRegistryResource.java?rev=1485807&r1=1485806&r2=1485807&view=diff
==============================================================================
--- airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ProvenanceRegistryResource.java
(original)
+++ airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ProvenanceRegistryResource.java
Thu May 23 18:23:05 2013
@@ -1619,4 +1619,258 @@ public class ProvenanceRegistryResource 
         }
     }
 
+    @POST
+    @Path(ResourcePathConstants.ProvenanceResourcePathConstants.ADD_GFAC_JOB)
+    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response addGFacJob(GFacJob job) {
+        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
+        try {
+            airavataRegistry.addGFacJob(job);
+            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+            builder.entity("GFac Job added successfully");
+            return builder.build();
+        } catch (Throwable e) {
+            return WebAppUtil.reportInternalServerError(ResourcePathConstants.ProvenanceResourcePathConstants.ADD_GFAC_JOB,
e);
+        } finally {
+            if (airavataRegistry != null) {
+                RegPoolUtils.releaseRegistry(context, airavataRegistry);
+            }
+        }
+    }
+
+    @POST
+    @Path(ResourcePathConstants.ProvenanceResourcePathConstants.UPDATE_GFAC_JOB)
+    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response updateGFacJob(GFacJob job) {
+        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
+        try {
+            airavataRegistry.updateGFacJob(job);
+            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+            builder.entity("GFac Job updated successfully");
+            return builder.build();
+        } catch (Throwable e) {
+            return WebAppUtil.reportInternalServerError(ResourcePathConstants.ProvenanceResourcePathConstants.UPDATE_GFAC_JOB,
e);
+        } finally {
+            if (airavataRegistry != null) {
+                RegPoolUtils.releaseRegistry(context, airavataRegistry);
+            }
+        }
+    }
+
+    @POST
+    @Path(ResourcePathConstants.ProvenanceResourcePathConstants.UPDATE_GFAC_JOB_STATUS)
+    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response updateGFacJobStatus(@FormParam("gfacJobID") String gfacJobID,
+                                        @FormParam("gfacJobStatus") String gfacJobStatus
) {
+        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
+        try {
+            GFacJob.GFacJobStatus status = GFacJob.GFacJobStatus.valueOf(gfacJobStatus);
+            airavataRegistry.updateGFacJobStatus(gfacJobID, status);
+            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+            builder.entity("GFac Job status updated successfully");
+            return builder.build();
+        } catch (Throwable e) {
+            return WebAppUtil.reportInternalServerError(ResourcePathConstants.ProvenanceResourcePathConstants.UPDATE_GFAC_JOB_STATUS,
e);
+        } finally {
+            if (airavataRegistry != null) {
+                RegPoolUtils.releaseRegistry(context, airavataRegistry);
+            }
+        }
+    }
+
+    @POST
+    @Path(ResourcePathConstants.ProvenanceResourcePathConstants.UPDATE_GFAC_JOB_DATA)
+    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response updateGFacJobData(@FormParam("gfacJobID") String gfacJobID,
+                                      @FormParam("jobdata") String jobdata ) {
+        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
+        try {
+            airavataRegistry.updateGFacJobData(gfacJobID, jobdata);
+            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+            builder.entity("GFac Job data updated successfully");
+            return builder.build();
+        } catch (Throwable e) {
+            return WebAppUtil.reportInternalServerError(ResourcePathConstants.ProvenanceResourcePathConstants.UPDATE_GFAC_JOB_DATA,
e);
+        } finally {
+            if (airavataRegistry != null) {
+                RegPoolUtils.releaseRegistry(context, airavataRegistry);
+            }
+        }
+    }
+
+    @POST
+    @Path(ResourcePathConstants.ProvenanceResourcePathConstants.UPDATE_GFAC_JOB_SUBMITTED_TIME)
+    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response updateGFacJobSubmittedTime(@FormParam("gfacJobID") String gfacJobID,
+                                               @FormParam("submittedDate") String submittedDate
) {
+        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
+        try {
+            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            Date formattedDate = dateFormat.parse(submittedDate);
+            airavataRegistry.updateGFacJobSubmittedTime(gfacJobID, formattedDate);
+            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+            builder.entity("GFac Job data submitted date updated successfully");
+            return builder.build();
+        } catch (Throwable e) {
+            return WebAppUtil.reportInternalServerError(ResourcePathConstants.ProvenanceResourcePathConstants.UPDATE_GFAC_JOB_SUBMITTED_TIME,
e);
+        } finally {
+            if (airavataRegistry != null) {
+                RegPoolUtils.releaseRegistry(context, airavataRegistry);
+            }
+        }
+    }
+
+    @POST
+     @Path(ResourcePathConstants.ProvenanceResourcePathConstants.UPDATE_GFAC_JOB_COMPLETED_TIME)
+     @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+     @Produces(MediaType.TEXT_PLAIN)
+     public Response updateGFacJobCompletedTime(@FormParam("gfacJobID") String gfacJobID,
+                                                @FormParam("completedDate") String completedDate
) {
+        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
+        try {
+            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            Date formattedDate = dateFormat.parse(completedDate);
+            airavataRegistry.updateGFacJobCompletedTime(gfacJobID, formattedDate);
+            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+            builder.entity("GFac Job data completed date updated successfully");
+            return builder.build();
+        } catch (Throwable e) {
+            return WebAppUtil.reportInternalServerError(ResourcePathConstants.ProvenanceResourcePathConstants.UPDATE_GFAC_JOB_COMPLETED_TIME,
e);
+        } finally {
+            if (airavataRegistry != null) {
+                RegPoolUtils.releaseRegistry(context, airavataRegistry);
+            }
+        }
+    }
+
+    @POST
+    @Path(ResourcePathConstants.ProvenanceResourcePathConstants.UPDATE_GFAC_JOB_METADATA)
+    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response updateGFacJobMetadata(@FormParam("gfacJobID") String gfacJobID,
+                                               @FormParam("metadata") String metadata ) {
+        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
+        try {
+            airavataRegistry.updateGFacJobMetadata(gfacJobID, metadata);
+            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+            builder.entity("GFac Job metadata updated successfully");
+            return builder.build();
+        } catch (Throwable e) {
+            return WebAppUtil.reportInternalServerError(ResourcePathConstants.ProvenanceResourcePathConstants.UPDATE_GFAC_JOB_METADATA,
e);
+        } finally {
+            if (airavataRegistry != null) {
+                RegPoolUtils.releaseRegistry(context, airavataRegistry);
+            }
+        }
+    }
+
+    @GET
+    @Path(ResourcePathConstants.ProvenanceResourcePathConstants.GET_GFAC_JOB)
+    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+    public Response getGFacJob(@QueryParam("gfacJobId") String gfacJobId){
+        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
+        try {
+            GFacJob gFacJob = airavataRegistry.getGFacJob(gfacJobId);
+            if (gFacJob != null) {
+                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+                builder.entity(gFacJob);
+                return builder.build();
+            } else {
+                Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
+                return builder.build();
+            }
+        } catch (Throwable e) {
+            return WebAppUtil.reportInternalServerError(ResourcePathConstants.ProvenanceResourcePathConstants.GET_GFAC_JOB,
e);
+        } finally {
+            if (airavataRegistry != null) {
+                RegPoolUtils.releaseRegistry(context, airavataRegistry);
+            }
+        }
+    }
+
+    @GET
+    @Path(ResourcePathConstants.ProvenanceResourcePathConstants.GET_GFAC_JOBS_FOR_DESCRIPTORS)
+    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+    public Response getGFacJobsForDescriptors(@QueryParam("serviceDescriptionId") String
serviceDescriptionId,
+                                              @QueryParam("hostDescriptionId") String hostDescriptionId,
+                                              @QueryParam("applicationDescriptionId") String
applicationDescriptionId){
+        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
+        try {
+            GFacJobList gFacJobList = new GFacJobList();
+            List<GFacJob> gFacJobsForDescriptors = airavataRegistry.getGFacJobsForDescriptors(serviceDescriptionId,
hostDescriptionId, applicationDescriptionId);
+            gFacJobList.setJobList(gFacJobsForDescriptors);
+            if (gFacJobsForDescriptors.size() != 0) {
+                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+                builder.entity(gFacJobList);
+                return builder.build();
+            } else {
+                Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
+                return builder.build();
+            }
+        } catch (Throwable e) {
+            return WebAppUtil.reportInternalServerError(ResourcePathConstants.ProvenanceResourcePathConstants.GET_GFAC_JOBS_FOR_DESCRIPTORS,
e);
+        } finally {
+            if (airavataRegistry != null) {
+                RegPoolUtils.releaseRegistry(context, airavataRegistry);
+            }
+        }
+    }
+
+    @GET
+    @Path(ResourcePathConstants.ProvenanceResourcePathConstants.GET_GFAC_JOBS)
+    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+    public Response getGFacJobs(@QueryParam("experimentId") String experimentID,
+                                @QueryParam("workflowExecutionId") String workflowInstanceID,
+                                @QueryParam("nodeId") String nodeID){
+        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
+        try {
+            GFacJobList gFacJobList = new GFacJobList();
+            List<GFacJob> gFacJobsForDescriptors = airavataRegistry.getGFacJobsForDescriptors(experimentID,
workflowInstanceID, nodeID);
+            gFacJobList.setJobList(gFacJobsForDescriptors);
+            if (gFacJobsForDescriptors.size() != 0) {
+                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+                builder.entity(gFacJobList);
+                return builder.build();
+            } else {
+                Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
+                return builder.build();
+            }
+        } catch (Throwable e) {
+            return WebAppUtil.reportInternalServerError(ResourcePathConstants.ProvenanceResourcePathConstants.GET_GFAC_JOBS_FOR_DESCRIPTORS,
e);
+        } finally {
+            if (airavataRegistry != null) {
+                RegPoolUtils.releaseRegistry(context, airavataRegistry);
+            }
+        }
+    }
+
+    @GET
+    @Path(ResourcePathConstants.ProvenanceResourcePathConstants.GFAC_JOB_EXIST)
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response isGFacJobExists(@QueryParam("gfacJobId") String gfacJobId){
+        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
+        try {
+            boolean gFacJobExists = airavataRegistry.isGFacJobExists(gfacJobId);
+            if (gFacJobExists) {
+                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+                builder.entity("GFac Job exists in the system");
+                return builder.build();
+            } else {
+                Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
+                builder.entity("GFac Job does not exist in the system");
+                return builder.build();
+            }
+        } catch (Throwable e) {
+            return WebAppUtil.reportInternalServerError(ResourcePathConstants.ProvenanceResourcePathConstants.GFAC_JOB_EXIST,
e);
+        } finally {
+            if (airavataRegistry != null) {
+                RegPoolUtils.releaseRegistry(context, airavataRegistry);
+            }
+        }
+    }
 }



Mime
View raw message