airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject svn commit: r1480461 - in /airavata/trunk/modules/registry: airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ airavata-jpa-registry/...
Date Wed, 08 May 2013 21:07:15 GMT
Author: chathuri
Date: Wed May  8 21:07:14 2013
New Revision: 1480461

URL: http://svn.apache.org/r1480461
Log:
adding node error table

Added:
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Node_Error.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeErrorResource.java
Modified:
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeDataResource.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowDataResource.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
    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

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java?rev=1480461&r1=1480460&r2=1480461&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
Wed May  8 21:07:14 2013
@@ -36,6 +36,7 @@ public enum ResourceType {
     EXPERIMENT_METADATA,
     WORKFLOW_DATA,
     NODE_DATA,
-    GRAM_DATA
+    GRAM_DATA,
+    NODE_ERROR
 
 }

Added: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Node_Error.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Node_Error.java?rev=1480461&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Node_Error.java
(added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Node_Error.java
Wed May  8 21:07:14 2013
@@ -0,0 +1,147 @@
+/*
+ *
+ * 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.persistance.registry.jpa.model;
+
+import javax.persistence.*;
+import java.security.Timestamp;
+
+@Entity
+public class Node_Error {
+    @Id @GeneratedValue
+    private int error_id;
+    private String experiment_ID;
+    private String workflow_instanceID;
+    private String node_id;
+    private String gfacJobID;
+    private String source_type;
+    private Timestamp error_date;
+
+    @ManyToOne()
+    @JoinColumn(name = "experiment_ID")
+    private Experiment_Data experiment_data;
+
+    @ManyToOne()
+    @JoinColumn(name = "workflow_instanceID")
+    private Workflow_Data workflow_Data;
+
+    @Lob
+    private String error_msg;
+    @Lob
+    private String error_des;
+    private String error_code;
+
+    public String getWorkflow_instanceID() {
+        return workflow_instanceID;
+    }
+
+    public String getNode_id() {
+        return node_id;
+    }
+
+    public Workflow_Data getWorkflow_Data() {
+        return workflow_Data;
+    }
+
+    public String getError_msg() {
+        return error_msg;
+    }
+
+    public String getError_des() {
+        return error_des;
+    }
+
+    public String getError_code() {
+        return error_code;
+    }
+
+    public void setWorkflow_instanceID(String workflow_instanceID) {
+        this.workflow_instanceID = workflow_instanceID;
+    }
+
+    public void setNode_id(String node_id) {
+        this.node_id = node_id;
+    }
+
+    public void setWorkflow_Data(Workflow_Data workflow_Data) {
+        this.workflow_Data = workflow_Data;
+    }
+
+    public void setError_msg(String error_msg) {
+        this.error_msg = error_msg;
+    }
+
+    public void setError_des(String error_des) {
+        this.error_des = error_des;
+    }
+
+    public void setError_code(String error_code) {
+        this.error_code = error_code;
+    }
+
+    public int getError_id() {
+        return error_id;
+    }
+
+    public String getExperiment_ID() {
+        return experiment_ID;
+    }
+
+    public String getGfacJobID() {
+        return gfacJobID;
+    }
+
+    public String getSource_type() {
+        return source_type;
+    }
+
+    public Timestamp getError_date() {
+        return error_date;
+    }
+
+    public Experiment_Data getExperiment_Data() {
+        return experiment_data;
+    }
+
+    public void setError_id(int error_id) {
+        this.error_id = error_id;
+    }
+
+    public void setExperiment_ID(String experiment_ID) {
+        this.experiment_ID = experiment_ID;
+    }
+
+    public void setGfacJobID(String gfacJobID) {
+        this.gfacJobID = gfacJobID;
+    }
+
+    public void setSource_type(String source_type) {
+        this.source_type = source_type;
+    }
+
+    public void setError_date(Timestamp error_date) {
+        this.error_date = error_date;
+    }
+
+    public void setExperiment_data(Experiment_Data experiment_data) {
+        this.experiment_data = experiment_data;
+    }
+}

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java?rev=1480461&r1=1480460&r2=1480461&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
Wed May  8 21:07:14 2013
@@ -42,7 +42,8 @@ public abstract class AbstractResource i
     public static final String EXPERIMENT_DATA = "Experiment_Data";
     public static final String WORKFLOW_DATA = "Workflow_Data";
     public static final String EXPERIMENT_METADATA = "Experiment_Metadata";
-    
+    public static final String NODE_ERROR = "Node_Error";
+
     //Gateway Table
     public final class GatewayConstants {
         public static final String GATEWAY_NAME = "gateway_name";
@@ -173,8 +174,19 @@ public abstract class AbstractResource i
         public static final String RSL = "rsl";
         public static final String INVOKED_HOST = "invoked_host";
         public static final String LOCAL_JOB_ID = "local_Job_ID";
+    }
 
-
+    public final class NodeErrorConstants {
+        public static final String ERROR_ID = "error_id";
+        public static final String EXPERIMENT_ID = "experiment_ID";
+        public static final String WORKFLOW_ID = "workflow_instanceID";
+        public static final String NODE_ID = "node_id";
+        public static final String GFAC_JOB_ID = "gfacJobID";
+        public static final String SOURCE_TYPE = "source_type";
+        public static final String ERROR_DATE = "error_date";
+        public static final String ERROR_MSG = "error_msg";
+        public static final String ERROR_DES = "error_des";
+        public static final String ERROR_CODE = "error_code";
     }
 
     protected AbstractResource() {

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java?rev=1480461&r1=1480460&r2=1480461&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentDataResource.java
Wed May  8 21:07:14 2013
@@ -26,6 +26,7 @@ import org.apache.airavata.persistance.r
 import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
 import org.apache.airavata.persistance.registry.jpa.model.Experiment_Data;
 import org.apache.airavata.persistance.registry.jpa.model.Experiment_Metadata;
+import org.apache.airavata.persistance.registry.jpa.model.Node_Error;
 import org.apache.airavata.persistance.registry.jpa.model.Workflow_Data;
 import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
 import org.slf4j.Logger;
@@ -179,6 +180,19 @@ public class ExperimentDataResource exte
                     }
                 }
                 break;
+            case NODE_ERROR:
+                generator = new QueryGenerator(NODE_ERROR);
+                generator.setParameter(NodeErrorConstants.EXPERIMENT_ID, experimentID);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        Node_Error nodeError = (Node_Error)result;
+                        NodeErrorResource nodeErrorResource = (NodeErrorResource)Utils.getResource(ResourceType.NODE_ERROR,
nodeError);
+                        resourceList.add(nodeErrorResource);
+                    }
+                }
+                break;
             default:
                 em.getTransaction().commit();
                 em.close();

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeDataResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeDataResource.java?rev=1480461&r1=1480460&r2=1480461&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeDataResource.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeDataResource.java
Wed May  8 21:07:14 2013
@@ -27,12 +27,16 @@ import org.apache.airavata.persistance.r
 import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
 import org.apache.airavata.persistance.registry.jpa.model.Node_Data;
 import org.apache.airavata.persistance.registry.jpa.model.Node_DataPK;
+import org.apache.airavata.persistance.registry.jpa.model.Node_Error;
 import org.apache.airavata.persistance.registry.jpa.model.Workflow_Data;
+import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.persistence.EntityManager;
+import javax.persistence.Query;
 import java.sql.Timestamp;
+import java.util.ArrayList;
 import java.util.List;
 
 public class NodeDataResource extends AbstractResource{
@@ -127,8 +131,35 @@ public class NodeDataResource extends Ab
     }
 
     public List<Resource> get(ResourceType type) {
-        logger.error("Unsupported resource type for node data resource.", new UnsupportedOperationException());
-        throw new UnsupportedOperationException();
+        List<Resource> resourceList = new ArrayList<Resource>();
+        EntityManager em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        Query q;
+        QueryGenerator generator;
+        List<?> results;
+        switch (type){
+            case  NODE_ERROR:
+                generator = new QueryGenerator(NODE_ERROR);
+                generator.setParameter(NodeErrorConstants.NODE_ID, nodeID);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        Node_Error nodeError = (Node_Error)result;
+                        NodeErrorResource nodeErrorResource = (NodeErrorResource)Utils.getResource(ResourceType.NODE_ERROR,
nodeError);
+                        resourceList.add(nodeErrorResource);
+                    }
+                }
+                break;
+            default:
+                em.getTransaction().commit();
+                em.close();
+                logger.error("Unsupported resource type for node data resource.", new IllegalArgumentException());
+                throw new IllegalArgumentException("Unsupported resource type for node data
resource.");
+        }
+        em.getTransaction().commit();
+        em.close();
+        return resourceList;
     }
 
     public void save() {

Added: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeErrorResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeErrorResource.java?rev=1480461&view=auto
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeErrorResource.java
(added)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeErrorResource.java
Wed May  8 21:07:14 2013
@@ -0,0 +1,155 @@
+package org.apache.airavata.persistance.registry.jpa.resources;
+
+import org.apache.airavata.persistance.registry.jpa.Resource;
+import org.apache.airavata.persistance.registry.jpa.ResourceType;
+import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
+import org.apache.airavata.persistance.registry.jpa.model.Experiment_Data;
+import org.apache.airavata.persistance.registry.jpa.model.Node_Error;
+import org.apache.airavata.persistance.registry.jpa.model.Workflow_Data;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import java.security.Timestamp;
+import java.util.List;
+
+public class NodeErrorResource extends AbstractResource {
+    private final static Logger logger = LoggerFactory.getLogger(NodeErrorResource.class);
+    private ExperimentDataResource experimentDataResource;
+    private WorkflowDataResource workflowDataResource;
+    private String nodeID;
+    private String gfacJobID;
+    private String sourceType;
+    private Timestamp errorTime;
+    private String errorMsg;
+    private String errorDes;
+    private String errorCode;
+    private int errorID;
+
+    @Override
+    public Resource create(ResourceType type) {
+        logger.error("Unsupported resource type for node error resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void remove(ResourceType type, Object name) {
+        logger.error("Unsupported resource type for node error resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Resource get(ResourceType type, Object name) {
+        logger.error("Unsupported resource type for node error resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public List<Resource> get(ResourceType type) {
+        logger.error("Unsupported resource type for node error resource.", new UnsupportedOperationException());
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void save() {
+        EntityManager em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+
+        Node_Error node_error = new Node_Error();
+        node_error.setNode_id(nodeID);
+        Experiment_Data experiment_data = em.find(Experiment_Data.class, experimentDataResource.getExperimentID());
+        node_error.setExperiment_data(experiment_data);
+        Workflow_Data workflow_data = em.find(Workflow_Data.class, workflowDataResource.getWorkflowInstanceID());
+        node_error.setWorkflow_Data(workflow_data);
+        node_error.setError_code(errorCode);
+        node_error.setError_date(errorTime);
+        node_error.setError_des(errorDes);
+        node_error.setError_msg(errorMsg);
+        node_error.setSource_type(sourceType);
+        node_error.setGfacJobID(gfacJobID);
+
+        em.getTransaction().commit();
+        em.close();
+    }
+
+
+    public ExperimentDataResource getExperimentDataResource() {
+        return experimentDataResource;
+    }
+
+    public WorkflowDataResource getWorkflowDataResource() {
+        return workflowDataResource;
+    }
+
+    public String getNodeID() {
+        return nodeID;
+    }
+
+    public String getGfacJobID() {
+        return gfacJobID;
+    }
+
+    public String getSourceType() {
+        return sourceType;
+    }
+
+    public Timestamp getErrorTime() {
+        return errorTime;
+    }
+
+    public String getErrorMsg() {
+        return errorMsg;
+    }
+
+    public String getErrorDes() {
+        return errorDes;
+    }
+
+    public String getErrorCode() {
+        return errorCode;
+    }
+
+    public void setExperimentDataResource(ExperimentDataResource experimentDataResource)
{
+        this.experimentDataResource = experimentDataResource;
+    }
+
+    public void setWorkflowDataResource(WorkflowDataResource workflowDataResource) {
+        this.workflowDataResource = workflowDataResource;
+    }
+
+    public void setNodeID(String nodeID) {
+        this.nodeID = nodeID;
+    }
+
+    public void setGfacJobID(String gfacJobID) {
+        this.gfacJobID = gfacJobID;
+    }
+
+    public void setSourceType(String sourceType) {
+        this.sourceType = sourceType;
+    }
+
+    public void setErrorTime(Timestamp errorTime) {
+        this.errorTime = errorTime;
+    }
+
+    public void setErrorMsg(String errorMsg) {
+        this.errorMsg = errorMsg;
+    }
+
+    public void setErrorDes(String errorDes) {
+        this.errorDes = errorDes;
+    }
+
+    public void setErrorCode(String errorCode) {
+        this.errorCode = errorCode;
+    }
+
+    public int getErrorID() {
+        return errorID;
+    }
+
+    public void setErrorID(int errorID) {
+        this.errorID = errorID;
+    }
+}

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java?rev=1480461&r1=1480460&r2=1480461&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
Wed May  8 21:07:14 2013
@@ -28,22 +28,7 @@ import java.util.Properties;
 import org.apache.airavata.persistance.registry.jpa.JPAConstants;
 import org.apache.airavata.persistance.registry.jpa.Resource;
 import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.model.Application_Descriptor;
-import org.apache.airavata.persistance.registry.jpa.model.Configuration;
-import org.apache.airavata.persistance.registry.jpa.model.Experiment;
-import org.apache.airavata.persistance.registry.jpa.model.Experiment_Data;
-import org.apache.airavata.persistance.registry.jpa.model.Experiment_Metadata;
-import org.apache.airavata.persistance.registry.jpa.model.Gateway;
-import org.apache.airavata.persistance.registry.jpa.model.Gateway_Worker;
-import org.apache.airavata.persistance.registry.jpa.model.Gram_Data;
-import org.apache.airavata.persistance.registry.jpa.model.Host_Descriptor;
-import org.apache.airavata.persistance.registry.jpa.model.Node_Data;
-import org.apache.airavata.persistance.registry.jpa.model.Project;
-import org.apache.airavata.persistance.registry.jpa.model.Published_Workflow;
-import org.apache.airavata.persistance.registry.jpa.model.Service_Descriptor;
-import org.apache.airavata.persistance.registry.jpa.model.User_Workflow;
-import org.apache.airavata.persistance.registry.jpa.model.Users;
-import org.apache.airavata.persistance.registry.jpa.model.Workflow_Data;
+import org.apache.airavata.persistance.registry.jpa.model.*;
 import org.apache.airavata.registry.api.AiravataRegistryConnectionDataProvider;
 import org.apache.airavata.registry.api.AiravataRegistryFactory;
 import org.apache.airavata.registry.api.exception.RegistrySettingsException;
@@ -293,6 +278,13 @@ public class Utils {
                     logger.error("Object should be a Gram Data.", new IllegalArgumentException());
                     throw new IllegalArgumentException("Object should be a Gram Data.");
                 }
+            case NODE_ERROR:
+                if (o instanceof Node_Error){
+                    return createNodeError((Node_Error) o);
+                }else {
+                    logger.error("Object should be a Node Error type.", new IllegalArgumentException());
+                    throw new IllegalArgumentException("Object should be a Node Error.");
+                }
             default:
         }
         return null;
@@ -557,6 +549,23 @@ public class Utils {
         return gramDataResource;
     }
 
+    private static Resource createNodeError (Node_Error o){
+        NodeErrorResource nodeErrorResource = new NodeErrorResource();
+        ExperimentDataResource experimentDataResource = (ExperimentDataResource)createExperimentData(o.getExperiment_Data());
+        nodeErrorResource.setExperimentDataResource(experimentDataResource);
+        WorkflowDataResource workflowDataResource = (WorkflowDataResource)createWorkflowData(o.getWorkflow_Data());
+        nodeErrorResource.setWorkflowDataResource(workflowDataResource);
+        nodeErrorResource.setNodeID(o.getNode_id());
+        nodeErrorResource.setErrorID(o.getError_id());
+        nodeErrorResource.setGfacJobID(o.getGfacJobID());
+        nodeErrorResource.setSourceType(o.getSource_type());
+        nodeErrorResource.setErrorTime(o.getError_date());
+        nodeErrorResource.setErrorMsg(o.getError_msg());
+        nodeErrorResource.setErrorDes(o.getError_des());
+        nodeErrorResource.setErrorCode(o.getError_code());
+        return nodeErrorResource;
+    }
+
 //    public static byte[] getByteArray(String content){
 //        byte[] contentBytes = content.getBytes();
 //        return contentBytes;

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowDataResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowDataResource.java?rev=1480461&r1=1480460&r2=1480461&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowDataResource.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowDataResource.java
Wed May  8 21:07:14 2013
@@ -24,10 +24,7 @@ package org.apache.airavata.persistance.
 import org.apache.airavata.persistance.registry.jpa.Resource;
 import org.apache.airavata.persistance.registry.jpa.ResourceType;
 import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.Experiment_Data;
-import org.apache.airavata.persistance.registry.jpa.model.Gram_Data;
-import org.apache.airavata.persistance.registry.jpa.model.Node_Data;
-import org.apache.airavata.persistance.registry.jpa.model.Workflow_Data;
+import org.apache.airavata.persistance.registry.jpa.model.*;
 import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -42,6 +39,7 @@ public class WorkflowDataResource extend
     private final static Logger logger = LoggerFactory.getLogger(WorkflowDataResource.class);
     public static final String NODE_DATA = "Node_Data";
     public static final String GRAM_DATA = "Gram_Data";
+    public static final String NODE_ERROR = "Node_Error";
     private String experimentID;
     private String workflowInstanceID;
     private String templateName;
@@ -107,6 +105,9 @@ public class WorkflowDataResource extend
                GramDataResource gramDataResource = new GramDataResource();
                gramDataResource.setWorkflowDataResource(this);
                return gramDataResource;
+           case NODE_ERROR:
+               NodeErrorResource nodeErrorResource = new NodeErrorResource();
+               nodeErrorResource.setWorkflowDataResource(this);
            default:
                logger.error("Unsupported resource type for workflow data resource.", new
IllegalArgumentException());
                throw new IllegalArgumentException("Unsupported resource type for workflow
data resource.");
@@ -133,6 +134,12 @@ public class WorkflowDataResource extend
                 q = generator.deleteQuery(em);
                 q.executeUpdate();
                 break;
+            case NODE_ERROR:
+                generator = new QueryGenerator(NODE_ERROR);
+                generator.setParameter(NodeErrorConstants.ERROR_ID, name);
+                q = generator.deleteQuery(em);
+                q.executeUpdate();
+                break;
             default:
                 logger.error("Unsupported resource type for workflow data resource.", new
IllegalArgumentException());
                 break;
@@ -167,6 +174,15 @@ public class WorkflowDataResource extend
                 em.getTransaction().commit();
                 em.close();
                 return gramDataResource;
+            case NODE_ERROR:
+                generator = new QueryGenerator(NODE_ERROR);
+                generator.setParameter(NodeErrorConstants.ERROR_ID, name);
+                q = generator.selectQuery(em);
+                Node_Error node_error = (Node_Error)q.getSingleResult();
+                NodeErrorResource nodeErrorResource = (NodeErrorResource)Utils.getResource(ResourceType.NODE_ERROR,
node_error);
+                em.getTransaction().commit();
+                em.close();
+                return nodeErrorResource;
             default:
                 em.getTransaction().commit();
                 em.close();
@@ -212,6 +228,19 @@ public class WorkflowDataResource extend
                     }
                 }
                 break;
+            case  NODE_ERROR:
+                generator = new QueryGenerator(NODE_ERROR);
+                generator.setParameter(NodeErrorConstants.WORKFLOW_ID, workflowInstanceID);
+                q = generator.selectQuery(em);
+                results = q.getResultList();
+                if (results.size() != 0) {
+                    for (Object result : results) {
+                        Node_Error nodeError = (Node_Error)result;
+                        NodeErrorResource nodeErrorResource = (NodeErrorResource)Utils.getResource(ResourceType.NODE_ERROR,
nodeError);
+                        resourceList.add(nodeErrorResource);
+                    }
+                }
+                break;
             default:
                 em.getTransaction().commit();
                 em.close();

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml?rev=1480461&r1=1480460&r2=1480461&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
Wed May  8 21:07:14 2013
@@ -39,6 +39,7 @@
 		<class>org.apache.airavata.persistance.registry.jpa.model.Workflow_Data</class>
 		<class>org.apache.airavata.persistance.registry.jpa.model.Node_Data</class>
 		<class>org.apache.airavata.persistance.registry.jpa.model.Gram_Data</class>
+		<class>org.apache.airavata.persistance.registry.jpa.model.Node_Error</class>
         <!--properties>
             <property name="openjpa.ConnectionURL"
                       value="jdbc:mysql://localhost:3306/persitant_data" />

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=1480461&r1=1480460&r2=1480461&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
Wed May  8 21:07:14 2013
@@ -218,6 +218,23 @@ CREATE TABLE CREDENTIALS
         PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
 );
 
+CREATE TABLE Node_Error
+(
+       error_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+       experiment_ID varchar(255),
+       workflow_instanceID varchar(255),
+       node_id varchar(255),
+       gfacJobID varchar(255),
+       source_type varchar(255),
+       error_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+       error_msg CLOB,
+       error_des CLOB,
+       error_code varchar(255),
+       PRIMARY KEY(error_id),
+       FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON
DELETE CASCADE,
+       FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID) ON DELETE CASCADE
+);
+
 
 
 

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=1480461&r1=1480460&r2=1480461&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
Wed May  8 21:07:14 2013
@@ -216,4 +216,21 @@ CREATE TABLE CREDENTIALS
         PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
 );
 
+CREATE TABLE Node_Error
+(
+       error_id INT NOT NULL AUTO_INCREMENT,
+       experiment_ID varchar(255),
+       workflow_instanceID varchar(255),
+       node_id varchar(255),
+       gfacJobID varchar(255),
+       source_type varchar(255),
+       error_date TIMESTAMP DEFAULT now() on update now(),
+       error_msg LONGTEXT,
+       error_des LONGTEXT,
+       error_code varchar(255),
+       PRIMARY KEY(error_id),
+       FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON
DELETE CASCADE,
+       FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID) ON DELETE CASCADE
+);
+
 

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=1480461&r1=1480460&r2=1480461&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
Wed May  8 21:07:14 2013
@@ -131,7 +131,7 @@ create table Application_Descriptor
 create table Experiment
 (
           project_name varchar(255),
-	      gateway_name varchar(255),
+	        gateway_name varchar(255),
           user_name varchar(255),
           experiment_ID varchar(255),
           submitted_date TIMESTAMP DEFAULT '0000-00-00 00:00:00',
@@ -218,6 +218,23 @@ CREATE TABLE CREDENTIALS
         PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
 );
 
+CREATE TABLE Node_Error
+(
+       error_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+       experiment_ID varchar(255),
+       workflow_instanceID varchar(255),
+       node_id varchar(255),
+       gfacJobID varchar(255),
+       source_type varchar(255),,
+       error_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,,
+       error_msg CLOB,
+       error_des CLOB,
+       error_code varchar(255),
+       PRIMARY KEY(error_id),
+       FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON
DELETE CASCADE,
+       FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID) ON DELETE CASCADE
+);
+
 
 
 

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=1480461&r1=1480460&r2=1480461&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
Wed May  8 21:07:14 2013
@@ -218,6 +218,23 @@ CREATE TABLE CREDENTIALS
         PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
 );
 
+CREATE TABLE Node_Error
+(
+       error_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+       experiment_ID varchar(255),
+       workflow_instanceID varchar(255),
+       node_id varchar(255),
+       gfacJobID varchar(255),
+       source_type varchar(255),
+       error_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+       error_msg CLOB,
+       error_des CLOB,
+       error_code varchar(255),
+       PRIMARY KEY(error_id),
+       FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON
DELETE CASCADE,
+       FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID) ON DELETE CASCADE
+);
+
 
 
 



Mime
View raw message