airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1381324 [1/2] - in /incubator/airavata/trunk/modules/commons/provenance-registry/src/main: java/org/apache/airavata/persistance/ java/org/apache/airavata/persistance/registry/ java/org/apache/airavata/persistance/registry/jpa/ java/org/apa...
Date Wed, 05 Sep 2012 19:49:16 GMT
Author: lahiru
Date: Wed Sep  5 19:49:15 2012
New Revision: 1381324

URL: http://svn.apache.org/viewvc?rev=1381324&view=rev
Log:
committing the patch provided by chathuri in https://issues.apache.org/jira/browse/AIRAVATA-562.

Added:
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/PersistentRegistry.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Test.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ServiceDescriptorResource.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserWorkflowResource.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/resources/data.sql
Modified:
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/provenance/impl/jpa/AiravataJPAProvenanceRegistry.java
    incubator/airavata/trunk/modules/commons/provenance-registry/src/main/resources/META-INF/persistence.xml

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/PersistentRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/PersistentRegistry.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/PersistentRegistry.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/PersistentRegistry.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,288 @@
+package org.apache.airavata.persistance.registry.jpa;
+
+import org.apache.airavata.commons.gfac.type.ApplicationDeploymentDescription;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+import org.apache.airavata.registry.api.*;
+
+import java.net.URI;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+public class PersistentRegistry extends AiravataRegistry2{
+
+
+    @Override
+    protected void initialize() {
+
+    }
+
+    public Object getConfiguration(String key) {
+        return null;
+    }
+
+    public List<Object> getConfigurationList(String key) {
+        return null;
+    }
+
+    public void setConfiguration(String key, String value, Date expire) {
+
+    }
+
+    public void addConfiguration(String key, String value, Date expire) {
+
+    }
+
+    public void removeAllConfiguration(String key) {
+
+    }
+
+    public void removeConfiguration(String key, String value) {
+
+    }
+
+    public List<URI> getGFacURIs() {
+        return null;
+    }
+
+    public List<URI> getWorkflowInterpreterURIs() {
+        return null;
+    }
+
+    public URI getEventingServiceURI() {
+        return null;
+    }
+
+    public URI getMessageBoxURI() {
+        return null;
+    }
+
+    public void addGFacURI(URI uri) {
+
+    }
+
+    public void addWorkflowInterpreterURI(URI uri) {
+
+    }
+
+    public void setEventingURI(URI uri) {
+
+    }
+
+    public void setMessageBoxURI(URI uri) {
+
+    }
+
+    public void addGFacURI(URI uri, Date expire) {
+
+    }
+
+    public void addWorkflowInterpreterURI(URI uri, Date expire) {
+
+    }
+
+    public void setEventingURI(URI uri, Date expire) {
+
+    }
+
+    public void setMessageBoxURI(URI uri, Date expire) {
+
+    }
+
+    public void removeGFacURI(URI uri) {
+
+    }
+
+    public void removeWorkflowInterpreterURI() {
+
+    }
+
+    public void removeAllGFacURI(URI uri) {
+
+    }
+
+    public void removeAllWorkflowInterpreterURI() {
+
+    }
+
+    public void unsetEventingURI() {
+
+    }
+
+    public void unsetMessageBoxURI() {
+
+    }
+
+    public void addHostDescriptor(HostDescription descriptor) {
+
+    }
+
+    public void updateHostDescriptor(HostDescription descriptor) {
+
+    }
+
+    public HostDescription getHostDescriptor(String hostName) {
+        return null;
+    }
+
+    public void removeHostDescriptor(String hostName) {
+
+    }
+
+    public ResourceMetadata getHostDescriptorMetadata(String hostName) {
+        return null;
+    }
+
+    public void addServiceDescriptor(ServiceDescription descriptor) {
+
+    }
+
+    public void updateServiceDescriptor(ServiceDescription descriptor) {
+
+    }
+
+    public ServiceDescription getServiceDescriptor(String serviceName) {
+        return null;
+    }
+
+    public void removeServiceDescriptor(String serviceName) {
+
+    }
+
+    public ResourceMetadata getServiceDescriptorMetadata(String serviceName) {
+        return null;
+    }
+
+    public void addApplicationDescriptor(ServiceDescription serviceDescription, HostDescription hostDescriptor, ApplicationDeploymentDescription descriptor) {
+
+    }
+
+    public void addApplicationDescriptor(String serviceName, String hostName, ApplicationDeploymentDescription descriptor) {
+
+    }
+
+    public void udpateApplicationDescriptor(ServiceDescription serviceDescription, HostDescription hostDescriptor, ApplicationDeploymentDescription descriptor) {
+
+    }
+
+    public void updateApplicationDescriptor(String serviceName, String hostName, ApplicationDeploymentDescription descriptor) {
+
+    }
+
+    public ApplicationDeploymentDescription getApplicationDescriptors(String serviceName, String hostname) {
+        return null;
+    }
+
+    public Map<String, ApplicationDeploymentDescription> getApplicationDescriptors(String serviceName) {
+        return null;
+    }
+
+    public void removeApplicationDescriptor(String serviceName, String hostName, String applicationName) {
+
+    }
+
+    public ResourceMetadata getApplicationDescriptorMetadata(String serviceName, String hostName, String applicationName) {
+        return null;
+    }
+
+    public void addWorkspaceProject(WorkspaceProject project) {
+
+    }
+
+    public void updateWorkspaceProject(WorkspaceProject project) {
+
+    }
+
+    public void deleteWorkspaceProject(String projectName) {
+
+    }
+
+    public WorkspaceProject getWorkspaceProject(String projectName) {
+        return null;
+    }
+
+    public void createExperiment(String projectName, AiravataExperiment experiment) {
+
+    }
+
+    public void removeExperiment(String experimentId) {
+
+    }
+
+    public List<AiravataExperiment> getExperiments() {
+        return null;
+    }
+
+    public List<AiravataExperiment> getExperiments(String projectName) {
+        return null;
+    }
+
+    public List<AiravataExperiment> getExperiments(Date from, Date to) {
+        return null;
+    }
+
+    public List<AiravataExperiment> getExperiments(String projectName, Date from, Date to) {
+        return null;
+    }
+
+    public void publishWorkflow(String workflowName, String workflowGraphXml) {
+
+    }
+
+    public void publishWorkflow(String workflowName) {
+
+    }
+
+    public String getPublishedWorkflowGraphXML(String workflowName) {
+        return null;
+    }
+
+    public ResourceMetadata getPublishedWorkflowMetadata(String workflowName) {
+        return null;
+    }
+
+    public void removePublishedWorkflow(String workflowName) {
+
+    }
+
+    public String getPublishedWorkflowUser(String workflowName) {
+        return null;
+    }
+
+    public Date getWorkflowPublishedTime(String workflowName) {
+        return null;
+    }
+
+    public void addWorkflow(String workflowName, String workflowGraphXml) {
+
+    }
+
+    public void updateWorkflow(String workflowName, String workflowGraphXml) {
+
+    }
+
+    public String getWorkflowGraphXML(String workflowName) {
+        return null;
+    }
+
+    public ResourceMetadata getWorkflowMetadata(String workflowName) {
+        return null;
+    }
+
+    public Date getWorkflowLastUpdatedTime(String workflowName) {
+        return null;
+    }
+
+    public void removeWorkflow(String workflowName) {
+
+    }
+
+    public void setAiravataRegistry(AiravataRegistry2 registry) {
+
+    }
+
+    public void setAiravataUser(AiravataUser user) {
+
+    }
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,18 @@
+package org.apache.airavata.persistance.registry.jpa;
+
+import java.util.List;
+
+public interface Resource {
+    Resource create(ResourceType type);
+
+    void remove(ResourceType type, Object name);
+
+    Resource get(ResourceType type, Object name);
+
+    List<Resource> get(ResourceType type);
+
+    void save();
+
+    boolean isExists(ResourceType type, Object name);
+
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,13 @@
+package org.apache.airavata.persistance.registry.jpa;
+
+public enum ResourceType {
+    GATEWAY,
+    PROJECT,
+    USER,
+    SERVICE_DESCRIPTOR,
+    PUBLISHED_WORKFLOW,
+    USER_WORKFLOW,
+    HOST_DESCRIPTOR,
+    APPLICATION_DESCRIPTOR,
+    EXPERIMENT
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,15 @@
+package org.apache.airavata.persistance.registry.jpa;
+
+public class ResourceUtils {
+    public static Resource createGateway (){
+        return null;
+    }
+
+    public static boolean isGatewayExist(String gatewayName){
+        return true;
+    }
+
+    public static boolean removeGateway (){
+        return true;
+    }
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Test.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Test.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Test.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Test.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,15 @@
+package org.apache.airavata.persistance.registry.jpa;
+
+import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.resources.ProjectResource;
+
+public class Test {
+    public void test() {
+        GatewayResource gatewayResource = new GatewayResource();
+
+        ProjectResource p = (ProjectResource) gatewayResource.create(ResourceType.PROJECT);
+        p.setName("abc");
+
+        gatewayResource.save();
+    }
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,74 @@
+package org.apache.airavata.persistance.registry.jpa.model;
+
+import javax.persistence.*;
+
+@Entity
+public class Application_Descriptor {
+    @Id
+    private String application_descriptor_ID;
+    private String application_descriptor_xml;
+
+    @ManyToOne
+    @JoinColumn(name="gateway_ID")
+    private Gateway gateway;
+
+    @OneToOne
+    @JoinColumn(name="service_descriptor_ID")
+    private Service_Descriptor service_descriptor;
+
+    @OneToMany
+    @JoinColumn(name="host_descriptor_ID")
+    private Host_Descriptor host_descriptor;
+
+    @ManyToMany
+    @JoinColumn(name="user_ID")
+    private Users user;
+
+    public String getApplication_descriptor_ID() {
+        return application_descriptor_ID;
+    }
+
+    public String getApplication_descriptor_xml() {
+        return application_descriptor_xml;
+    }
+
+    public Gateway getGateway() {
+        return gateway;
+    }
+
+    public Service_Descriptor getService_descriptor() {
+        return service_descriptor;
+    }
+
+    public Host_Descriptor getHost_descriptor() {
+        return host_descriptor;
+    }
+
+    public void setApplication_descriptor_ID(String application_descriptor_ID) {
+        this.application_descriptor_ID = application_descriptor_ID;
+    }
+
+    public void setApplication_descriptor_xml(String application_descriptor_xml) {
+        this.application_descriptor_xml = application_descriptor_xml;
+    }
+
+    public void setGateway(Gateway gateway) {
+        this.gateway = gateway;
+    }
+
+    public void setService_descriptor(Service_Descriptor service_descriptor) {
+        this.service_descriptor = service_descriptor;
+    }
+
+    public void setHost_descriptor(Host_Descriptor host_descriptor) {
+        this.host_descriptor = host_descriptor;
+    }
+
+    public Users getUser() {
+        return user;
+    }
+
+    public void setUser(Users user) {
+        this.user = user;
+    }
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,46 @@
+package org.apache.airavata.persistance.registry.jpa.model;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import java.sql.Date;
+
+@Entity
+public class Configuration {
+    @Id
+    private int config_ID;
+    private String config_key;
+    private String config_val;
+    private Date expire_date;
+
+    public int getConfig_ID() {
+        return config_ID;
+    }
+
+    public void setConfig_ID(int config_ID) {
+        this.config_ID = config_ID;
+    }
+
+    public String getConfig_key() {
+        return config_key;
+    }
+
+    public String getConfig_val() {
+        return config_val;
+    }
+
+    public Date getExpire_date() {
+        return expire_date;
+    }
+
+    public void setConfig_key(String config_key) {
+        this.config_key = config_key;
+    }
+
+    public void setConfig_val(String config_val) {
+        this.config_val = config_val;
+    }
+
+    public void setExpire_date(Date expire_date) {
+        this.expire_date = expire_date;
+    }
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,54 @@
+package org.apache.airavata.persistance.registry.jpa.model;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+import java.sql.Date;
+
+@Entity
+public class Experiment {
+    @Id
+    private String experiment_ID;
+    private Date submitted_date;
+
+    @OneToMany
+    @JoinColumn(name="user_ID")
+    private Users user;
+
+    @OneToMany
+    @JoinColumn(name="project_ID")
+    private Project project;
+
+    public String getExperiment_ID() {
+        return experiment_ID;
+    }
+
+    public Date getSubmitted_date() {
+        return submitted_date;
+    }
+
+    public Users getUser() {
+        return user;
+    }
+
+    public Project getProject() {
+        return project;
+    }
+
+    public void setExperiment_ID(String experiment_ID) {
+        this.experiment_ID = experiment_ID;
+    }
+
+    public void setSubmitted_date(Date submitted_date) {
+        this.submitted_date = submitted_date;
+    }
+
+    public void setUser(Users user) {
+        this.user = user;
+    }
+
+    public void setProject(Project project) {
+        this.project = project;
+    }
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,47 @@
+/*
+ *
+ * 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.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class Gateway {
+    @Id
+    private int gateway_ID;
+    private String gateway_name;
+
+    public int getGateway_ID() {
+        return gateway_ID;
+    }
+
+    public void setGateway_ID(int gateway_ID) {
+        this.gateway_ID = gateway_ID;
+    }
+
+    public String getGateway_name() {
+        return gateway_name;
+    }
+
+    public void setGateway_name(String gateway_name) {
+        this.gateway_name = gateway_name;
+    }
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,35 @@
+package org.apache.airavata.persistance.registry.jpa.model;
+
+import javax.persistence.Entity;
+import javax.persistence.IdClass;
+
+@Entity
+@IdClass(Gateway_Worker_PK.class)
+public class Gateway_Worker {
+
+
+}
+
+class Gateway_Worker_PK {
+    private int gateway_ID;
+    private int user_ID;
+
+    Gateway_Worker_PK() {
+    }
+
+    public int getGateway_ID() {
+        return gateway_ID;
+    }
+
+    public int getUser_ID() {
+        return user_ID;
+    }
+
+    public void setGateway_ID(int gateway_ID) {
+        this.gateway_ID = gateway_ID;
+    }
+
+    public void setUser_ID(int user_ID) {
+        this.user_ID = user_ID;
+    }
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,50 @@
+package org.apache.airavata.persistance.registry.jpa.model;
+
+import javax.persistence.*;
+
+@Entity
+public class Host_Descriptor {
+    @Id
+    private String host_descriptor_ID;
+    private String host_descriptor_xml;
+
+    @ManyToOne
+    @JoinColumn(name="gateway_ID")
+    private Gateway gateway;
+
+    @ManyToMany
+    @JoinColumn(name="user_ID")
+    private Users user;
+
+    public String getHost_descriptor_ID() {
+        return host_descriptor_ID;
+    }
+
+    public String getHost_descriptor_xml() {
+        return host_descriptor_xml;
+    }
+
+    public Gateway getGateway() {
+        return gateway;
+    }
+
+    public void setHost_descriptor_ID(String host_descriptor_ID) {
+        this.host_descriptor_ID = host_descriptor_ID;
+    }
+
+    public void setHost_descriptor_xml(String host_descriptor_xml) {
+        this.host_descriptor_xml = host_descriptor_xml;
+    }
+
+    public void setGateway(Gateway gateway) {
+        this.gateway = gateway;
+    }
+
+    public Users getUser() {
+        return user;
+    }
+
+    public void setUser(Users user) {
+        this.user = user;
+    }
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,51 @@
+package org.apache.airavata.persistance.registry.jpa.model;
+
+import javax.persistence.*;
+
+@Entity
+public class Project {
+    @Id
+    private int project_ID;
+    private String project_name;
+
+    @ManyToOne
+    @JoinColumn(name="gateway_ID")
+    private Gateway gateway;
+
+    @ManyToMany
+    @JoinColumn(name = "user_ID")
+    private Users users;
+
+    public int getProject_ID() {
+        return project_ID;
+    }
+
+    public String getProject_name() {
+        return project_name;
+    }
+
+    public Gateway getGateway() {
+        return gateway;
+    }
+
+    public void setProject_ID(int project_ID) {
+        this.project_ID = project_ID;
+    }
+
+    public void setProject_name(String project_name) {
+        this.project_name = project_name;
+    }
+
+    public void setGateway(Gateway gateway) {
+        this.gateway = gateway;
+    }
+
+    public Users getUsers() {
+        return users;
+    }
+
+    public void setUsers(Users users) {
+        this.users = users;
+    }
+}
+

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,91 @@
+package org.apache.airavata.persistance.registry.jpa.model;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+import java.sql.Date;
+
+@Entity
+@IdClass(Published_Workflow_PK.class)
+public class Published_Workflow {
+
+    @Id
+    private String publish_workflow_name;
+    private String version;
+    private Date published_date;
+    private String workflow_content;
+
+    @Id
+    @OneToMany()
+    @JoinColumn(name = "gateway_ID")
+    private Gateway gateway;
+
+    public String getPublish_workflow_name() {
+        return publish_workflow_name;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public Date getPublished_date() {
+        return published_date;
+    }
+
+    public String getWorkflow_content() {
+        return workflow_content;
+    }
+
+    public Gateway getGateway() {
+        return gateway;
+    }
+
+    public void setPublish_workflow_name(String publish_workflow_name) {
+        this.publish_workflow_name = publish_workflow_name;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public void setPublished_date(Date published_date) {
+        this.published_date = published_date;
+    }
+
+    public void setWorkflow_content(String workflow_content) {
+        this.workflow_content = workflow_content;
+    }
+
+    public void setGateway(Gateway gateway) {
+        this.gateway = gateway;
+    }
+}
+
+class Published_Workflow_PK {
+    private int gateway_ID;
+    private String publish_workflow_name;
+
+    private Published_Workflow_PK() {
+
+    }
+
+    public int getGateway_ID() {
+        return gateway_ID;
+    }
+
+    public String getPublish_workflow_name() {
+        return publish_workflow_name;
+    }
+
+    public void setGateway_ID(int gateway_ID) {
+        this.gateway_ID = gateway_ID;
+    }
+
+    public void setPublish_workflow_name(String publish_workflow_name) {
+        this.publish_workflow_name = publish_workflow_name;
+    }
+
+}
+

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,51 @@
+package org.apache.airavata.persistance.registry.jpa.model;
+
+import javax.persistence.*;
+
+@Entity
+public class Service_Descriptor {
+    @Id
+    private String service_descriptor_ID;
+    private String service_descriptor_xml;
+
+    @ManyToOne
+    @JoinColumn(name="gateway_ID")
+    private Gateway gateway;
+
+    @ManyToMany
+    @JoinColumn(name="user_ID")
+    private Users user;
+
+    public String getService_descriptor_ID() {
+        return service_descriptor_ID;
+    }
+
+    public String getService_descriptor_xml() {
+        return service_descriptor_xml;
+    }
+
+    public Gateway getGateway() {
+        return gateway;
+    }
+
+    public void setService_descriptor_ID(String service_descriptor_ID) {
+        this.service_descriptor_ID = service_descriptor_ID;
+    }
+
+    public void setService_descriptor_xml(String service_descriptor_xml) {
+        this.service_descriptor_xml = service_descriptor_xml;
+    }
+
+    public void setGateway(Gateway gateway) {
+        this.gateway = gateway;
+    }
+
+    public Users getUser() {
+        return user;
+    }
+
+    public void setUser(Users user) {
+        this.user = user;
+    }
+}
+

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,102 @@
+package org.apache.airavata.persistance.registry.jpa.model;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToMany;
+import javax.persistence.OneToMany;
+import java.sql.Date;
+
+@Entity
+@IdClass(User_Workflow_PK.class)
+public class User_Workflow {
+    @Id
+    private String user_workflow_name;
+
+    @Id
+	@OneToMany()
+	@JoinColumn(name = "user_ID")
+    private Users users;
+
+    @Id
+	@ManyToMany()
+	@JoinColumn(name = "project_ID")
+    private Project project;
+
+    private Date last_update_date;
+    private String workflow_content;
+
+    public String getUser_workflow_name() {
+        return user_workflow_name;
+    }
+
+    public Users getUsers() {
+        return users;
+    }
+
+    public Project getProject() {
+        return project;
+    }
+
+    public Date getLast_update_date() {
+        return last_update_date;
+    }
+
+    public String getWorkflow_content() {
+        return workflow_content;
+    }
+
+    public void setUser_workflow_name(String user_workflow_name) {
+        this.user_workflow_name = user_workflow_name;
+    }
+
+    public void setUsers(Users users) {
+        this.users = users;
+    }
+
+    public void setProject(Project project) {
+        this.project = project;
+    }
+
+    public void setLast_update_date(Date last_update_date) {
+        this.last_update_date = last_update_date;
+    }
+
+    public void setWorkflow_content(String workflow_content) {
+        this.workflow_content = workflow_content;
+    }
+}
+
+class User_Workflow_PK{
+    private String user_workflow_name;
+    private int project_ID;
+    private int user_ID;
+
+    User_Workflow_PK() {
+    }
+
+    public String getUser_workflow_name() {
+        return user_workflow_name;
+    }
+
+    public int getProject_ID() {
+        return project_ID;
+    }
+
+    public int getUser_ID() {
+        return user_ID;
+    }
+
+    public void setUser_workflow_name(String user_workflow_name) {
+        this.user_workflow_name = user_workflow_name;
+    }
+
+    public void setProject_ID(int project_ID) {
+        this.project_ID = project_ID;
+    }
+
+    public void setUser_ID(int user_ID) {
+        this.user_ID = user_ID;
+    }
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,60 @@
+package org.apache.airavata.persistance.registry.jpa.model;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToMany;
+
+@Entity
+public class Users {
+
+    @ManyToMany
+    @JoinColumn(name="gateway_ID")
+    private Gateway gateway;
+
+    @Id
+    private int user_ID;
+    private String password;
+    private String user_name;
+    private int gateway_ID;
+
+    public Gateway getGateway() {
+        return gateway;
+    }
+
+    public void setGateway(Gateway gateway) {
+        this.gateway = gateway;
+    }
+
+    public int getUser_ID() {
+        return user_ID;
+    }
+
+    public String getUser_name() {
+        return user_name;
+    }
+
+    public int getGateway_ID() {
+        return gateway_ID;
+    }
+
+    public void setUser_ID(int user_ID) {
+        this.user_ID = user_ID;
+    }
+
+    public void setUser_name(String user_name) {
+        this.user_name = user_name;
+    }
+
+    public void setGateway_ID(int gateway_ID) {
+        this.gateway_ID = gateway_ID;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,29 @@
+package org.apache.airavata.persistance.registry.jpa.resources;
+
+import org.apache.airavata.persistance.registry.jpa.Resource;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+
+public abstract class AbstractResource implements Resource{
+    private static final String PERSISTENCE_UNIT_NAME = "airavata_data";
+	protected EntityManagerFactory factory;
+
+    protected EntityManager em;
+
+    protected AbstractResource() {
+        em = factory.createEntityManager();
+    }
+
+    protected void begin(){
+       em.getTransaction().begin();
+    }
+
+    protected void end(){
+        em.getTransaction().commit();
+		em.close();
+
+    }
+
+
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,108 @@
+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.model.Application_Descriptor;
+import org.apache.airavata.persistance.registry.jpa.model.Gateway;
+import org.apache.airavata.persistance.registry.jpa.model.Host_Descriptor;
+import org.apache.airavata.persistance.registry.jpa.model.Service_Descriptor;
+
+import java.util.List;
+
+public class ApplicationDescriptorResource extends AbstractResource{
+    private String name;
+    private int gatewayID;
+    private int userID;
+    private String content;
+    private String hostDescName;
+    private String serviceDescName;
+
+    public ApplicationDescriptorResource(String name) {
+        this.name = name;
+    }
+
+    public ApplicationDescriptorResource() {
+
+    }
+
+    public int getUserID() {
+        return userID;
+    }
+
+    public void setUserID(int userID) {
+        this.userID = userID;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public int getGatewayID() {
+        return gatewayID;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public String getHostDescName() {
+        return hostDescName;
+    }
+
+    public String getServiceDescName() {
+        return serviceDescName;
+    }
+
+    public void setGatewayID(int gatewayID) {
+        this.gatewayID = gatewayID;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public void setHostDescName(String hostDescName) {
+        this.hostDescName = hostDescName;
+    }
+
+    public void setServiceDescName(String serviceDescName) {
+        this.serviceDescName = serviceDescName;
+    }
+
+    public Resource create(ResourceType type) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void remove(ResourceType type, Object name) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Resource get(ResourceType type, Object name) {
+        throw new UnsupportedOperationException();
+    }
+
+    public List<Resource> get(ResourceType type) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void save() {
+        begin();
+        Application_Descriptor applicationDescriptor = new Application_Descriptor();
+        applicationDescriptor.setApplication_descriptor_ID(name);
+        Gateway gateway = new Gateway();
+        gateway.setGateway_ID(gatewayID);
+        applicationDescriptor.setGateway(gateway);
+        Host_Descriptor hostDescriptor = new Host_Descriptor();
+        hostDescriptor.setHost_descriptor_ID(hostDescName);
+        Service_Descriptor serviceDescriptor = new Service_Descriptor();
+        serviceDescriptor.setService_descriptor_ID(serviceDescName);
+        applicationDescriptor.setApplication_descriptor_xml(content);
+        em.persist(applicationDescriptor);
+        end();
+
+    }
+
+    public boolean isExists(ResourceType type, Object name) {
+        return false;
+    }
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,81 @@
+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.model.Configuration;
+
+import java.sql.Date;
+import java.util.List;
+
+public class ConfigurationResource extends AbstractResource {
+    private int configID = -1;
+    private String configKey;
+    private String configVal;
+    private Date expireDate;
+
+    public ConfigurationResource(int configID) {
+        this.configID = configID;
+    }
+
+    public Resource create(ResourceType type) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void remove(ResourceType type, Object name) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Resource get(ResourceType type, Object name) {
+        throw new UnsupportedOperationException();
+    }
+
+    public List<Resource> get(ResourceType type) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Date getExpireDate() {
+        return expireDate;
+
+    }
+
+    public void setExpireDate(Date expireDate) {
+        this.expireDate = expireDate;
+    }
+
+    public void save() {
+        begin();
+        Configuration configuration = new Configuration();
+        configuration.setConfig_key(configKey);
+        configuration.setConfig_val(configVal);
+        configuration.setExpire_date(expireDate);
+        if (configID != -1) {
+            configuration.setConfig_ID(configID);
+        }
+        em.persist(configuration);
+        end();
+    }
+
+    public boolean isExists(ResourceType type, Object name) {
+        throw new UnsupportedOperationException();
+    }
+
+    public int getConfigID() {
+        return configID;
+    }
+
+    public String getConfigKey() {
+        return configKey;
+    }
+
+    public String getConfigVal() {
+        return configVal;
+    }
+
+    public void setConfigKey(String configKey) {
+        this.configKey = configKey;
+    }
+
+    public void setConfigVal(String configVal) {
+        this.configVal = configVal;
+    }
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,89 @@
+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.model.Experiment;
+import org.apache.airavata.persistance.registry.jpa.model.Project;
+import org.apache.airavata.persistance.registry.jpa.model.Users;
+
+import java.sql.Date;
+import java.util.List;
+
+public class ExperimentResource extends AbstractResource {
+    private int projectID;
+    private int userID;
+    private String expID;
+    private Date submittedDate;
+
+    public ExperimentResource() {
+    }
+
+    public ExperimentResource(String expID) {
+        this.expID = expID;
+    }
+
+    public int getProjectID() {
+        return projectID;
+    }
+
+    public int getUserID() {
+        return userID;
+    }
+
+    public String getExpID() {
+        return expID;
+    }
+
+    public Date getSubmittedDate() {
+        return submittedDate;
+    }
+
+    public void setProjectID(int projectID) {
+        this.projectID = projectID;
+    }
+
+    public void setUserID(int userID) {
+        this.userID = userID;
+    }
+
+    public void setSubmittedDate(Date submittedDate) {
+        this.submittedDate = submittedDate;
+    }
+
+    public Resource create(ResourceType type) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void remove(ResourceType type, Object name) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Resource get(ResourceType type, Object name) {
+        throw new UnsupportedOperationException();
+    }
+
+    public List<Resource> get(ResourceType type) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void save() {
+        begin();
+        Experiment experiment = new Experiment();
+        experiment.setExperiment_ID(expID);
+        Project project = new Project();
+        project.setProject_ID(projectID);
+        experiment.setProject(project);
+        Users user = new Users();
+        user.setUser_ID(userID);
+        experiment.setUser(user);
+        experiment.setSubmitted_date(submittedDate);
+        em.persist(experiment);
+        end();
+
+
+    }
+
+    public boolean isExists(ResourceType type, Object name) {
+        throw new UnsupportedOperationException();
+    }
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,337 @@
+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.model.Application_Descriptor;
+import org.apache.airavata.persistance.registry.jpa.model.Gateway;
+import org.apache.airavata.persistance.registry.jpa.model.Host_Descriptor;
+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.Users;
+
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+
+public class GatewayResource extends AbstractResource {
+    private int gatewayID = -1;
+    private String name;
+
+    public Resource create(ResourceType type) {
+        if (type == ResourceType.PROJECT) {
+            ProjectResource projectResource = new ProjectResource();
+            projectResource.setGatewayID(gatewayID);
+            return projectResource;
+        } else if (type == ResourceType.USER) {
+            UserResource userResource = new UserResource();
+            userResource.setGatewayID(gatewayID);
+            return userResource;
+        } else if (type == ResourceType.PUBLISHED_WORKFLOW) {
+            PublishWorkflowResource publishWorkflowResource = new PublishWorkflowResource();
+            publishWorkflowResource.setGatewayID(gatewayID);
+            return publishWorkflowResource;
+        } else if (type == ResourceType.HOST_DESCRIPTOR) {
+            HostDescriptorResource hostDescriptorResource = new HostDescriptorResource();
+            hostDescriptorResource.setGatewayID(gatewayID);
+            return hostDescriptorResource;
+        } else if (type == ResourceType.SERVICE_DESCRIPTOR) {
+            ServiceDescriptorResource serviceDescriptorResource = new ServiceDescriptorResource();
+            serviceDescriptorResource.setGatewayID(gatewayID);
+            return serviceDescriptorResource;
+        } else if (type == ResourceType.APPLICATION_DESCRIPTOR) {
+            ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource();
+            applicationDescriptorResource.setGatewayID(gatewayID);
+            return applicationDescriptorResource;
+        } else {
+            return null;
+        }
+    }
+
+    public void remove(ResourceType type, Object name) {
+        begin();
+        if (type == ResourceType.PROJECT) {
+            Query q = em.createQuery("Delete p FROM Project p WHERE p.project_name = :proj_name and p.gateway_ID = :gate_ID");
+            q.setParameter("proj_name", name);
+            q.setParameter("gate_ID", gatewayID);
+            q.executeUpdate();
+        } else if (type == ResourceType.USER) {
+            Query q = em.createQuery("Delete p FROM Users p WHERE p.user_name = :usr_name and p.gateway_ID = :gate_ID");
+            q.setParameter("usr_name", name);
+            q.setParameter("gate_ID", gatewayID);
+            q.executeUpdate();
+        } else if (type == ResourceType.PUBLISHED_WORKFLOW) {
+            Query q = em.createQuery("Delete p FROM Published_Workflow p WHERE p.publish_workflow_name = :pub_workflow_id and p.gateway_ID = :gate_ID");
+            q.setParameter("pub_workflow_id", name);
+            q.setParameter("gate_ID", gatewayID);
+            q.executeUpdate();
+            end();
+        } else if (type == ResourceType.HOST_DESCRIPTOR) {
+            begin();
+            Query q = em.createQuery("Delete p FROM Host_Descriptor p WHERE p.host_descriptor_ID = :host_desc_id and p.gateway_ID = :gate_ID");
+            q.setParameter("host_desc_id", name);
+            q.setParameter("gate_ID", gatewayID);
+            q.executeUpdate();
+        } else if (type == ResourceType.SERVICE_DESCRIPTOR) {
+            Query q = em.createQuery("Delete p FROM Service_Descriptor p WHERE p.service_descriptor_ID = :service_desc_id and p.gateway_ID = :gate_ID");
+            q.setParameter("service_desc_id", name);
+            q.setParameter("gate_ID", gatewayID);
+            q.executeUpdate();
+        } else if (type == ResourceType.APPLICATION_DESCRIPTOR) {
+            Query q = em.createQuery("Delete p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.gateway_ID = :gate_ID");
+            q.setParameter("app_desc_id", name);
+            q.setParameter("gate_ID", gatewayID);
+            q.executeUpdate();
+        }
+        end();
+
+
+    }
+
+    public Resource get(ResourceType type, Object name) {
+        begin();
+        if (type == ResourceType.PROJECT) {
+            Query q = em.createQuery("SELECT p FROM Project p WHERE p.project_name = :proj_name and p.gateway_ID =:gate_ID");
+            q.setParameter("proj_name", name);
+            q.setParameter("gate_ID", gatewayID);
+            Project eproject = (Project) q.getSingleResult();
+            ProjectResource projectResource = new ProjectResource(eproject.getProject_ID());
+            projectResource.setName(eproject.getProject_name());
+            end();
+            return projectResource;
+        } else if (type == ResourceType.USER) {
+            Query q = em.createQuery("SELECT p FROM Users p WHERE p.user_name = :username and p.gateway_ID =:gate_ID");
+            q.setParameter("username", name);
+            q.setParameter("gate_ID", gatewayID);
+            Users eUser = (Users) q.getSingleResult();
+            UserResource userResource = new UserResource(eUser.getUser_ID());
+            userResource.setUserName(eUser.getUser_name());
+            userResource.setGatewayID(gatewayID);
+            end();
+            return userResource;
+        } else if (type == ResourceType.PUBLISHED_WORKFLOW) {
+            Query q = em.createQuery("SELECT p FROM Published_Workflow p WHERE p.publish_workflow_name = :pub_workflow_name and p.gateway_ID =:gate_ID");
+            q.setParameter("pub_workflow_name", name);
+            q.setParameter("gate_ID", gatewayID);
+            Published_Workflow ePub_workflow = (Published_Workflow) q.getSingleResult();
+            PublishWorkflowResource publishWorkflowResource = new PublishWorkflowResource(ePub_workflow.getPublish_workflow_name());
+            publishWorkflowResource.setContent(ePub_workflow.getWorkflow_content());
+            publishWorkflowResource.setPublishedDate(ePub_workflow.getPublished_date());
+            publishWorkflowResource.setVersion(ePub_workflow.getVersion());
+            end();
+            return publishWorkflowResource;
+        } else if (type == ResourceType.SERVICE_DESCRIPTOR) {
+            Query q = em.createQuery("SELECT p FROM Service_Descriptor p WHERE p.service_descriptor_ID = :service_desc_id and p.gateway_ID =:gate_ID");
+            q.setParameter("service_desc_id", name);
+            q.setParameter("gate_ID", gatewayID);
+            Service_Descriptor eServiceDesc = (Service_Descriptor) q.getSingleResult();
+            ServiceDescriptorResource serviceDescriptorResource = new ServiceDescriptorResource(eServiceDesc.getService_descriptor_ID());
+            serviceDescriptorResource.setGatewayID(eServiceDesc.getGateway().getGateway_ID());
+            serviceDescriptorResource.setContent(eServiceDesc.getService_descriptor_xml());
+            end();
+            return serviceDescriptorResource;
+        } else if (type == ResourceType.HOST_DESCRIPTOR) {
+            Query q = em.createQuery("SELECT p FROM Host_Descriptor p WHERE p.host_descriptor_ID = :host_desc_id and p.gateway_ID =:gate_ID");
+            q.setParameter("host_desc_id", name);
+            q.setParameter("gate_ID", gatewayID);
+            Host_Descriptor eHostDesc = (Host_Descriptor) q.getSingleResult();
+            HostDescriptorResource hostDescriptorResource = new HostDescriptorResource(eHostDesc.getHost_descriptor_ID());
+            hostDescriptorResource.setGatewayID(eHostDesc.getGateway().getGateway_ID());
+            hostDescriptorResource.setContent(eHostDesc.getHost_descriptor_ID());
+            end();
+            return hostDescriptorResource;
+        } else if (type == ResourceType.APPLICATION_DESCRIPTOR) {
+            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.gateway_ID =:gate_ID");
+            q.setParameter("app_desc_id", name);
+            q.setParameter("gate_ID", gatewayID);
+            Application_Descriptor eappDesc = (Application_Descriptor) q.getSingleResult();
+            ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(eappDesc.getApplication_descriptor_ID());
+            applicationDescriptorResource.setGatewayID(eappDesc.getGateway().getGateway_ID());
+            applicationDescriptorResource.setContent(eappDesc.getApplication_descriptor_xml());
+            applicationDescriptorResource.setHostDescName(eappDesc.getHost_descriptor().getHost_descriptor_ID());
+            applicationDescriptorResource.setServiceDescName(eappDesc.getService_descriptor().getService_descriptor_ID());
+            end();
+            return applicationDescriptorResource;
+        } else {
+            return null;
+        }
+
+    }
+
+    public List<Resource> get(ResourceType type) {
+        List<Resource> resourceList = new ArrayList<Resource>();
+        begin();
+        if (type == ResourceType.PROJECT) {
+            Query q = em.createQuery("SELECT p FROM Project p WHERE p.gateway_ID =:gate_ID");
+            q.setParameter("gate_ID", gatewayID);
+            List results = q.getResultList();
+            if (results.size() != 0) {
+                for (Object result : results) {
+                    Project project = (Project) result;
+                    ProjectResource projectResource = new ProjectResource(project.getProject_ID());
+                    projectResource.setGatewayID(gatewayID);
+                    projectResource.setName(project.getProject_name());
+                    resourceList.add(projectResource);
+                }
+            }
+        } else if (type == ResourceType.USER) {
+            Query q = em.createQuery("SELECT p FROM Users p WHERE p.gateway_ID =:gate_ID");
+            q.setParameter("gate_ID", gatewayID);
+            List results = q.getResultList();
+            if (results.size() != 0) {
+                for (Object result : results) {
+                    Users user = (Users) result;
+                    UserResource userResource = new UserResource(user.getUser_ID());
+                    userResource.setGatewayID(gatewayID);
+                    userResource.setUserName(user.getUser_name());
+                    resourceList.add(userResource);
+                }
+            }
+        } else if (type == ResourceType.PUBLISHED_WORKFLOW) {
+            Query q = em.createQuery("SELECT p FROM Published_Workflow p WHERE p.gateway_ID =:gate_ID");
+            q.setParameter("gate_ID", gatewayID);
+            List results = q.getResultList();
+            if (results.size() != 0) {
+                for (Object result : results) {
+                    Published_Workflow publishedWorkflow = (Published_Workflow) result;
+                    PublishWorkflowResource publishWorkflowResource = new PublishWorkflowResource(publishedWorkflow.getPublish_workflow_name());
+                    publishWorkflowResource.setGatewayID(gatewayID);
+                    publishWorkflowResource.setContent(publishedWorkflow.getWorkflow_content());
+                    publishWorkflowResource.setPublishedDate(publishedWorkflow.getPublished_date());
+                    publishWorkflowResource.setVersion(publishedWorkflow.getVersion());
+                    resourceList.add(publishWorkflowResource);
+                }
+            }
+        } else if (type == ResourceType.HOST_DESCRIPTOR) {
+            Query q = em.createQuery("SELECT p FROM Host_Descriptor p WHERE p.gateway_ID =:gate_ID");
+            q.setParameter("gate_ID", gatewayID);
+            List results = q.getResultList();
+            if (results.size() != 0) {
+                for (Object result : results) {
+                    Host_Descriptor hostDescriptor = (Host_Descriptor) result;
+                    HostDescriptorResource hostDescriptorResource = new HostDescriptorResource(hostDescriptor.getHost_descriptor_ID());
+                    hostDescriptorResource.setGatewayID(gatewayID);
+                    hostDescriptorResource.setContent(hostDescriptor.getHost_descriptor_xml());
+                    resourceList.add(hostDescriptorResource);
+                }
+            }
+        } else if (type == ResourceType.SERVICE_DESCRIPTOR) {
+            Query q = em.createQuery("SELECT p FROM Service_Descriptor p WHERE p.gateway_ID =:gate_ID");
+            q.setParameter("gate_ID", gatewayID);
+            List results = q.getResultList();
+            if (results.size() != 0) {
+                for (Object result : results) {
+                    Service_Descriptor serviceDescriptor = (Service_Descriptor) result;
+                    ServiceDescriptorResource serviceDescriptorResource = new ServiceDescriptorResource(serviceDescriptor.getService_descriptor_ID());
+                    serviceDescriptorResource.setGatewayID(gatewayID);
+                    serviceDescriptorResource.setContent(serviceDescriptor.getService_descriptor_xml());
+                    resourceList.add(serviceDescriptorResource);
+                }
+            }
+        } else if (type == ResourceType.APPLICATION_DESCRIPTOR) {
+            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.gateway_ID =:gate_ID");
+            q.setParameter("gate_ID", gatewayID);
+            List results = q.getResultList();
+            if (results.size() != 0) {
+                for (Object result : results) {
+                    Application_Descriptor applicationDescriptor = (Application_Descriptor) result;
+                    ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(applicationDescriptor.getApplication_descriptor_ID());
+                    applicationDescriptorResource.setGatewayID(gatewayID);
+                    applicationDescriptorResource.setContent(applicationDescriptor.getApplication_descriptor_xml());
+                    applicationDescriptorResource.setHostDescName(applicationDescriptor.getHost_descriptor().getHost_descriptor_ID());
+                    applicationDescriptorResource.setServiceDescName(applicationDescriptor.getService_descriptor().getService_descriptor_ID());
+                    resourceList.add(applicationDescriptorResource);
+                }
+            }
+        }
+        end();
+        return resourceList;
+    }
+
+    public void save() {
+        // save me..
+        begin();
+        Gateway gateway = new Gateway();
+        gateway.setGateway_name(name);
+        if (gatewayID != -1) {
+            gateway.setGateway_ID(gatewayID);
+        }
+        em.persist(gateway);
+        end();
+    }
+
+    public boolean isExists(ResourceType type, Object name) {
+        begin();
+        if(type == ResourceType.PROJECT){
+            Query q = em.createQuery("SELECT p FROM Project p WHERE p.gateway_ID =:gate_ID and p.project_name =:proj_name");
+            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("proj_name",name);
+            Project project = (Project)q.getSingleResult();
+            if(project != null){
+                return true;
+            }else {
+                return false;
+            }
+        } else if (type == ResourceType.USER){
+            Query q = em.createQuery("SELECT p FROM Users p WHERE p.gateway_ID =:gate_ID and p.user_name =:usr_name");
+            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("usr_name",name);
+            Users users = (Users)q.getSingleResult();
+            if(users != null){
+                return true;
+            }else {
+                return false;
+            }
+        }  else if (type == ResourceType.PUBLISHED_WORKFLOW){
+                Query q = em.createQuery("SELECT p FROM Published_Workflow p WHERE p.gateway_ID =:gate_ID and p.Published_Workflow =:pub_wf_name");
+            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("pub_wf_name",name);
+            Published_Workflow publishedWrkflow = (Published_Workflow)q.getSingleResult();
+            if(publishedWrkflow != null){
+                return true;
+            }else {
+                return false;
+            }
+        }  else if (type == ResourceType.HOST_DESCRIPTOR){
+            Query q = em.createQuery("SELECT p FROM Host_Descriptor p WHERE p.gateway_ID =:gate_ID and p.host_descriptor_ID =:host_desc_name");
+            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("host_desc_name",name);
+            Host_Descriptor hostDescriptor = (Host_Descriptor)q.getSingleResult();
+            if(hostDescriptor != null){
+                return true;
+            }else {
+                return false;
+            }
+        }else if (type == ResourceType.SERVICE_DESCRIPTOR){
+            Query q = em.createQuery("SELECT p FROM Service_Descriptor p WHERE p.gateway_ID =:gate_ID and p.service_descriptor_ID =:service_desc_name");
+            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("service_desc_name",name);
+            Service_Descriptor serviceDescriptor = (Service_Descriptor)q.getSingleResult();
+            if(serviceDescriptor != null){
+                return true;
+            }else {
+                return false;
+            }
+        }   else if (type == ResourceType.APPLICATION_DESCRIPTOR){
+            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.gateway_ID =:gate_ID and p.application_descriptor_ID =:app_desc_name");
+            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("app_desc_name",name);
+            Application_Descriptor applicationDescriptor = (Application_Descriptor)q.getSingleResult();
+            if(applicationDescriptor != null){
+                return true;
+            }else {
+                return false;
+            }
+        }
+        end();
+        return false;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,135 @@
+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.model.Application_Descriptor;
+import org.apache.airavata.persistance.registry.jpa.model.Gateway;
+import org.apache.airavata.persistance.registry.jpa.model.Host_Descriptor;
+
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+
+public class HostDescriptorResource extends AbstractResource {
+    private String hostDescName;
+    private int gatewayID;
+    private int userID;
+    private String content;
+
+    public HostDescriptorResource(String hostDescName) {
+        this.hostDescName = hostDescName;
+    }
+
+    public HostDescriptorResource() {
+    }
+
+    public int getUserID() {
+        return userID;
+    }
+
+    public void setUserID(int userID) {
+        this.userID = userID;
+    }
+
+    public String getHostDescName() {
+        return hostDescName;
+    }
+
+    public int getGatewayID() {
+        return gatewayID;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setGatewayID(int gatewayID) {
+        this.gatewayID = gatewayID;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public Resource create(ResourceType type) {
+        if (type == ResourceType.APPLICATION_DESCRIPTOR) {
+            ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource();
+            applicationDescriptorResource.setGatewayID(gatewayID);
+            applicationDescriptorResource.setHostDescName(hostDescName);
+            return applicationDescriptorResource;
+        }
+        return null;
+    }
+
+    public void remove(ResourceType type, Object name) {
+        if (type == ResourceType.APPLICATION_DESCRIPTOR) {
+            begin();
+            Query q = em.createQuery("Delete p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.host_descriptor_ID = :host_desc_name and p.gateway_ID = :gate_ID");
+            q.setParameter("app_desc_id", name);
+            q.setParameter("host_desc_name", hostDescName);
+            q.setParameter("gate_ID", gatewayID);
+            q.executeUpdate();
+            end();
+        }
+    }
+
+    public Resource get(ResourceType type, Object name) {
+        if (type == ResourceType.APPLICATION_DESCRIPTOR) {
+            begin();
+            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.host_descriptor_ID =:host_desc_name and p.gateway_ID =:gate_ID");
+            q.setParameter("app_desc_id", name);
+            q.setParameter("host_desc_name", hostDescName);
+            q.setParameter("gate_ID", gatewayID);
+            Application_Descriptor eappDesc = (Application_Descriptor) q.getSingleResult();
+            ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(eappDesc.getApplication_descriptor_ID());
+            applicationDescriptorResource.setGatewayID(eappDesc.getGateway().getGateway_ID());
+            applicationDescriptorResource.setContent(eappDesc.getApplication_descriptor_xml());
+            applicationDescriptorResource.setHostDescName(eappDesc.getHost_descriptor().getHost_descriptor_ID());
+            applicationDescriptorResource.setServiceDescName(hostDescName);
+            end();
+            return applicationDescriptorResource;
+        }
+        return null;
+    }
+
+    public List<Resource> get(ResourceType type) {
+        List<Resource> resourceList = new ArrayList<Resource>();
+        if (type == ResourceType.APPLICATION_DESCRIPTOR) {
+            begin();
+            Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.gateway_ID =:gate_ID and p.host_descriptor_ID =:host_desc_id");
+            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("host_desc_id", hostDescName);
+            List results = q.getResultList();
+            if (results.size() != 0) {
+                for (Object result : results) {
+                    Application_Descriptor applicationDescriptor = (Application_Descriptor) result;
+                    ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(applicationDescriptor.getApplication_descriptor_ID());
+                    applicationDescriptorResource.setGatewayID(gatewayID);
+                    applicationDescriptorResource.setContent(applicationDescriptor.getApplication_descriptor_xml());
+                    applicationDescriptorResource.setHostDescName(hostDescName);
+                    applicationDescriptorResource.setServiceDescName(applicationDescriptor.getService_descriptor().getService_descriptor_ID());
+                    resourceList.add(applicationDescriptorResource);
+                }
+            }
+            end();
+        }
+        return resourceList;
+    }
+
+    public void save() {
+        begin();
+        Host_Descriptor hostDescriptor = new Host_Descriptor();
+        hostDescriptor.setHost_descriptor_ID(hostDescName);
+        Gateway gateway = new Gateway();
+        gateway.setGateway_ID(gatewayID);
+        hostDescriptor.setGateway(gateway);
+        hostDescriptor.setHost_descriptor_xml(content);
+        em.persist(hostDescriptor);
+        end();
+
+    }
+
+    public boolean isExists(ResourceType type, Object name) {
+        return false;
+    }
+}

Added: incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java?rev=1381324&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java (added)
+++ incubator/airavata/trunk/modules/commons/provenance-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java Wed Sep  5 19:49:15 2012
@@ -0,0 +1,206 @@
+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.model.Experiment;
+import org.apache.airavata.persistance.registry.jpa.model.Gateway;
+import org.apache.airavata.persistance.registry.jpa.model.Project;
+import org.apache.airavata.persistance.registry.jpa.model.User_Workflow;
+
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ProjectResource extends AbstractResource {
+
+    private String name;
+    private int id = -1;
+    private int gatewayID;
+    private int userID;
+    private UserResource userResource;
+    private Gateway gateway;
+
+    public ProjectResource() {
+    }
+
+    public ProjectResource(int id) {
+        this.id = id;
+    }
+
+    public int getUserID() {
+        return userID;
+    }
+
+    public void setUserID(int userID) {
+        this.userID = userID;
+    }
+
+    public ProjectResource(UserResource userResource, int gatewayID, int id) {
+        this.userResource = userResource;
+        this.gatewayID = gatewayID;
+        this.id = id;
+    }
+
+    public Resource create(ResourceType type) {
+//        if (type == ResourceType.USER){
+//            UserResource userResource = new UserResource();
+//            userResource.setGatewayID(gatewayID);
+//            return userResource;
+//        }
+        if (type == ResourceType.USER_WORKFLOW) {
+            UserWorkflowResource userWorkflowResource = new UserWorkflowResource();
+            userWorkflowResource.setProjectID(id);
+            userWorkflowResource.setUserID(userResource.getId());
+            return userWorkflowResource;
+        } else if (type == ResourceType.EXPERIMENT) {
+            ExperimentResource experimentResource = new ExperimentResource();
+            experimentResource.setProjectID(id);
+            experimentResource.setUserID(userResource.getId());
+            return experimentResource;
+        } else {
+            return null;
+        }
+    }
+
+    public void remove(ResourceType type, Object name) {
+        begin();
+        if (type == ResourceType.USER_WORKFLOW) {
+            Query q = em.createQuery("Delete p FROM User_Workflow p WHERE p.project_ID = :proj_id and p.user_ID = :user_id and p.user_workflow_name = :usrwf_name");
+            q.setParameter("proj_id", id);
+            q.setParameter("user_id", userResource.getId());
+            q.setParameter("usrwf_name", name);
+            q.executeUpdate();
+        } else if (type == ResourceType.EXPERIMENT) {
+            Query q = em.createQuery("Delete p FROM Experiment p WHERE p.project_ID = :proj_id and p.user_ID = :user_id and p.experiment_ID = :ex_name");
+            q.setParameter("proj_id", id);
+            q.setParameter("user_id", userResource.getId());
+            q.setParameter("ex_name", name);
+            q.executeUpdate();
+        }
+        end();
+    }
+
+    public Resource get(ResourceType type, Object name) {
+        begin();
+        if (type == ResourceType.USER_WORKFLOW) {
+            Query q = em.createQuery("SELECT p FROM User_Workflow p WHERE p.project_ID = :proj_id and p.user_ID = :user_id and p.user_workflow_name = :usrwf_name");
+            q.setParameter("proj_id", id);
+            q.setParameter("user_id", userResource.getId());
+            q.setParameter("usrwf_name", name);
+            User_Workflow userWorkflow = (User_Workflow) q.getSingleResult();
+            UserWorkflowResource userWorkflowResource = new UserWorkflowResource(id, userResource.getId(), userWorkflow.getUser_workflow_name());
+            userWorkflowResource.setContent(userWorkflow.getWorkflow_content());
+            userWorkflowResource.setLastUpdateDate(userWorkflow.getLast_update_date());
+            end();
+            return userWorkflowResource;
+        } else if (type == ResourceType.EXPERIMENT) {
+            Query q = em.createQuery("SELECT p FROM Experiment p WHERE p.project_ID = :proj_id and p.user_ID = :user_id and p.experiment_ID = :ex_name");
+            q.setParameter("proj_id", id);
+            q.setParameter("user_id", userResource.getId());
+            q.setParameter("ex_name", name);
+            Experiment experiment = (Experiment) q.getSingleResult();
+            ExperimentResource experimentResource = new ExperimentResource(experiment.getExperiment_ID());
+            experimentResource.setProjectID(experiment.getProject().getProject_ID());
+            experiment.setSubmitted_date(experiment.getSubmitted_date());
+            experiment.setUser(experiment.getUser());
+            end();
+            return experimentResource;
+        }
+        return null;
+    }
+
+    public List<Resource> get(ResourceType type) {
+        List<Resource> resourceList = new ArrayList<Resource>();
+        begin();
+        if (type == ResourceType.USER_WORKFLOW) {
+            Query q = em.createQuery("SELECT p FROM User_Workflow p WHERE p.project_ID =:proj_ID");
+            q.setParameter("proj_ID", id);
+            List results = q.getResultList();
+            if (results.size() != 0) {
+                for (Object result : results) {
+                    User_Workflow userWorkflow = (User_Workflow) result;
+                    UserWorkflowResource userWorkflowResource = new UserWorkflowResource(userWorkflow.getProject().getProject_ID(), userWorkflow.getUsers().getUser_ID(), userWorkflow.getUser_workflow_name());
+                    userWorkflowResource.setContent(userWorkflow.getWorkflow_content());
+                    userWorkflowResource.setLastUpdateDate(userWorkflow.getLast_update_date());
+                    resourceList.add(userWorkflowResource);
+                }
+            }
+        } else if (type == ResourceType.EXPERIMENT) {
+            Query q = em.createQuery("SELECT p FROM Experiment p WHERE p.project_ID =:proj_ID");
+            q.setParameter("proj_ID", id);
+            List results = q.getResultList();
+            if (results.size() != 0) {
+                for (Object result : results) {
+                    Experiment experiment = (Experiment) result;
+                    ExperimentResource experimentResource = new ExperimentResource(experiment.getExperiment_ID());
+                    experimentResource.setProjectID(experiment.getProject().getProject_ID());
+                    experimentResource.setUserID(experiment.getUser().getUser_ID());
+                    experimentResource.setSubmittedDate(experiment.getSubmitted_date());
+                    resourceList.add(experimentResource);
+                }
+            }
+        }
+        end();
+        return resourceList;
+    }
+
+    public void save() {
+        begin();
+        Project project = new Project();
+        project.setProject_name(name);
+        Gateway gateway = new Gateway();
+        gateway.setGateway_ID(gatewayID);
+        project.setGateway(gateway);
+        if (id != -1) {
+            project.setProject_ID(id);
+        }
+        em.persist(project);
+        end();
+
+    }
+
+    public boolean isExists(ResourceType type, Object name) {
+        begin();
+        if(type == ResourceType.USER_WORKFLOW){
+            Query q = em.createQuery("SELECT p FROM User_Workflow p WHERE p.gateway_ID =:gate_ID and p.user_ID =:userID and p.project_ID =:projectID");
+            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("userID",userResource.getId());
+            q.setParameter("projectID", id);
+            User_Workflow userWorkflow = (User_Workflow)q.getSingleResult();
+            if(userWorkflow != null){
+                return true;
+            }else {
+                return false;
+            }
+        }else if(type == ResourceType.EXPERIMENT){
+            Query q = em.createQuery("SELECT p FROM Experiment p WHERE p.gateway_ID =:gate_ID and p.user_ID =:userID and p.project_ID =:projectID");
+            q.setParameter("gate_ID", gatewayID);
+            q.setParameter("userID",userResource.getId());
+            q.setParameter("projectID", id);
+            Experiment experiment = (Experiment)q.getSingleResult();
+            if(experiment != null){
+                return true;
+            }else {
+                return false;
+            }
+        }
+        end();
+        return false;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    void setGatewayID(int gatewayID) {
+        this.gatewayID = gatewayID;
+    }
+}



Mime
View raw message