airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject svn commit: r1482892 - in /airavata/trunk/modules/rest: client/src/main/java/org/apache/airavata/rest/client/ mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ service/src/main/java/org/apache/airavata/services/registry/rest/re...
Date Wed, 15 May 2013 15:14:15 GMT
Author: chathuri
Date: Wed May 15 15:14:15 2013
New Revision: 1482892

URL: http://svn.apache.org/r1482892
Log:
updating REST client with new API changes

Added:
    airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ExecutionErrorsList.java
    airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ExperimentErrorsList.java
    airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/GFacErrorsList.java
    airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/NodeErrorsList.java
    airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/WorkflowErrorsList.java
Modified:
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProvenanceResourceClient.java
    airavata/trunk/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/ProvenanceRegistryResource.java

Modified: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProvenanceResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProvenanceResourceClient.java?rev=1482892&r1=1482891&r2=1482892&view=diff
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProvenanceResourceClient.java
(original)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProvenanceResourceClient.java
Wed May 15 15:14:15 2013
@@ -34,23 +34,12 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.UriBuilder;
 
+import org.apache.airavata.registry.api.ExecutionErrors;
 import org.apache.airavata.registry.api.PasswordCallback;
 import org.apache.airavata.registry.api.impl.ExperimentDataImpl;
 import org.apache.airavata.registry.api.impl.WorkflowExecutionDataImpl;
-import org.apache.airavata.registry.api.workflow.ExperimentData;
-import org.apache.airavata.registry.api.workflow.NodeExecutionData;
-import org.apache.airavata.registry.api.workflow.NodeExecutionStatus;
-import org.apache.airavata.registry.api.workflow.WorkflowExecution;
-import org.apache.airavata.registry.api.workflow.WorkflowExecutionData;
-import org.apache.airavata.registry.api.workflow.WorkflowExecutionStatus;
-import org.apache.airavata.registry.api.workflow.WorkflowIOData;
-import org.apache.airavata.registry.api.workflow.WorkflowInstanceNode;
-import org.apache.airavata.registry.api.workflow.WorkflowNodeGramData;
-import org.apache.airavata.registry.api.workflow.WorkflowNodeIOData;
-import org.apache.airavata.registry.api.workflow.WorkflowNodeType;
-import org.apache.airavata.rest.mappings.resourcemappings.ExperimentDataList;
-import org.apache.airavata.rest.mappings.resourcemappings.ExperimentIDList;
-import org.apache.airavata.rest.mappings.resourcemappings.WorkflowInstancesList;
+import org.apache.airavata.registry.api.workflow.*;
+import org.apache.airavata.rest.mappings.resourcemappings.*;
 import org.apache.airavata.rest.mappings.utils.ResourcePathConstants;
 import org.apache.airavata.rest.utils.BasicAuthHeaderUtil;
 import org.apache.airavata.rest.utils.ClientConstant;
@@ -1815,6 +1804,466 @@ public class ProvenanceResourceClient {
         }
     }
 
+    public List<ExperimentExecutionError> getExperimentExecutionErrors(String experimentId)
{
+        webResource = getProvenanceRegistryBaseResource().path(
+                ResourcePathConstants.ProvenanceResourcePathConstants.GET_EXPERIMENT_ERRORS);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("experimentId", experimentId);
+        builder = BasicAuthHeaderUtil.getBuilder(
+                webResource, queryParams, userName, null, cookie, gateway);
+
+        ClientResponse response = builder.accept(
+                MediaType.APPLICATION_JSON).get(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status == ClientConstant.HTTP_OK) {
+            if (response.getCookies().size() > 0) {
+                cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
+            }
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            builder = BasicAuthHeaderUtil.getBuilder(
+                    webResource, queryParams, userName, callback.getPassword(userName), null,
gateway);
+            response = builder.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+            status = response.getStatus();
+            if (status == ClientConstant.HTTP_NO_CONTENT) {
+                return null;
+            }
+            if (status != ClientConstant.HTTP_OK) {
+                logger.error(response.getEntity(String.class));
+                throw new RuntimeException("Failed : HTTP error code : "
+                        + status);
+            } else {
+                if (response.getCookies().size() > 0) {
+                    cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
+                }
+            }
+        } else if (status == ClientConstant.HTTP_NO_CONTENT) {
+            return null;
+        } else {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        ExperimentErrorsList experimentErrorsList = response.getEntity(ExperimentErrorsList.class);
+        return experimentErrorsList.getExperimentExecutionErrorList();
+    }
+
+    public List<WorkflowExecutionError> getWorkflowExecutionErrors(String experimentId,
String workflowInstanceId) {
+        webResource = getProvenanceRegistryBaseResource().path(
+                ResourcePathConstants.ProvenanceResourcePathConstants.GET_WORKFLOW_ERRORS);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("experimentId", experimentId);
+        queryParams.add("workflowInstanceId", workflowInstanceId);
+        builder = BasicAuthHeaderUtil.getBuilder(
+                webResource, queryParams, userName, null, cookie, gateway);
+
+        ClientResponse response = builder.accept(
+                MediaType.APPLICATION_JSON).get(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status == ClientConstant.HTTP_OK) {
+            if (response.getCookies().size() > 0) {
+                cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
+            }
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            builder = BasicAuthHeaderUtil.getBuilder(
+                    webResource, queryParams, userName, callback.getPassword(userName), null,
gateway);
+            response = builder.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+            status = response.getStatus();
+            if (status == ClientConstant.HTTP_NO_CONTENT) {
+                return null;
+            }
+            if (status != ClientConstant.HTTP_OK) {
+                logger.error(response.getEntity(String.class));
+                throw new RuntimeException("Failed : HTTP error code : "
+                        + status);
+            } else {
+                if (response.getCookies().size() > 0) {
+                    cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
+                }
+            }
+        } else if (status == ClientConstant.HTTP_NO_CONTENT) {
+            return null;
+        } else {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        WorkflowErrorsList workflowErrorsList = response.getEntity(WorkflowErrorsList.class);
+        return workflowErrorsList.getWorkflowExecutionErrorList();
+    }
+
+    public List<NodeExecutionError> getNodeExecutionErrors(String experimentId,
+                                                           String workflowInstanceId, String
nodeId) {
+        webResource = getProvenanceRegistryBaseResource().path(
+                ResourcePathConstants.ProvenanceResourcePathConstants.GET_NODE_ERRORS);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("experimentId", experimentId);
+        queryParams.add("workflowInstanceId", workflowInstanceId);
+        queryParams.add("nodeId", nodeId);
+        builder = BasicAuthHeaderUtil.getBuilder(
+                webResource, queryParams, userName, null, cookie, gateway);
+
+        ClientResponse response = builder.accept(
+                MediaType.APPLICATION_JSON).get(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status == ClientConstant.HTTP_OK) {
+            if (response.getCookies().size() > 0) {
+                cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
+            }
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            builder = BasicAuthHeaderUtil.getBuilder(
+                    webResource, queryParams, userName, callback.getPassword(userName), null,
gateway);
+            response = builder.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+            status = response.getStatus();
+            if (status == ClientConstant.HTTP_NO_CONTENT) {
+                return null;
+            }
+            if (status != ClientConstant.HTTP_OK) {
+                logger.error(response.getEntity(String.class));
+                throw new RuntimeException("Failed : HTTP error code : "
+                        + status);
+            } else {
+                if (response.getCookies().size() > 0) {
+                    cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
+                }
+            }
+        } else if (status == ClientConstant.HTTP_NO_CONTENT) {
+            return null;
+        } else {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        NodeErrorsList nodeErrorsList = response.getEntity(NodeErrorsList.class);
+        return nodeErrorsList.getNodeExecutionErrorList();
+    }
+
+    public List<GFacJobExecutionError> getGFacJobErrors(String experimentId,
+                                                        String workflowInstanceId,
+                                                        String nodeId,
+                                                        String gfacJobId){
+        webResource = getProvenanceRegistryBaseResource().path(
+                ResourcePathConstants.ProvenanceResourcePathConstants.GET_GFAC_ERRORS);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("experimentId", experimentId);
+        queryParams.add("workflowInstanceId", workflowInstanceId);
+        queryParams.add("nodeId", nodeId);
+        queryParams.add("gfacJobId", gfacJobId);
+        builder = BasicAuthHeaderUtil.getBuilder(
+                webResource, queryParams, userName, null, cookie, gateway);
+
+        ClientResponse response = builder.accept(
+                MediaType.APPLICATION_JSON).get(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status == ClientConstant.HTTP_OK) {
+            if (response.getCookies().size() > 0) {
+                cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
+            }
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            builder = BasicAuthHeaderUtil.getBuilder(
+                    webResource, queryParams, userName, callback.getPassword(userName), null,
gateway);
+            response = builder.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+            status = response.getStatus();
+            if (status == ClientConstant.HTTP_NO_CONTENT) {
+                return null;
+            }
+            if (status != ClientConstant.HTTP_OK) {
+                logger.error(response.getEntity(String.class));
+                throw new RuntimeException("Failed : HTTP error code : "
+                        + status);
+            } else {
+                if (response.getCookies().size() > 0) {
+                    cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
+                }
+            }
+        } else if (status == ClientConstant.HTTP_NO_CONTENT) {
+            return null;
+        } else {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        GFacErrorsList gFacErrorsList = response.getEntity(GFacErrorsList.class);
+        return gFacErrorsList.getgFacJobExecutionErrorList();
+    }
+
+    public List<GFacJobExecutionError> getGFacJobErrors(String gfacJobId){
+        webResource = getProvenanceRegistryBaseResource().path(
+                ResourcePathConstants.ProvenanceResourcePathConstants.GET_ALL_GFAC_ERRORS);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("gfacJobId", gfacJobId);
+        builder = BasicAuthHeaderUtil.getBuilder(
+                webResource, queryParams, userName, null, cookie, gateway);
+
+        ClientResponse response = builder.accept(
+                MediaType.APPLICATION_JSON).get(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status == ClientConstant.HTTP_OK) {
+            if (response.getCookies().size() > 0) {
+                cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
+            }
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            builder = BasicAuthHeaderUtil.getBuilder(
+                    webResource, queryParams, userName, callback.getPassword(userName), null,
gateway);
+            response = builder.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+            status = response.getStatus();
+            if (status == ClientConstant.HTTP_NO_CONTENT) {
+                return null;
+            }
+            if (status != ClientConstant.HTTP_OK) {
+                logger.error(response.getEntity(String.class));
+                throw new RuntimeException("Failed : HTTP error code : "
+                        + status);
+            } else {
+                if (response.getCookies().size() > 0) {
+                    cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
+                }
+            }
+        } else if (status == ClientConstant.HTTP_NO_CONTENT) {
+            return null;
+        } else {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        GFacErrorsList gFacErrorsList = response.getEntity(GFacErrorsList.class);
+        return gFacErrorsList.getgFacJobExecutionErrorList();
+    }
+
+    public List<ExecutionError> getExecutionErrors(String experimentId,
+                                                   String workflowInstanceId,
+                                                   String nodeId,
+                                                   String gfacJobId,
+                                                   ExecutionErrors.Source... filterBy){
+        webResource = getProvenanceRegistryBaseResource().path(
+                ResourcePathConstants.ProvenanceResourcePathConstants.GET_EXECUTION_ERRORS);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("experimentId", experimentId);
+        queryParams.add("workflowInstanceId", workflowInstanceId);
+        queryParams.add("nodeId", nodeId);
+        queryParams.add("gfacJobId", gfacJobId);
+        queryParams.add("sourceFilter", filterBy);
+        builder = BasicAuthHeaderUtil.getBuilder(
+                webResource, queryParams, userName, null, cookie, gateway);
+
+        ClientResponse response = builder.accept(
+                MediaType.APPLICATION_JSON).get(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status == ClientConstant.HTTP_OK) {
+            if (response.getCookies().size() > 0) {
+                cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
+            }
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            builder = BasicAuthHeaderUtil.getBuilder(
+                    webResource, queryParams, userName, callback.getPassword(userName), null,
gateway);
+            response = builder.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+            status = response.getStatus();
+            if (status == ClientConstant.HTTP_NO_CONTENT) {
+                return null;
+            }
+            if (status != ClientConstant.HTTP_OK) {
+                logger.error(response.getEntity(String.class));
+                throw new RuntimeException("Failed : HTTP error code : "
+                        + status);
+            } else {
+                if (response.getCookies().size() > 0) {
+                    cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
+                }
+            }
+        } else if (status == ClientConstant.HTTP_NO_CONTENT) {
+            return null;
+        } else {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        ExecutionErrorsList executionErrorsList = response.getEntity(ExecutionErrorsList.class);
+        return executionErrorsList.getExecutionErrors();
+    }
+
+    public int addExperimentError(ExperimentExecutionError error){
+        webResource = getProvenanceRegistryBaseResource().path(
+                ResourcePathConstants.ProvenanceResourcePathConstants.ADD_EXPERIMENT_ERROR);
+        builder = BasicAuthHeaderUtil.getBuilder(
+                webResource, null, userName, null, cookie, gateway);
+        ClientResponse response = builder.accept(
+                MediaType.TEXT_PLAIN).post(ClientResponse.class, error);
+        int status = response.getStatus();
+
+        if (status == ClientConstant.HTTP_OK) {
+            if (response.getCookies().size() > 0) {
+                cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
+                Integer errorID = response.getEntity(Integer.class);
+                return errorID;
+            }
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            builder = BasicAuthHeaderUtil.getBuilder(
+                    webResource, null, userName, callback.getPassword(userName), null, gateway);
+            response = builder.accept(
+                    MediaType.TEXT_PLAIN).post(ClientResponse.class, error);
+            status = response.getStatus();
+            if (status != ClientConstant.HTTP_OK) {
+                logger.error(response.getEntity(String.class));
+                throw new RuntimeException("Failed : HTTP error code : "
+                        + status);
+            } else {
+                if (response.getCookies().size() > 0) {
+                    cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
+                }
+            }
+        } else {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+        return 0;
+    }
+
+    public int addWorkflowExecutionError(WorkflowExecutionError error){
+        webResource = getProvenanceRegistryBaseResource().path(
+                ResourcePathConstants.ProvenanceResourcePathConstants.ADD_WORKFLOW_ERROR);
+        builder = BasicAuthHeaderUtil.getBuilder(
+                webResource, null, userName, null, cookie, gateway);
+        ClientResponse response = builder.accept(
+                MediaType.TEXT_PLAIN).post(ClientResponse.class, error);
+        int status = response.getStatus();
+
+        if (status == ClientConstant.HTTP_OK) {
+            if (response.getCookies().size() > 0) {
+                cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
+                Integer errorID = response.getEntity(Integer.class);
+                return errorID;
+            }
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            builder = BasicAuthHeaderUtil.getBuilder(
+                    webResource, null, userName, callback.getPassword(userName), null, gateway);
+            response = builder.accept(
+                    MediaType.TEXT_PLAIN).post(ClientResponse.class, error);
+            status = response.getStatus();
+            if (status != ClientConstant.HTTP_OK) {
+                logger.error(response.getEntity(String.class));
+                throw new RuntimeException("Failed : HTTP error code : "
+                        + status);
+            } else {
+                if (response.getCookies().size() > 0) {
+                    cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
+                }
+            }
+        } else {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+        return 0;
+    }
+
+    public int addNodeExecutionError(NodeExecutionError error){
+        webResource = getProvenanceRegistryBaseResource().path(
+                ResourcePathConstants.ProvenanceResourcePathConstants.ADD_NODE_ERROR);
+        builder = BasicAuthHeaderUtil.getBuilder(
+                webResource, null, userName, null, cookie, gateway);
+        ClientResponse response = builder.accept(
+                MediaType.TEXT_PLAIN).post(ClientResponse.class, error);
+        int status = response.getStatus();
+
+        if (status == ClientConstant.HTTP_OK) {
+            if (response.getCookies().size() > 0) {
+                cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
+                Integer errorID = response.getEntity(Integer.class);
+                return errorID;
+            }
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            builder = BasicAuthHeaderUtil.getBuilder(
+                    webResource, null, userName, callback.getPassword(userName), null, gateway);
+            response = builder.accept(
+                    MediaType.TEXT_PLAIN).post(ClientResponse.class, error);
+            status = response.getStatus();
+            if (status != ClientConstant.HTTP_OK) {
+                logger.error(response.getEntity(String.class));
+                throw new RuntimeException("Failed : HTTP error code : "
+                        + status);
+            } else {
+                if (response.getCookies().size() > 0) {
+                    cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
+                }
+            }
+        } else {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+        return 0;
+    }
+
+    public int addGFacJobExecutionError(GFacJobExecutionError error){
+        webResource = getProvenanceRegistryBaseResource().path(
+                ResourcePathConstants.ProvenanceResourcePathConstants.ADD_GFAC_ERROR);
+        builder = BasicAuthHeaderUtil.getBuilder(
+                webResource, null, userName, null, cookie, gateway);
+        ClientResponse response = builder.accept(
+                MediaType.TEXT_PLAIN).post(ClientResponse.class, error);
+        int status = response.getStatus();
+
+        if (status == ClientConstant.HTTP_OK) {
+            if (response.getCookies().size() > 0) {
+                cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
+                Integer errorID = response.getEntity(Integer.class);
+                return errorID;
+            }
+        } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
+            builder = BasicAuthHeaderUtil.getBuilder(
+                    webResource, null, userName, callback.getPassword(userName), null, gateway);
+            response = builder.accept(
+                    MediaType.TEXT_PLAIN).post(ClientResponse.class, error);
+            status = response.getStatus();
+            if (status != ClientConstant.HTTP_OK) {
+                logger.error(response.getEntity(String.class));
+                throw new RuntimeException("Failed : HTTP error code : "
+                        + status);
+            } else {
+                if (response.getCookies().size() > 0) {
+                    cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
+                }
+            }
+        } else {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+        return 0;
+    }
+
     public List<WorkflowNodeIOData> searchWorkflowInstanceNodeInput(String experimentIdRegEx,
                                                                     String workflowNameRegEx,
                                                                     String nodeNameRegEx)
{

Added: airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ExecutionErrorsList.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ExecutionErrorsList.java?rev=1482892&view=auto
==============================================================================
--- airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ExecutionErrorsList.java
(added)
+++ airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ExecutionErrorsList.java
Wed May 15 15:14:15 2013
@@ -0,0 +1,20 @@
+package org.apache.airavata.rest.mappings.resourcemappings;
+
+import org.apache.airavata.registry.api.workflow.ExecutionError;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.List;
+
+@XmlRootElement
+public class ExecutionErrorsList {
+    private List<ExecutionError> executionErrors = new ArrayList<ExecutionError>();
+
+    public List<ExecutionError> getExecutionErrors() {
+        return executionErrors;
+    }
+
+    public void setExecutionErrors(List<ExecutionError> executionErrors) {
+        this.executionErrors = executionErrors;
+    }
+}

Added: airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ExperimentErrorsList.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ExperimentErrorsList.java?rev=1482892&view=auto
==============================================================================
--- airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ExperimentErrorsList.java
(added)
+++ airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/ExperimentErrorsList.java
Wed May 15 15:14:15 2013
@@ -0,0 +1,20 @@
+package org.apache.airavata.rest.mappings.resourcemappings;
+
+import org.apache.airavata.registry.api.workflow.ExperimentExecutionError;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.List;
+
+@XmlRootElement
+public class ExperimentErrorsList {
+    private List<ExperimentExecutionError> experimentExecutionErrorList = new ArrayList<ExperimentExecutionError>();
+
+    public List<ExperimentExecutionError> getExperimentExecutionErrorList() {
+        return experimentExecutionErrorList;
+    }
+
+    public void setExperimentExecutionErrorList(List<ExperimentExecutionError> experimentExecutionErrorList)
{
+        this.experimentExecutionErrorList = experimentExecutionErrorList;
+    }
+}

Added: airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/GFacErrorsList.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/GFacErrorsList.java?rev=1482892&view=auto
==============================================================================
--- airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/GFacErrorsList.java
(added)
+++ airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/GFacErrorsList.java
Wed May 15 15:14:15 2013
@@ -0,0 +1,20 @@
+package org.apache.airavata.rest.mappings.resourcemappings;
+
+import org.apache.airavata.registry.api.workflow.GFacJobExecutionError;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.List;
+
+@XmlRootElement
+public class GFacErrorsList {
+    private List<GFacJobExecutionError> gFacJobExecutionErrorList = new ArrayList<GFacJobExecutionError>();
+
+    public List<GFacJobExecutionError> getgFacJobExecutionErrorList() {
+        return gFacJobExecutionErrorList;
+    }
+
+    public void setgFacJobExecutionErrorList(List<GFacJobExecutionError> gFacJobExecutionErrorList)
{
+        this.gFacJobExecutionErrorList = gFacJobExecutionErrorList;
+    }
+}

Added: airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/NodeErrorsList.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/NodeErrorsList.java?rev=1482892&view=auto
==============================================================================
--- airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/NodeErrorsList.java
(added)
+++ airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/NodeErrorsList.java
Wed May 15 15:14:15 2013
@@ -0,0 +1,20 @@
+package org.apache.airavata.rest.mappings.resourcemappings;
+
+import org.apache.airavata.registry.api.workflow.NodeExecutionError;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.List;
+
+@XmlRootElement
+public class NodeErrorsList {
+    private List<NodeExecutionError> nodeExecutionErrorList = new ArrayList<NodeExecutionError>();
+
+    public List<NodeExecutionError> getNodeExecutionErrorList() {
+        return nodeExecutionErrorList;
+    }
+
+    public void setNodeExecutionErrorList(List<NodeExecutionError> nodeExecutionErrorList)
{
+        this.nodeExecutionErrorList = nodeExecutionErrorList;
+    }
+}

Added: airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/WorkflowErrorsList.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/WorkflowErrorsList.java?rev=1482892&view=auto
==============================================================================
--- airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/WorkflowErrorsList.java
(added)
+++ airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/resourcemappings/WorkflowErrorsList.java
Wed May 15 15:14:15 2013
@@ -0,0 +1,20 @@
+package org.apache.airavata.rest.mappings.resourcemappings;
+
+import org.apache.airavata.registry.api.workflow.WorkflowExecutionError;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.List;
+
+@XmlRootElement
+public class WorkflowErrorsList {
+    private List<WorkflowExecutionError> workflowExecutionErrorList = new ArrayList<WorkflowExecutionError>();
+
+    public List<WorkflowExecutionError> getWorkflowExecutionErrorList() {
+        return workflowExecutionErrorList;
+    }
+
+    public void setWorkflowExecutionErrorList(List<WorkflowExecutionError> workflowExecutionErrorList)
{
+        this.workflowExecutionErrorList = workflowExecutionErrorList;
+    }
+}

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=1482892&r1=1482891&r2=1482892&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
Wed May 15 15:14:15 2013
@@ -26,9 +26,7 @@ import org.apache.airavata.registry.api.
 import org.apache.airavata.registry.api.impl.ExperimentDataImpl;
 import org.apache.airavata.registry.api.impl.WorkflowExecutionDataImpl;
 import org.apache.airavata.registry.api.workflow.*;
-import org.apache.airavata.rest.mappings.resourcemappings.ExperimentDataList;
-import org.apache.airavata.rest.mappings.resourcemappings.ExperimentIDList;
-import org.apache.airavata.rest.mappings.resourcemappings.WorkflowInstancesList;
+import org.apache.airavata.rest.mappings.resourcemappings.*;
 import org.apache.airavata.rest.mappings.utils.ResourcePathConstants;
 import org.apache.airavata.rest.mappings.utils.RegPoolUtils;
 import org.apache.airavata.services.registry.rest.utils.WebAppUtil;
@@ -1353,10 +1351,12 @@ public class ProvenanceRegistryResource 
     public Response getExperimentExecutionErrors(@QueryParam("experimentId") String experimentId)
{
         AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
         try {
+            ExperimentErrorsList experimentErrorsList = new ExperimentErrorsList();
             List<ExperimentExecutionError> experimentExecutionErrors = airavataRegistry.getExperimentExecutionErrors(experimentId);
             if (experimentExecutionErrors.size() != 0) {
                 Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity(experimentExecutionErrors);
+                experimentErrorsList.setExperimentExecutionErrorList(experimentExecutionErrors);
+                builder.entity(experimentErrorsList);
                 return builder.build();
             } else {
                 Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
@@ -1379,10 +1379,12 @@ public class ProvenanceRegistryResource 
                                                @QueryParam("workflowInstanceId") String workflowInstanceId)
{
         AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
         try {
+            WorkflowErrorsList workflowErrorsList = new WorkflowErrorsList();
             List<WorkflowExecutionError> workflowExecutionErrors = airavataRegistry.getWorkflowExecutionErrors(experimentId,
workflowInstanceId);
             if (workflowExecutionErrors.size() != 0) {
                 Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity(workflowExecutionErrors);
+                workflowErrorsList.setWorkflowExecutionErrorList(workflowExecutionErrors);
+                builder.entity(workflowErrorsList);
                 return builder.build();
             } else {
                 Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
@@ -1406,10 +1408,12 @@ public class ProvenanceRegistryResource 
                                            @QueryParam("nodeId") String nodeId ) {
         AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
         try {
+            NodeErrorsList nodeErrorsList = new NodeErrorsList();
             List<NodeExecutionError> nodeExecutionErrors = airavataRegistry.getNodeExecutionErrors(experimentId,
workflowInstanceId, nodeId);
             if (nodeExecutionErrors.size() != 0) {
                 Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity(nodeExecutionErrors);
+                nodeErrorsList.setNodeExecutionErrorList(nodeExecutionErrors);
+                builder.entity(nodeErrorsList);
                 return builder.build();
             } else {
                 Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
@@ -1433,10 +1437,12 @@ public class ProvenanceRegistryResource 
                                            @QueryParam("gfacJobId") String gfacJobId ) {
         AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
         try {
+            GFacErrorsList gFacErrorsList = new GFacErrorsList();
             List<GFacJobExecutionError> gFacJobErrors = airavataRegistry.getGFacJobErrors(experimentId,
workflowInstanceId, nodeId, gfacJobId);
             if (gFacJobErrors.size() != 0) {
                 Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity(gFacJobErrors);
+                gFacErrorsList.setgFacJobExecutionErrorList(gFacJobErrors);
+                builder.entity(gFacErrorsList);
                 return builder.build();
             } else {
                 Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
@@ -1457,10 +1463,12 @@ public class ProvenanceRegistryResource 
     public Response getAllGFacJobErrors(@QueryParam("gfacJobId") String gfacJobId ) {
         AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
         try {
+            GFacErrorsList gFacErrorsList = new GFacErrorsList();
             List<GFacJobExecutionError> gFacJobErrors = airavataRegistry.getGFacJobErrors(gfacJobId);
             if (gFacJobErrors.size() != 0) {
                 Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity(gFacJobErrors);
+                gFacErrorsList.setgFacJobExecutionErrorList(gFacJobErrors);
+                builder.entity(gFacErrorsList);
                 return builder.build();
             } else {
                 Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
@@ -1485,10 +1493,12 @@ public class ProvenanceRegistryResource 
                                        @QueryParam("sourceFilter") ExecutionErrors.Source
sourceFilter) {
         AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
         try {
+            ExecutionErrorsList executionErrorsList = new ExecutionErrorsList();
             List<ExecutionError> executionErrors = airavataRegistry.getExecutionErrors(experimentId,
workflowInstanceId, nodeId, gfacJobId, sourceFilter);
             if (executionErrors.size() != 0) {
                 Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity(executionErrors);
+                executionErrorsList.setExecutionErrors(executionErrors);
+                builder.entity(executionErrorsList);
                 return builder.build();
             } else {
                 Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);



Mime
View raw message