airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1382340 - in /incubator/airavata/trunk/modules: commons/registry-api/src/main/java/org/apache/airavata/registry/api/ commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/descriptor/ commons/registry-api/src/main/ja...
Date Sat, 08 Sep 2012 18:40:11 GMT
Author: samindaw
Date: Sat Sep  8 18:40:10 2012
New Revision: 1382340

URL: http://svn.apache.org/viewvc?rev=1382340&view=rev
Log:
new reg api integration

Added:
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java
      - copied, changed from r1382215, incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataProvenanceRegistry.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/gateway/
      - copied from r1382311, incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/descriptor/
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/worker/
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/worker/WorkspaceProjectAlreadyExistsException.java   (with props)
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/worker/WorkspaceProjectDoesNotExistsException.java   (with props)
Removed:
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataProvenanceRegistry.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/descriptor/
Modified:
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataExperiment.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/DescriptorRegistry.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/ProjectsRegistry.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/PublishedWorkflowRegistry.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/UserWorkflowRegistry.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/WorkspaceProject.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/gateway/DescriptorAlreadyExistsException.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/gateway/DescriptorDoesNotExistsException.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/gateway/MalformedDescriptorException.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/AiravataJCRRegistry.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAResourceAccessor.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataExperiment.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataExperiment.java?rev=1382340&r1=1382339&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataExperiment.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataExperiment.java Sat Sep  8 18:40:10 2012
@@ -27,6 +27,9 @@ public class AiravataExperiment {
 	private String experimentId;
 	private Date submittedDate;
 	private AiravataUser user;
+	private WorkspaceProject project;
+	private Gateway gateway;
+	
 	public String getExperimentId() {
 		return experimentId;
 	}
@@ -45,4 +48,16 @@ public class AiravataExperiment {
 	public void setUser(AiravataUser user) {
 		this.user = user;
 	}
+	public Gateway getGateway() {
+		return gateway;
+	}
+	public void setGateway(Gateway gateway) {
+		this.gateway = gateway;
+	}
+	public WorkspaceProject getProject() {
+		return project;
+	}
+	public void setProject(WorkspaceProject project) {
+		this.project = project;
+	}
 }

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java?rev=1382340&r1=1382339&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java Sat Sep  8 18:40:10 2012
@@ -22,7 +22,7 @@
 package org.apache.airavata.registry.api;
 
 
-public abstract class AiravataRegistry2 implements DescriptorRegistry, ProjectsRegistry, PublishedWorkflowRegistry, UserWorkflowRegistry, ConfigurationRegistry, AiravataProvenanceRegistry{
+public abstract class AiravataRegistry2 implements DescriptorRegistry, ProjectsRegistry, PublishedWorkflowRegistry, UserWorkflowRegistry, ConfigurationRegistry, ProvenanceRegistry{
 	private Gateway gateway;
 	private AiravataUser user;
 	

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/DescriptorRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/DescriptorRegistry.java?rev=1382340&r1=1382339&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/DescriptorRegistry.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/DescriptorRegistry.java Sat Sep  8 18:40:10 2012
@@ -28,9 +28,9 @@ import org.apache.airavata.common.regist
 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.exception.descriptor.DescriptorAlreadyExistsException;
-import org.apache.airavata.registry.api.exception.descriptor.DescriptorDoesNotExistsException;
-import org.apache.airavata.registry.api.exception.descriptor.MalformedDescriptorException;
+import org.apache.airavata.registry.api.exception.gateway.DescriptorAlreadyExistsException;
+import org.apache.airavata.registry.api.exception.gateway.DescriptorDoesNotExistsException;
+import org.apache.airavata.registry.api.exception.gateway.MalformedDescriptorException;
 
 public interface DescriptorRegistry extends AiravataSubRegistry {
 	

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/ProjectsRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/ProjectsRegistry.java?rev=1382340&r1=1382339&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/ProjectsRegistry.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/ProjectsRegistry.java Sat Sep  8 18:40:10 2012
@@ -24,19 +24,25 @@ package org.apache.airavata.registry.api
 import java.util.Date;
 import java.util.List;
 
+import org.apache.airavata.common.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.exception.worker.ExperimentDoesNotExistsException;
+import org.apache.airavata.registry.api.exception.worker.WorkspaceProjectAlreadyExistsException;
+import org.apache.airavata.registry.api.exception.worker.WorkspaceProjectDoesNotExistsException;
+
 public interface ProjectsRegistry extends AiravataSubRegistry {
 	
 	//------------Project management
-	public void addWorkspaceProject(WorkspaceProject project);
-	public void updateWorkspaceProject(WorkspaceProject project);
-	public void deleteWorkspaceProject(String projectName);
-	public WorkspaceProject getWorkspaceProject(String projectName);
+	public void addWorkspaceProject(WorkspaceProject project) throws WorkspaceProjectAlreadyExistsException, RegistryException;
+	public void updateWorkspaceProject(WorkspaceProject project) throws WorkspaceProjectDoesNotExistsException, RegistryException;
+	public void deleteWorkspaceProject(String projectName) throws WorkspaceProjectDoesNotExistsException, RegistryException;
+	public WorkspaceProject getWorkspaceProject(String projectName) throws WorkspaceProjectDoesNotExistsException, RegistryException;
+	public List<WorkspaceProject> getWorkspaceProjects() throws RegistryException;
 	
 	//------------Experiment management
-	public void createExperiment(String projectName, AiravataExperiment experiment);
-	public void removeExperiment(String experimentId);
-	public List<AiravataExperiment> getExperiments();
-	public List<AiravataExperiment> getExperiments(String projectName);
-	public List<AiravataExperiment> getExperiments(Date from, Date to);
-	public List<AiravataExperiment> getExperiments(String projectName, Date from, Date to);
+	public void addExperiment(String projectName, AiravataExperiment experiment) throws WorkspaceProjectDoesNotExistsException, ExperimentDoesNotExistsException;
+	public void removeExperiment(String experimentId) throws ExperimentDoesNotExistsException;
+	public List<AiravataExperiment> getExperiments() throws RegistryException;
+	public List<AiravataExperiment> getExperiments(String projectName)throws RegistryException;
+	public List<AiravataExperiment> getExperiments(Date from, Date to)throws RegistryException;
+	public List<AiravataExperiment> getExperiments(String projectName, Date from, Date to) throws RegistryException;
 }

Copied: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java (from r1382215, incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataProvenanceRegistry.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java?p2=incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java&p1=incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataProvenanceRegistry.java&r1=1382215&r2=1382340&rev=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataProvenanceRegistry.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java Sat Sep  8 18:40:10 2012
@@ -28,7 +28,7 @@ import org.apache.airavata.common.regist
 import org.apache.airavata.registry.api.workflow.*;
 import org.apache.airavata.registry.api.workflow.WorkflowInstanceStatus.ExecutionStatus;
 
-public interface AiravataProvenanceRegistry extends AiravataSubRegistry{
+public interface ProvenanceRegistry extends AiravataSubRegistry{
 
 	/*------------------------------------------- Experiment data ---------------------------------------------*/
     /**

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/PublishedWorkflowRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/PublishedWorkflowRegistry.java?rev=1382340&r1=1382339&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/PublishedWorkflowRegistry.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/PublishedWorkflowRegistry.java Sat Sep  8 18:40:10 2012
@@ -21,14 +21,24 @@
 
 package org.apache.airavata.registry.api;
 
+import java.util.List;
+import java.util.Map;
+
+import org.apache.airavata.common.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.exception.gateway.PublishedWorkflowAlreadyExistsException;
+import org.apache.airavata.registry.api.exception.gateway.PublishedWorkflowDoesNotExistsException;
+import org.apache.airavata.registry.api.exception.worker.UserWorkflowDoesNotExistsException;
+
 
 public interface PublishedWorkflowRegistry extends AiravataSubRegistry {
 	
-	public void publishWorkflow(String workflowName, String publishWorkflowName);
-	public void publishWorkflow(String workflowName);
+	public void publishWorkflow(String workflowName, String publishWorkflowName) throws PublishedWorkflowAlreadyExistsException, UserWorkflowDoesNotExistsException, RegistryException;
+	public void publishWorkflow(String workflowName) throws PublishedWorkflowAlreadyExistsException, UserWorkflowDoesNotExistsException, RegistryException;
 	
-	public String getPublishedWorkflowGraphXML(String workflowName);
-	public ResourceMetadata getPublishedWorkflowMetadata(String workflowName);
+	public String getPublishedWorkflowGraphXML(String workflowName) throws PublishedWorkflowDoesNotExistsException, RegistryException;
+	public List<String> getPublishedWorkflowNames() throws RegistryException;
+	public Map<String,String> getPublishedWorkflows() throws RegistryException;
+	public ResourceMetadata getPublishedWorkflowMetadata(String workflowName) throws RegistryException;
 	
-	public void removePublishedWorkflow(String workflowName);
+	public void removePublishedWorkflow(String workflowName)throws PublishedWorkflowDoesNotExistsException, RegistryException;
 }

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/UserWorkflowRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/UserWorkflowRegistry.java?rev=1382340&r1=1382339&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/UserWorkflowRegistry.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/UserWorkflowRegistry.java Sat Sep  8 18:40:10 2012
@@ -21,14 +21,18 @@
 
 package org.apache.airavata.registry.api;
 
+import org.apache.airavata.common.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.exception.worker.UserWorkflowAlreadyExistsException;
+import org.apache.airavata.registry.api.exception.worker.UserWorkflowDoesNotExistsException;
+
 
 public interface UserWorkflowRegistry extends AiravataSubRegistry {
 	
-	public void addWorkflow(String workflowName, String workflowGraphXml);
-	public void updateWorkflow(String workflowName, String workflowGraphXml);
+	public void addWorkflow(String workflowName, String workflowGraphXml) throws UserWorkflowAlreadyExistsException, RegistryException;
+	public void updateWorkflow(String workflowName, String workflowGraphXml) throws UserWorkflowDoesNotExistsException, RegistryException;
 	
-	public String getWorkflowGraphXML(String workflowName);
-	public ResourceMetadata getWorkflowMetadata(String workflowName);	
+	public String getWorkflowGraphXML(String workflowName) throws UserWorkflowDoesNotExistsException, RegistryException;
+	public ResourceMetadata getWorkflowMetadata(String workflowName) throws RegistryException;	
 	
-	public void removeWorkflow(String workflowName);
+	public void removeWorkflow(String workflowName) throws UserWorkflowDoesNotExistsException, RegistryException;
 }

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/WorkspaceProject.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/WorkspaceProject.java?rev=1382340&r1=1382339&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/WorkspaceProject.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/WorkspaceProject.java Sat Sep  8 18:40:10 2012
@@ -50,7 +50,7 @@ public class WorkspaceProject{
 	}
 	
 	public void createExperiment(AiravataExperiment experiment){
-		getProjectsRegistry().createExperiment(getProjectName(), experiment);
+		getProjectsRegistry().addExperiment(getProjectName(), experiment);
 	}
 	
 	public List<AiravataExperiment> getExperiments(){

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/gateway/DescriptorAlreadyExistsException.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/gateway/DescriptorAlreadyExistsException.java?rev=1382340&r1=1382311&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/gateway/DescriptorAlreadyExistsException.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/gateway/DescriptorAlreadyExistsException.java Sat Sep  8 18:40:10 2012
@@ -19,7 +19,7 @@
  *
  */
 
-package org.apache.airavata.registry.api.exception.descriptor;
+package org.apache.airavata.registry.api.exception.gateway;
 
 import org.apache.airavata.common.registry.api.exception.RegistryException;
 

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/gateway/DescriptorDoesNotExistsException.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/gateway/DescriptorDoesNotExistsException.java?rev=1382340&r1=1382311&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/gateway/DescriptorDoesNotExistsException.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/gateway/DescriptorDoesNotExistsException.java Sat Sep  8 18:40:10 2012
@@ -19,7 +19,7 @@
  *
  */
 
-package org.apache.airavata.registry.api.exception.descriptor;
+package org.apache.airavata.registry.api.exception.gateway;
 
 import org.apache.airavata.common.registry.api.exception.RegistryException;
 

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/gateway/MalformedDescriptorException.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/gateway/MalformedDescriptorException.java?rev=1382340&r1=1382311&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/gateway/MalformedDescriptorException.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/gateway/MalformedDescriptorException.java Sat Sep  8 18:40:10 2012
@@ -19,7 +19,7 @@
  *
  */
 
-package org.apache.airavata.registry.api.exception.descriptor;
+package org.apache.airavata.registry.api.exception.gateway;
 
 import org.apache.airavata.common.registry.api.exception.RegistryException;
 

Added: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/worker/WorkspaceProjectAlreadyExistsException.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/worker/WorkspaceProjectAlreadyExistsException.java?rev=1382340&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/worker/WorkspaceProjectAlreadyExistsException.java (added)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/worker/WorkspaceProjectAlreadyExistsException.java Sat Sep  8 18:40:10 2012
@@ -0,0 +1,34 @@
+/*
+ *
+ * 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.registry.api.exception.worker;
+
+import org.apache.airavata.common.registry.api.exception.RegistryException;
+
+public class WorkspaceProjectAlreadyExistsException extends RegistryException {
+
+	private static final long serialVersionUID = -8006347245307495767L;
+
+	public WorkspaceProjectAlreadyExistsException(String projectName) {
+		super("The workspace project "+projectName+" already exists!!!");
+	}
+
+}

Propchange: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/worker/WorkspaceProjectAlreadyExistsException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/worker/WorkspaceProjectDoesNotExistsException.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/worker/WorkspaceProjectDoesNotExistsException.java?rev=1382340&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/worker/WorkspaceProjectDoesNotExistsException.java (added)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/worker/WorkspaceProjectDoesNotExistsException.java Sat Sep  8 18:40:10 2012
@@ -0,0 +1,34 @@
+/*
+ *
+ * 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.registry.api.exception.worker;
+
+import org.apache.airavata.common.registry.api.exception.RegistryException;
+
+public class WorkspaceProjectDoesNotExistsException extends RegistryException {
+
+	private static final long serialVersionUID = -8006347245307495767L;
+
+	public WorkspaceProjectDoesNotExistsException(String projectName) {
+		super("The workspace project "+projectName+" does not exists!!!");
+	}
+
+}

Propchange: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/exception/worker/WorkspaceProjectDoesNotExistsException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/AiravataJCRRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/AiravataJCRRegistry.java?rev=1382340&r1=1382339&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/AiravataJCRRegistry.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/AiravataJCRRegistry.java Sat Sep  8 18:40:10 2012
@@ -47,7 +47,7 @@ import org.apache.airavata.commons.gfac.
 import org.apache.airavata.commons.gfac.type.ServiceDescription;
 import org.apache.airavata.commons.gfac.wsdl.WSDLConstants;
 import org.apache.airavata.commons.gfac.wsdl.WSDLGenerator;
-import org.apache.airavata.registry.api.AiravataProvenanceRegistry;
+import org.apache.airavata.registry.api.ProvenanceRegistry;
 import org.apache.airavata.registry.api.Axis2Registry;
 import org.apache.airavata.registry.api.DataRegistry;
 import org.apache.airavata.registry.api.exception.DeploymentDescriptionRetrieveException;
@@ -93,7 +93,7 @@ public class AiravataJCRRegistry extends
     public static final String WORKFLOW_USER_PROPERTY = "User";
     public static final String NOTIFICATION_STORE = "User";
     
-    private AiravataProvenanceRegistry provenanceRegistry;
+    private ProvenanceRegistry provenanceRegistry;
     private static Logger log = LoggerFactory.getLogger(AiravataJCRRegistry.class);
 
     public AiravataJCRRegistry(URI repositoryURI, String className,
@@ -1583,7 +1583,7 @@ public class AiravataJCRRegistry extends
         return true;
 	}
 
-	private AiravataProvenanceRegistry getProvenanceRegistry() {
+	private ProvenanceRegistry getProvenanceRegistry() {
 		return provenanceRegistry;
 	}
 	
@@ -1599,7 +1599,7 @@ public class AiravataJCRRegistry extends
                 String provenanceClass = "class.provenance.registry.accessor";
                 String provRegAccessorClass = properties.getProperty(provenanceClass, null);
                 if (provRegAccessorClass != null) {
-                    Class<AiravataProvenanceRegistry> provenanceRegistryClass = (Class<AiravataProvenanceRegistry>) getClass().getClassLoader().loadClass(provRegAccessorClass);
+                    Class<ProvenanceRegistry> provenanceRegistryClass = (Class<ProvenanceRegistry>) getClass().getClassLoader().loadClass(provRegAccessorClass);
                     provenanceRegistry = provenanceRegistryClass.getConstructor(String.class).newInstance(getUsername());
                 }
 			} catch (ClassNotFoundException e) {

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAResourceAccessor.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAResourceAccessor.java?rev=1382340&r1=1382339&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAResourceAccessor.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAResourceAccessor.java Sat Sep  8 18:40:10 2012
@@ -22,32 +22,31 @@
 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;
+import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
 import org.apache.airavata.registry.api.AiravataRegistry2;
 
 public class JPAResourceAccessor {
 	private AiravataRegistry2 registry=null;
 	private GatewayResource gatewayResource;
 	private ResourceUtils resourceUtils = new ResourceUtils();
-	
+	private WorkerResource workerResource;
+
 	public JPAResourceAccessor(AiravataRegistry2 registry) {
 		this.registry=registry;
 		gatewayResource = new GatewayResource();
 		gatewayResource.setGatewayName(this.registry.getGateway().getGatewayName());
+		workerResource = new WorkerResource(registry.getUser().getUserName(), getGateway());
 	}
 	
 	public GatewayResource getGateway(){
 		return gatewayResource;
 	}
 	
-	public ProjectResource createProject(String name){
-		ProjectResource prj = (ProjectResource)getGateway().create(ResourceType.PROJECT);
-		prj.setUserName(registry.getUser().getUserName());
-		prj.setName(name);
-		return prj;
-	}
-	
 	public ResourceUtils root(){
 		return resourceUtils;
 	}
+	
+	public WorkerResource getWorker(){
+		return workerResource;
+	}
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java?rev=1382340&r1=1382339&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java Sat Sep  8 18:40:10 2012
@@ -30,15 +30,11 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import javax.persistence.EntityManagerFactory;
-
 import org.apache.airavata.common.registry.api.exception.RegistryException;
 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.persistance.registry.jpa.JPAResourceAccessor;
-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.resources.ApplicationDescriptorResource;
 import org.apache.airavata.persistance.registry.jpa.resources.ConfigurationResource;
@@ -48,17 +44,25 @@ import org.apache.airavata.persistance.r
 import org.apache.airavata.persistance.registry.jpa.resources.ProjectResource;
 import org.apache.airavata.persistance.registry.jpa.resources.PublishWorkflowResource;
 import org.apache.airavata.persistance.registry.jpa.resources.ServiceDescriptorResource;
-import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
 import org.apache.airavata.persistance.registry.jpa.resources.UserWorkflowResource;
+import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
 import org.apache.airavata.registry.api.AiravataExperiment;
 import org.apache.airavata.registry.api.AiravataRegistry2;
 import org.apache.airavata.registry.api.AiravataUser;
+import org.apache.airavata.registry.api.Gateway;
 import org.apache.airavata.registry.api.ResourceMetadata;
 import org.apache.airavata.registry.api.WorkspaceProject;
 import org.apache.airavata.registry.api.exception.UnimplementedRegistryOperationException;
-import org.apache.airavata.registry.api.exception.descriptor.DescriptorAlreadyExistsException;
-import org.apache.airavata.registry.api.exception.descriptor.DescriptorDoesNotExistsException;
-import org.apache.airavata.registry.api.exception.descriptor.MalformedDescriptorException;
+import org.apache.airavata.registry.api.exception.gateway.DescriptorAlreadyExistsException;
+import org.apache.airavata.registry.api.exception.gateway.DescriptorDoesNotExistsException;
+import org.apache.airavata.registry.api.exception.gateway.MalformedDescriptorException;
+import org.apache.airavata.registry.api.exception.gateway.PublishedWorkflowAlreadyExistsException;
+import org.apache.airavata.registry.api.exception.gateway.PublishedWorkflowDoesNotExistsException;
+import org.apache.airavata.registry.api.exception.worker.ExperimentDoesNotExistsException;
+import org.apache.airavata.registry.api.exception.worker.UserWorkflowAlreadyExistsException;
+import org.apache.airavata.registry.api.exception.worker.UserWorkflowDoesNotExistsException;
+import org.apache.airavata.registry.api.exception.worker.WorkspaceProjectAlreadyExistsException;
+import org.apache.airavata.registry.api.exception.worker.WorkspaceProjectDoesNotExistsException;
 import org.apache.airavata.registry.api.workflow.WorkflowExecution;
 import org.apache.airavata.registry.api.workflow.WorkflowIOData;
 import org.apache.airavata.registry.api.workflow.WorkflowInstanceStatus;
@@ -73,8 +77,6 @@ import org.slf4j.LoggerFactory;
 public class AiravataJPARegistry extends AiravataRegistry2{
     private final static Logger logger = LoggerFactory.getLogger(AiravataJPARegistry.class);
     private JPAResourceAccessor jpa;
-    private static final String PERSISTENCE_UNIT_NAME = "airavata_registry";
-	private EntityManagerFactory factory;
 
     @Override
     protected void initialize() {
@@ -443,76 +445,106 @@ public class AiravataJPARegistry extends
 
     /**---------------------------------Project Registry----------------------------------**/
 
-    public void addWorkspaceProject(WorkspaceProject project) {
-        GatewayResource gatewayResource = jpa.getGateway();
-        ProjectResource resource = (ProjectResource)gatewayResource.create(ResourceType.PROJECT);
-        resource.setName(project.getProjectName());
-        //todo fix the IDs to Names
-//        resource.setUserID(getUser().getUserName());
-        resource.save();
-    }
-
-    public void updateWorkspaceProject(WorkspaceProject project) {
-        addWorkspaceProject(project);
-    }
-
-    public void deleteWorkspaceProject(String projectName) {
-        GatewayResource gatewayResource = jpa.getGateway();
-        gatewayResource.remove(ResourceType.PROJECT,projectName);
-    }
-
-    public WorkspaceProject getWorkspaceProject(String projectName) {
-        GatewayResource gatewayResource = jpa.getGateway();
-        ProjectResource resource = (ProjectResource)gatewayResource.get(ResourceType.PROJECT, projectName);
-        WorkspaceProject workspaceProject = new WorkspaceProject(projectName, this);
-        return workspaceProject;
-    }
-
-    public void createExperiment(String projectName, AiravataExperiment experiment) {
-        GatewayResource gatewayResource = jpa.getGateway();
-        ExperimentResource resource = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
-        resource.setExpID(experiment.getExperimentId());
-        resource.setSubmittedDate(new java.sql.Date(experiment.getSubmittedDate().getTime()));
-        resource.save();
-    }
-
-    public void removeExperiment(String experimentId) {
-        GatewayResource gatewayResource = jpa.getGateway();
-        gatewayResource.remove(ResourceType.EXPERIMENT, experimentId);
-    }
-
-    public List<AiravataExperiment> getExperiments() {
-        UserResource userResource = new UserResource();
-        userResource.setUserName(getUser().getUserName());
-        List<Resource> resources = userResource.get(ResourceType.EXPERIMENT);
-        List<AiravataExperiment> result = new ArrayList<AiravataExperiment>();
-        for(Resource resource:resources) {
-            AiravataExperiment airavataExperiment = new AiravataExperiment();
-            airavataExperiment.setExperimentId(((ExperimentResource) resource).getExpID());
-            airavataExperiment.setUser(getUser());
-            airavataExperiment.setSubmittedDate(new java.sql.Date(((ExperimentResource) resource).getSubmittedDate().getTime()));
-            result.add(airavataExperiment);
+    public void addWorkspaceProject(WorkspaceProject project) throws WorkspaceProjectAlreadyExistsException {
+    	WorkerResource worker = jpa.getWorker();
+		if (worker.isProjectExists(project.getProjectName())){
+        	throw new WorkspaceProjectAlreadyExistsException(project.getProjectName());
         }
-        return result;
+		ProjectResource projectResource = worker.createProject(project.getProjectName());
+		projectResource.save();
+    }
+
+    public void updateWorkspaceProject(WorkspaceProject project) throws WorkspaceProjectDoesNotExistsException {
+    	WorkerResource worker = jpa.getWorker();
+		if (!worker.isProjectExists(project.getProjectName())){
+        	throw new WorkspaceProjectDoesNotExistsException(project.getProjectName());
+        }
+		ProjectResource projectResource = worker.getProject(project.getProjectName());
+		projectResource.save();
     }
 
-    public List<AiravataExperiment> getExperiments(String projectName) {
-        ProjectResource projectResource = new ProjectResource();
-        projectResource.setName(projectName);
-        List<Resource> resources = projectResource.get(ResourceType.EXPERIMENT);
-        List<AiravataExperiment> result = new ArrayList<AiravataExperiment>();
-        for(Resource resource:resources) {
-            AiravataExperiment airavataExperiment = new AiravataExperiment();
-            airavataExperiment.setExperimentId(((ExperimentResource) resource).getExpID());
-            airavataExperiment.setUser(getUser());
-            airavataExperiment.setSubmittedDate(new java.sql.Date(((ExperimentResource) resource).getSubmittedDate().getTime()));
-            result.add(airavataExperiment);
+    public void deleteWorkspaceProject(String projectName) throws WorkspaceProjectDoesNotExistsException {
+    	WorkerResource worker = jpa.getWorker();
+		if (!worker.isProjectExists(projectName)){
+        	throw new WorkspaceProjectDoesNotExistsException(projectName);
         }
-        return result;  //To change body of implemented methods use File | Settings | File Templates.
+		worker.removeProject(projectName);
+    }
+
+    public WorkspaceProject getWorkspaceProject(String projectName) throws WorkspaceProjectDoesNotExistsException {
+    	WorkerResource worker = jpa.getWorker();
+		if (!worker.isProjectExists(projectName)){
+        	throw new WorkspaceProjectDoesNotExistsException(projectName);
+        }
+		ProjectResource projectResource = worker.getProject(projectName);
+		return new WorkspaceProject(projectResource.getName(), this);
+    }
+    
+    public List<WorkspaceProject> getWorkspaceProjects() throws RegistryException{
+    	WorkerResource worker = jpa.getWorker();
+    	List<WorkspaceProject> projects=new ArrayList<WorkspaceProject>();
+    	List<ProjectResource> projectResouces = worker.getProjects();
+    	for (ProjectResource resource : projectResouces) {
+			projects.add(new WorkspaceProject(resource.getName(), this));
+		}
+    	return projects;
     }
 
-    public List<AiravataExperiment> getExperiments(Date from, Date to) {
-        List<AiravataExperiment> experiments = getExperiments();
+    public void addExperiment(String projectName, AiravataExperiment experiment) throws WorkspaceProjectDoesNotExistsException, ExperimentDoesNotExistsException {
+    	WorkspaceProject workspaceProject = getWorkspaceProject(projectName);
+    	ProjectResource project = jpa.getWorker().getProject(workspaceProject.getProjectName());
+		String experimentId = experiment.getExperimentId();
+		if (project.isExperimentExists(experimentId)){
+        	throw new ExperimentDoesNotExistsException(experimentId);
+        }
+		ExperimentResource experimentResource = project.createExperiment(experimentId);
+		experimentResource.setSubmittedDate(new java.sql.Date(experiment.getSubmittedDate().getTime()));
+		experimentResource.save();
+    }
+
+    public void removeExperiment(String experimentId) throws ExperimentDoesNotExistsException {
+    	WorkerResource worker = jpa.getWorker();
+    	if (!worker.isExperimentExists(experimentId)){
+        	throw new ExperimentDoesNotExistsException(experimentId);
+    	}
+    	worker.removeExperiment(experimentId);
+    }
+
+    public List<AiravataExperiment> getExperiments() throws RegistryException{
+    	WorkerResource worker = jpa.getWorker();
+    	List<AiravataExperiment> result=new ArrayList<AiravataExperiment>();
+    	List<ExperimentResource> experiments = worker.getExperiments();
+    	for (ExperimentResource resource : experiments) {
+			AiravataExperiment e = createAiravataExperimentObj(resource);
+			result.add(e);
+		}
+        return result;
+    }
+
+	private AiravataExperiment createAiravataExperimentObj(
+			ExperimentResource resource) {
+		AiravataExperiment e = new AiravataExperiment();
+		e.setExperimentId(resource.getExpID());
+		e.setUser(new AiravataUser(resource.getWorker().getUser()));
+		e.setSubmittedDate(new Date(resource.getSubmittedDate().getTime()));
+		e.setGateway(new Gateway(resource.getGateway().getGatewayName()));
+		e.setProject(new WorkspaceProject(resource.getProject().getName(), this));
+		return e;
+	}
+
+    public List<AiravataExperiment> getExperiments(String projectName)throws RegistryException {
+    	ProjectResource project = jpa.getWorker().getProject(projectName);
+    	List<ExperimentResource> experiments = project.getExperiments();
+    	List<AiravataExperiment> result=new ArrayList<AiravataExperiment>();
+    	for (ExperimentResource resource : experiments) {
+			AiravataExperiment e = createAiravataExperimentObj(resource);
+			result.add(e);
+		}
+        return result;
+    }
+
+    public List<AiravataExperiment> getExperiments(Date from, Date to)throws RegistryException {
+    	List<AiravataExperiment> experiments = getExperiments();
         List<AiravataExperiment> newExperiments = new ArrayList<AiravataExperiment>();
         for(AiravataExperiment exp:experiments){
             Date submittedDate = exp.getSubmittedDate();
@@ -520,10 +552,10 @@ public class AiravataJPARegistry extends
                 newExperiments.add(exp);
             }
         }
-        return newExperiments;  //To change body of implemented methods use File | Settings | File Templates.
+        return newExperiments;
     }
 
-    public List<AiravataExperiment> getExperiments(String projectName, Date from, Date to) {
+    public List<AiravataExperiment> getExperiments(String projectName, Date from, Date to)throws RegistryException {
         List<AiravataExperiment> experiments = getExperiments(projectName);
         List<AiravataExperiment> newExperiments = new ArrayList<AiravataExperiment>();
         for (AiravataExperiment exp : experiments) {
@@ -535,73 +567,109 @@ public class AiravataJPARegistry extends
         return newExperiments;
     }
 
-    public void publishWorkflow(String workflowName, String publishWorkflowName) {
-        UserResource userResource = new UserResource();
-        userResource.setUserName(getUser().getUserName());
-        UserWorkflowResource resource = (UserWorkflowResource)userResource.get(ResourceType.USER_WORKFLOW, workflowName);
-        GatewayResource gatewayResource = jpa.getGateway();
-        PublishWorkflowResource resource1 = (PublishWorkflowResource)gatewayResource.create(ResourceType.PUBLISHED_WORKFLOW);
-        resource1.setContent(resource.getContent());
-        resource1.setPublishedDate(new java.sql.Date(Calendar.getInstance().getTime().getTime()));
-        resource1.setName(publishWorkflowName);
-        //todo have to set version
+    /**---------------------------------Published Workflow Registry----------------------------------
+     * @throws PublishedWorkflowAlreadyExistsException 
+     * @throws UserWorkflowDoesNotExistsException **/
+    
+    public void publishWorkflow(String workflowName, String publishWorkflowName) throws PublishedWorkflowAlreadyExistsException, UserWorkflowDoesNotExistsException {
+    	GatewayResource gateway = jpa.getGateway();
+    	String workflowGraphXML = getWorkflowGraphXML(workflowName);
+    	if (gateway.isPublishedWorkflowExists(publishWorkflowName)){
+    		throw new PublishedWorkflowAlreadyExistsException(publishWorkflowName);
+    	}
+    	PublishWorkflowResource publishedWorkflow = gateway.createPublishedWorkflow(publishWorkflowName);
+    	publishedWorkflow.setCreatedUser(getUser().getUserName());
+    	publishedWorkflow.setContent(workflowGraphXML);
+    	publishedWorkflow.setPublishedDate(new java.sql.Date(Calendar.getInstance().getTime().getTime()));
+    	publishedWorkflow.save();
     }
 
-    public void publishWorkflow(String workflowName) {
-        UserResource userResource = new UserResource();
-        userResource.setUserName(getUser().getUserName());
-        UserWorkflowResource resource = (UserWorkflowResource)userResource.get(ResourceType.USER_WORKFLOW, workflowName);
-        GatewayResource gatewayResource = jpa.getGateway();
-        PublishWorkflowResource resource1 = (PublishWorkflowResource)gatewayResource.create(ResourceType.PUBLISHED_WORKFLOW);
-        resource1.setContent(resource.getContent());
-        resource1.setPublishedDate(new java.sql.Date(Calendar.getInstance().getTime().getTime()));
-        //todo is this right ????
-        resource1.setName(workflowName);
+    public void publishWorkflow(String workflowName) throws PublishedWorkflowAlreadyExistsException, UserWorkflowDoesNotExistsException {
+    	publishWorkflow(workflowName, workflowName);
     }
 
-    public String getPublishedWorkflowGraphXML(String workflowName) {
-        GatewayResource gatewayResource = jpa.getGateway();
-        PublishWorkflowResource resource1 = (PublishWorkflowResource) gatewayResource.get(ResourceType.PUBLISHED_WORKFLOW, workflowName);
-        return resource1.getContent();
+    public String getPublishedWorkflowGraphXML(String workflowName) throws PublishedWorkflowDoesNotExistsException {
+        GatewayResource gateway = jpa.getGateway();
+        if (!gateway.isPublishedWorkflowExists(workflowName)){
+        	throw new PublishedWorkflowDoesNotExistsException(workflowName);
+        }
+        return gateway.getPublishedWorkflow(workflowName).getContent();
     }
+    
+	public List<String> getPublishedWorkflowNames() throws RegistryException{
+		GatewayResource gateway = jpa.getGateway();
+		List<String> result=new ArrayList<String>();
+    	List<PublishWorkflowResource> publishedWorkflows = gateway.getPublishedWorkflows();
+    	for (PublishWorkflowResource resource : publishedWorkflows) {
+			result.add(resource.getName());
+		}
+    	return result;
+	}
 
-    public ResourceMetadata getPublishedWorkflowMetadata(String workflowName) {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    public Map<String,String> getPublishedWorkflows() throws RegistryException{
+    	GatewayResource gateway = jpa.getGateway();
+    	Map<String,String> result=new HashMap<String, String>();
+    	List<PublishWorkflowResource> publishedWorkflows = gateway.getPublishedWorkflows();
+    	for (PublishWorkflowResource resource : publishedWorkflows) {
+			result.put(resource.getName(), resource.getContent());
+		}
+    	return result;
     }
 
-    public void removePublishedWorkflow(String workflowName) {
-        GatewayResource gatewayResource = jpa.getGateway();
-        gatewayResource.remove(ResourceType.PUBLISHED_WORKFLOW, workflowName);
+    public void removePublishedWorkflow(String workflowName) throws PublishedWorkflowDoesNotExistsException {
+        GatewayResource gateway = jpa.getGateway();
+        if (!gateway.isPublishedWorkflowExists(workflowName)){
+        	throw new PublishedWorkflowDoesNotExistsException(workflowName);
+        }
+        gateway.removePublishedWorkflow(workflowName);
+    }
+    
+    public ResourceMetadata getPublishedWorkflowMetadata(String workflowName) throws RegistryException {
+    	//TODO
+        throw new UnimplementedRegistryOperationException();
     }
 
-    public void addWorkflow(String workflowName, String workflowGraphXml) {
-        ProjectResource projectResource = new ProjectResource();
-        UserWorkflowResource resource = (UserWorkflowResource)projectResource.create(ResourceType.USER_WORKFLOW);
-        resource.setName(workflowName);
-        resource.setContent(workflowGraphXml);
-        resource.setLastUpdateDate(new java.sql.Date(Calendar.getInstance().getTime().getTime()));
-        resource.save();
+    /**---------------------------------Project Registry----------------------------------**/
+
+    public void addWorkflow(String workflowName, String workflowGraphXml) throws UserWorkflowAlreadyExistsException {
+    	WorkerResource worker = jpa.getWorker();
+		if (worker.isWorkflowTemplateExists(workflowName)){
+        	throw new UserWorkflowAlreadyExistsException(workflowName);
+        }
+		UserWorkflowResource workflowResource = worker.createWorkflowTemplate(workflowName);
+		workflowResource.setContent(workflowGraphXml);
+		workflowResource.save();
     }
 
-    public void updateWorkflow(String workflowName, String workflowGraphXml) {
-         addWorkflow(workflowName,workflowGraphXml);
+    public void updateWorkflow(String workflowName, String workflowGraphXml) throws UserWorkflowDoesNotExistsException {
+    	WorkerResource worker = jpa.getWorker();
+		if (!worker.isWorkflowTemplateExists(workflowName)){
+        	throw new UserWorkflowDoesNotExistsException(workflowName);
+        }
+		UserWorkflowResource workflowResource = worker.createWorkflowTemplate(workflowName);
+		workflowResource.setContent(workflowGraphXml);
+		workflowResource.save();
     }
 
-    public String getWorkflowGraphXML(String workflowName) {
-        GatewayResource gatewayResource = jpa.getGateway();
-        UserResource resource = (UserResource)gatewayResource.get(ResourceType.USER_WORKFLOW, getUser().getUserName());
-        UserWorkflowResource resource1 = (UserWorkflowResource) resource.get(ResourceType.USER_WORKFLOW, workflowName);
-        return resource1.getContent();
+    public String getWorkflowGraphXML(String workflowName) throws UserWorkflowDoesNotExistsException {
+    	WorkerResource worker = jpa.getWorker();
+		if (!worker.isWorkflowTemplateExists(workflowName)){
+        	throw new UserWorkflowDoesNotExistsException(workflowName);
+        }
+		return worker.getWorkflowTemplate(workflowName).getContent();
     }
 
-    public ResourceMetadata getWorkflowMetadata(String workflowName) {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    public ResourceMetadata getWorkflowMetadata(String workflowName) throws UnimplementedRegistryOperationException {
+    	//TODO
+        throw new UnimplementedRegistryOperationException();
     }
 
-    public void removeWorkflow(String workflowName) {
-        GatewayResource gatewayResource = jpa.getGateway();
-        UserResource resource = (UserResource)gatewayResource.get(ResourceType.USER_WORKFLOW, getUser().getUserName());
-        resource.remove(ResourceType.USER_WORKFLOW, workflowName);
+    public void removeWorkflow(String workflowName) throws UserWorkflowDoesNotExistsException {
+    	WorkerResource worker = jpa.getWorker();
+		if (!worker.isWorkflowTemplateExists(workflowName)){
+        	throw new UserWorkflowDoesNotExistsException(workflowName);
+        }
+		worker.removeWorkflowTemplate(workflowName);
     }
 
     public void setAiravataRegistry(AiravataRegistry2 registry) {

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java?rev=1382340&r1=1382339&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationDescriptorResource.java Sat Sep  8 18:40:10 2012
@@ -35,7 +35,11 @@ public class ApplicationDescriptorResour
     private String content;
     private String hostDescName;
     private String serviceDescName;
-
+    
+    public ApplicationDescriptorResource(String name) {
+        this.setName(name);
+    }
+    
     public ApplicationDescriptorResource(String name, String gatewayName, String hostDescName, String serviceDescName) {
         this.setName(name);
         this.gatewayName = gatewayName;

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java?rev=1382340&r1=1382339&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java Sat Sep  8 18:40:10 2012
@@ -20,33 +20,35 @@
 */
 package org.apache.airavata.persistance.registry.jpa.resources;
 
+import java.sql.Date;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Query;
+
 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.Users;
 
-import javax.persistence.Query;
-import java.sql.Date;
-import java.util.ArrayList;
-import java.util.List;
-
 public class ExperimentResource extends AbstractResource {
-    private int projectID;
-    private String userName;
+    private WorkerResource worker;
     private String expID;
     private Date submittedDate;
-    private String gatewayName;
+    private GatewayResource gateway;
+    private ProjectResource project;
 
     public ExperimentResource() {
     }
 
     public ExperimentResource(String expID) {
-        this.expID = expID;
+        this.setExpID(expID);
     }
 
     public int getProjectID() {
-        return projectID;
+        return project.getId();
     }
 
     public String getExpID() {
@@ -57,30 +59,10 @@ public class ExperimentResource extends 
         return submittedDate;
     }
 
-    public void setProjectID(int projectID) {
-        this.projectID = projectID;
-    }
-
-    public String getUserName() {
-        return userName;
-    }
-
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
-
     public void setSubmittedDate(Date submittedDate) {
         this.submittedDate = submittedDate;
     }
 
-    public String getGatewayName() {
-        return gatewayName;
-    }
-
-    public void setGatewayName(String gatewayName) {
-        this.gatewayName = gatewayName;
-    }
-
     public Resource create(ResourceType type) {
         throw new UnsupportedOperationException();
     }
@@ -109,8 +91,13 @@ public class ExperimentResource extends 
         q.setParameter("exp_ID", keys[0]);
         Experiment experiment = (Experiment)q.getSingleResult();
         ExperimentResource experimentResource = new ExperimentResource(experiment.getExperiment_ID());
-        experimentResource.setUserName(experiment.getUser().getUser_name());
-        experimentResource.setProjectID(experiment.getProject().getProject_ID());
+        experimentResource.setGateway(getGateway());
+        experimentResource.setWorker(getWorker());
+        ProjectResource projectResource = new ProjectResource(experiment.getProject().getProject_ID());
+        projectResource.setGateway(getGateway());
+        projectResource.setWorker(getWorker());
+        projectResource.setName(experiment.getProject().getProject_name());
+        experimentResource.setProject(projectResource);
         experimentResource.setSubmittedDate(experiment.getSubmitted_date());
         end();
         list.add(experimentResource);
@@ -125,13 +112,16 @@ public class ExperimentResource extends 
     public void save() {
         begin();
         Experiment experiment = new Experiment();
-        experiment.setExperiment_ID(expID);
+        experiment.setExperiment_ID(getExpID());
         Project project = new Project();
-        project.setProject_ID(projectID);
+        project.setProject_ID(this.project.getId());
         experiment.setProject(project);
         Users user = new Users();
-        user.setUser_name(userName);
+        user.setUser_name(getWorker().getUser());
         experiment.setUser(user);
+        Gateway gateway = new Gateway();
+        gateway.setGateway_name(getGateway().getGatewayName());
+		experiment.setGateway(gateway);
         experiment.setSubmitted_date(submittedDate);
         em.persist(experiment);
         end();
@@ -139,11 +129,35 @@ public class ExperimentResource extends 
 
     }
 
-    public void save(boolean isAppendable) {
-
-    }
-
     public boolean isExists(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
+
+	public void setExpID(String expID) {
+		this.expID = expID;
+	}
+
+	public GatewayResource getGateway() {
+		return gateway;
+	}
+
+	public void setGateway(GatewayResource gateway) {
+		this.gateway = gateway;
+	}
+
+	public WorkerResource getWorker() {
+		return worker;
+	}
+
+	public void setWorker(WorkerResource worker) {
+		this.worker = worker;
+	}
+
+	public ProjectResource getProject() {
+		return project;
+	}
+
+	public void setProject(ProjectResource project) {
+		this.project = project;
+	}
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java?rev=1382340&r1=1382339&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java Sat Sep  8 18:40:10 2012
@@ -40,6 +40,13 @@ public class GatewayResource extends Abs
     private String gatewayName;
     private String owner;
 
+    public GatewayResource(String gatewayName) {
+    	setGatewayName(gatewayName);
+	}
+    
+    public GatewayResource() {
+	}
+    
     public String getGatewayName() {
         return gatewayName;
     }
@@ -59,19 +66,19 @@ public class GatewayResource extends Abs
     public Resource create(ResourceType type) {
         if (type == ResourceType.PROJECT) {
             ProjectResource projectResource = new ProjectResource();
-            projectResource.setGatewayName(gatewayName);
+            projectResource.setGateway(this);
             return projectResource;
         } else if (type == ResourceType.USER) {
             UserResource userResource = new UserResource();
-            userResource.setGatewayName(gatewayName);
+            userResource.setGatewayName(this.getGatewayName());
             return userResource;
         } else if (type == ResourceType.PUBLISHED_WORKFLOW) {
             PublishWorkflowResource publishWorkflowResource = new PublishWorkflowResource();
-            publishWorkflowResource.setGatewayName(gatewayName);
+            publishWorkflowResource.setGateway(this);
             return publishWorkflowResource;
         }else if(type == ResourceType.USER_WORKFLOW){
             UserWorkflowResource userWorkflowResource = new UserWorkflowResource();
-            userWorkflowResource.setGatewayname(gatewayName);
+            userWorkflowResource.setGateway(this);
             return userWorkflowResource;
         }else if (type == ResourceType.HOST_DESCRIPTOR) {
             HostDescriptorResource hostDescriptorResource = new HostDescriptorResource();
@@ -87,7 +94,7 @@ public class GatewayResource extends Abs
             return applicationDescriptorResource;
         } else if(type == ResourceType.EXPERIMENT){
             ExperimentResource experimentResource =new ExperimentResource();
-            experimentResource.setGatewayName(gatewayName);
+            experimentResource.setGateway(this);
             return experimentResource;
         }else {
             return null;
@@ -153,7 +160,7 @@ public class GatewayResource extends Abs
 //            end();
 //            return projectResource;
 //        } else
-            if (type == ResourceType.USER) {
+        if (type == ResourceType.USER) {
             Query q = em.createQuery("SELECT p FROM Gateway_Worker p WHERE p.user_name = :username and p.gateway_name =:gate_name");
             q.setParameter("username", name);
             q.setParameter("gate_name", gatewayName);
@@ -168,7 +175,8 @@ public class GatewayResource extends Abs
             q.setParameter("pub_workflow_name", name);
             q.setParameter("gate_name", gatewayName);
             Published_Workflow ePub_workflow = (Published_Workflow) q.getSingleResult();
-            PublishWorkflowResource publishWorkflowResource = new PublishWorkflowResource(ePub_workflow.getPublish_workflow_name());
+            PublishWorkflowResource publishWorkflowResource = new PublishWorkflowResource(this);
+            publishWorkflowResource.setName(ePub_workflow.getPublish_workflow_name());
             publishWorkflowResource.setContent(ePub_workflow.getWorkflow_content());
             publishWorkflowResource.setPublishedDate(ePub_workflow.getPublished_date());
             publishWorkflowResource.setVersion(ePub_workflow.getVersion());
@@ -194,27 +202,26 @@ public class GatewayResource extends Abs
             hostDescriptorResource.setContent(eHostDesc.getHost_descriptor_xml());
             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_name =:gate_name");
-//            q.setParameter("app_desc_id", name);
-//            q.setParameter("gate_name", gatewayName);
-//            Application_Descriptor eappDesc = (Application_Descriptor) q.getSingleResult();
-//            ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(eappDesc.getApplication_descriptor_ID());
-//            applicationDescriptorResource.setGatewayName(eappDesc.getGateway().getGateway_name());
-//            applicationDescriptorResource.setContent(eappDesc.getApplication_descriptor_xml());
-//            applicationDescriptorResource.setHostDescName(eappDesc.getHost_descriptor_ID());
-//            applicationDescriptorResource.setServiceDescName(eappDesc.getService_descriptor_ID());
-//            end();
-//            return applicationDescriptorResource;
+        } 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_name =:gate_name");
+            q.setParameter("app_desc_id", name);
+            q.setParameter("gate_name", gatewayName);
+            Application_Descriptor eappDesc = (Application_Descriptor) q.getSingleResult();
+            ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(eappDesc.getApplication_descriptor_ID());
+            applicationDescriptorResource.setGatewayName(eappDesc.getGateway().getGateway_name());
+            applicationDescriptorResource.setContent(eappDesc.getApplication_descriptor_xml());
+            applicationDescriptorResource.setHostDescName(eappDesc.getHost_descriptor_ID());
+            applicationDescriptorResource.setServiceDescName(eappDesc.getService_descriptor_ID());
+            end();
+            return applicationDescriptorResource;
         } else if(type == ResourceType.EXPERIMENT){
             Query q = em.createQuery("SELECT p FROM Experiment p WHERE p.experiment_ID = :ex_ID and p.gateway_name =:gate_name");
             q.setParameter("ex_ID", name);
             q.setParameter("gate_name", gatewayName);
             Experiment experiment = (Experiment)q.getSingleResult();
             ExperimentResource experimentResource = new ExperimentResource(experiment.getExperiment_ID());
-            experimentResource.setUserName(experiment.getUser().getUser_name());
-            experimentResource.setGatewayName(gatewayName);
+            experimentResource.setWorker(new WorkerResource(experiment.getUser().getUser_name(),this));
+            experimentResource.setGateway(this);
             experimentResource.setSubmittedDate(experiment.getSubmitted_date());
             return experimentResource;
         } else {
@@ -237,7 +244,7 @@ public class GatewayResource extends Abs
                 for (Object result : results) {
                     Project project = (Project) result;
                     ProjectResource projectResource = new ProjectResource(project.getProject_ID());
-                    projectResource.setGatewayName(gatewayName);
+                    projectResource.setGateway(this);
                     projectResource.setName(project.getProject_name());
                     resourceList.add(projectResource);
                 }
@@ -260,12 +267,12 @@ public class GatewayResource extends Abs
         else if (type == ResourceType.PUBLISHED_WORKFLOW) {
             Query q = em.createQuery("SELECT p FROM Published_Workflow p WHERE p.gateway_name =:gate_name");
             q.setParameter("gate_name", gatewayName);
-            List results = q.getResultList();
+            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.setGatewayName(gatewayName);
+                    PublishWorkflowResource publishWorkflowResource = new PublishWorkflowResource(this);
+                    publishWorkflowResource.setName(publishedWorkflow.getPublish_workflow_name());
                     publishWorkflowResource.setContent(publishedWorkflow.getWorkflow_content());
                     publishWorkflowResource.setPublishedDate(publishedWorkflow.getPublished_date());
                     publishWorkflowResource.setVersion(publishedWorkflow.getVersion());
@@ -320,10 +327,12 @@ public class GatewayResource extends Abs
                 for (Object result : results) {
                     Experiment experiment = (Experiment) result;
                     ExperimentResource experimentResource = new ExperimentResource(experiment.getExperiment_ID());
-                    experimentResource.setGatewayName(gatewayName);
-                    experimentResource.setUserName(experiment.getUser().getUser_name());
+                    experimentResource.setGateway(this);
+                    experimentResource.setWorker(new WorkerResource(experiment.getUser().getUser_name(),this));
                     experimentResource.setSubmittedDate(experiment.getSubmitted_date());
-                    experimentResource.setProjectID(experiment.getProject().getProject_ID());
+                    ProjectResource project = new ProjectResource(experimentResource.getWorker(),this,experiment.getProject().getProject_ID());
+                    project.setName(experiment.getProject().getProject_name());
+					experimentResource.setProject(project);
                     resourceList.add(experimentResource);
                 }
             }
@@ -506,5 +515,34 @@ public class GatewayResource extends Abs
         end();
         return resourceList;
     }
+    
+    public boolean isPublishedWorkflowExists(String workflowTemplateName){
+    	return isExists(ResourceType.PUBLISHED_WORKFLOW, workflowTemplateName);
+    }
+    
+    public PublishWorkflowResource createPublishedWorkflow(String workflowTemplateName){
+    	PublishWorkflowResource publishedWorkflowResource = (PublishWorkflowResource)create(ResourceType.PUBLISHED_WORKFLOW);
+    	publishedWorkflowResource.setName(workflowTemplateName);
+    	publishedWorkflowResource.setPath("/");
+    	publishedWorkflowResource.setVersion("1.0");
+    	return publishedWorkflowResource;
+    }
+    
+    public PublishWorkflowResource getPublishedWorkflow(String workflowTemplateName){
+    	return (PublishWorkflowResource)get(ResourceType.PUBLISHED_WORKFLOW,workflowTemplateName);
+    }
+    
+    public List<PublishWorkflowResource> getPublishedWorkflows(){
+    	List<PublishWorkflowResource> result=new ArrayList<PublishWorkflowResource>();
+    	List<Resource> list = get(ResourceType.PUBLISHED_WORKFLOW);
+    	for (Resource resource : list) {
+			result.add((PublishWorkflowResource) resource);
+		}
+    	return result;
+    }
+    
+    public void removePublishedWorkflow(String workflowTemplateName){
+    	remove(ResourceType.PUBLISHED_WORKFLOW, workflowTemplateName);
+    }
 }
 

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java?rev=1382340&r1=1382339&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java Sat Sep  8 18:40:10 2012
@@ -54,8 +54,9 @@ public class ProjectResource extends Abs
     public Resource create(ResourceType type) {
         if (type == ResourceType.EXPERIMENT) {
             ExperimentResource experimentResource = new ExperimentResource();
+            experimentResource.setGateway(getGateway());
             experimentResource.setProjectID(id);
-            experimentResource.setUserName(getWorker().getUser());
+            experimentResource.setWorker(getWorker());
             return experimentResource;
         } else {
             return null;
@@ -88,8 +89,9 @@ public class ProjectResource extends Abs
             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());
+            experimentResource.setWorker(getWorker());
+            experimentResource.setGateway(getGateway());
+            experimentResource.setSubmittedDate(experiment.getSubmitted_date());
             end();
             return experimentResource;
         }
@@ -121,13 +123,14 @@ public class ProjectResource extends Abs
         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();
+            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.setUserName(experiment.getUser().getUser_name());
+                    experimentResource.setGateway(new GatewayResource(experiment.getGateway().getGateway_name()));
+                    experimentResource.setWorker(new WorkerResource(experiment.getUser().getUser_name(), experimentResource.getGateway()));
                     experimentResource.setSubmittedDate(experiment.getSubmitted_date());
                     resourceList.add(experimentResource);
                 }
@@ -180,5 +183,31 @@ public class ProjectResource extends Abs
 		this.gateway = gateway;
 	}
 
+	public boolean isExperimentExists(String experimentId){
+		return isExists(ResourceType.EXPERIMENT, experimentId);
+	}
+	
+	public ExperimentResource createExperiment(String experimentId){
+		ExperimentResource experimentResource = (ExperimentResource)create(ResourceType.EXPERIMENT);
+		experimentResource.setExpID(experimentId);
+		return experimentResource;
+	}
+	
+	public ExperimentResource getExperiment(String experimentId){
+		return (ExperimentResource)get(ResourceType.EXPERIMENT,experimentId);
+	}
+	
+	public List<ExperimentResource> getExperiments(){
+		List<Resource> list = get(ResourceType.EXPERIMENT);
+		List<ExperimentResource> result=new ArrayList<ExperimentResource>();
+		for (Resource resource : list) {
+			result.add((ExperimentResource) resource);
+		}
+		return result;
+	}
+	
+	public void removeExperiment(String experimentId){
+		remove(ResourceType.EXPERIMENT, experimentId);
+	}
 
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java?rev=1382340&r1=1382339&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/PublishWorkflowResource.java Sat Sep  8 18:40:10 2012
@@ -35,15 +35,15 @@ public class PublishWorkflowResource ext
     private String version;
     private Date publishedDate;
     private String content;
-    private String gatewayName;
+    private GatewayResource gateway;
     private String createdUser;
     private String path;
 
     public PublishWorkflowResource() {
     }
 
-    public PublishWorkflowResource(String name) {
-        this.name = name;
+    public PublishWorkflowResource(GatewayResource gateway) {
+        this.gateway = gateway;
     }
 
     public String getCreatedUser() {
@@ -90,14 +90,6 @@ public class PublishWorkflowResource ext
         this.content = content;
     }
 
-    public String getGatewayName() {
-        return gatewayName;
-    }
-
-    public void setGatewayName(String gatewayName) {
-        this.gatewayName = gatewayName;
-    }
-
     public Resource create(ResourceType type) {
         throw new UnsupportedOperationException();
     }
@@ -122,7 +114,7 @@ public class PublishWorkflowResource ext
         q.setParameter("pub_wf_name", keys[1]);
         Published_Workflow publishedWorkflow = (Published_Workflow)q.getSingleResult();
         PublishWorkflowResource publishWorkflowResource = new PublishWorkflowResource();
-        publishWorkflowResource.setGatewayName(publishedWorkflow.getGateway().getGateway_name());
+        publishWorkflowResource.setGateway(new GatewayResource(publishedWorkflow.getGateway().getGateway_name()));
         publishWorkflowResource.setContent(publishedWorkflow.getWorkflow_content());
         publishWorkflowResource.setPublishedDate(publishedWorkflow.getPublished_date());
         publishWorkflowResource.setVersion(publishedWorkflow.getVersion());
@@ -138,12 +130,12 @@ public class PublishWorkflowResource ext
     public void save() {
         begin();
         Published_Workflow publishedWorkflow = new Published_Workflow();
-        publishedWorkflow.setPublish_workflow_name(name);
+        publishedWorkflow.setPublish_workflow_name(getName());
         publishedWorkflow.setPublished_date(publishedDate);
         publishedWorkflow.setVersion(version);
         publishedWorkflow.setWorkflow_content(content);
         Gateway gateway = new Gateway();
-        gateway.setGateway_name(gatewayName);
+        gateway.setGateway_name(this.gateway.getGatewayName());
         publishedWorkflow.setGateway(gateway);
         em.persist(gateway);
         end();
@@ -156,4 +148,16 @@ public class PublishWorkflowResource ext
     public boolean isExists(ResourceType type, Object name) {
         throw new UnsupportedOperationException();
     }
+
+	public GatewayResource getGateway() {
+		return gateway;
+	}
+
+	public void setGateway(GatewayResource gateway) {
+		this.gateway = gateway;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
 }

Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java?rev=1382340&r1=1382339&r2=1382340&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java Sat Sep  8 18:40:10 2012
@@ -28,6 +28,7 @@ import javax.persistence.Query;
 
 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.User_Workflow;
 
@@ -79,6 +80,12 @@ public class WorkerResource extends Abst
 	            q.setParameter("gate_name", gateway.getGatewayName());
 	            q.executeUpdate();
 	            break;
+			case EXPERIMENT:
+	            q = em.createQuery("Delete p FROM Experiment p WHERE p.user_name = :usr_name and p.experiment_ID = :ex_name");
+	            q.setParameter("usr_name", getUser());
+	            q.setParameter("ex_name", name);
+	            q.executeUpdate();
+	            break;
 			default:
 				break;
 		}
@@ -116,6 +123,23 @@ public class WorkerResource extends Abst
 	            userWorkflowResource.setLastUpdateDate(userWorkflow.getLast_updated_date());
 	            result=userWorkflowResource;
 	            break;
+			case EXPERIMENT:
+				q = em.createQuery("SELECT p FROM Experiment p WHERE p.gateway_name = :gateway_name and p.user_name = :usr_name and p.experiment_ID = :ex_name");
+	            q.setParameter("usr_name", getUser());
+	            q.setParameter("ex_name", name);
+	            q.setParameter("gateway_name", gateway.getGatewayName());
+	            Experiment experiment = (Experiment) q.getSingleResult();
+	            ExperimentResource experimentResource = new ExperimentResource(experiment.getExperiment_ID());
+	            ProjectResource projectResource1 = new ProjectResource(experiment.getProject().getProject_ID());
+                projectResource1.setGateway(gateway);
+                projectResource1.setWorker(this);
+                projectResource1.setName(experiment.getProject().getProject_name());
+            	experimentResource.setProject(projectResource1);
+	            experimentResource.setWorker(this);
+	            experimentResource.setGateway(gateway);
+	            experimentResource.setSubmittedDate(experiment.getSubmitted_date());
+	            result=experimentResource;
+				break;
 			default:
 				break;
 		}
@@ -145,9 +169,8 @@ public class WorkerResource extends Abst
 				}
 				break;
 			case USER_WORKFLOW:
-				q = em.createQuery("SELECT p FROM User_Workflow p WHERE p.owner = :usr_name and p.gateway_name =:gate_name");
-	            q.setParameter("user_name", getUser());
-	            q.setParameter("gate_name", gateway.getGatewayName());
+				q = em.createQuery("SELECT p FROM Experiment p WHERE p.project_ID = :proj_id and p.user_name = :usr_name and p.experiment_ID = :ex_name");
+	            q.setParameter("usr_name", getUser());
 	            for (Object o : q.getResultList()) {
 		            User_Workflow userWorkflow = (User_Workflow) o;
 		            UserWorkflowResource userWorkflowResource = new UserWorkflowResource(gateway, this, userWorkflow.getTemplate_name());
@@ -156,6 +179,24 @@ public class WorkerResource extends Abst
 		            result.add(userWorkflowResource);
 	            }
 	            break;
+			case EXPERIMENT:
+				q = em.createQuery("SELECT p FROM Experiment p WHERE p.gateway_name = :gateway_name and p.user_name = :usr_name and p.experiment_ID = :ex_name");
+	            q.setParameter("usr_name", getUser());
+	            q.setParameter("gateway_name", gateway.getGatewayName());
+	            for (Object o : q.getResultList()) {
+	            	Experiment experiment = (Experiment) o;
+	            	ExperimentResource experimentResource = new ExperimentResource(experiment.getExperiment_ID());
+	            	experimentResource.setGateway(gateway);
+	            	experimentResource.setWorker(this);
+	            	ProjectResource projectResource = new ProjectResource(experiment.getProject().getProject_ID());
+	                projectResource.setGateway(gateway);
+	                projectResource.setWorker(this);
+	                projectResource.setName(experiment.getProject().getProject_name());
+	            	experimentResource.setProject(projectResource);
+	            	experimentResource.setSubmittedDate(experiment.getSubmitted_date());
+		            result.add(experimentResource);
+	            }
+	            break;
 			default:
 				break;
 		}
@@ -176,4 +217,79 @@ public class WorkerResource extends Abst
 		this.user = user;
 	}
 
+	
+	public boolean isProjectExists(String name){
+		return isExists(ResourceType.PROJECT, name);
+	}
+	
+	public ProjectResource createProject(String name){
+		ProjectResource project=(ProjectResource)create(ResourceType.PROJECT);
+		project.setName(name);
+		return project;
+	}
+	
+	public ProjectResource getProject(String name){
+		return (ProjectResource)get(ResourceType.PROJECT, name);
+	}
+	
+	public void removeProject(String name){
+		remove(ResourceType.PROJECT, name);
+	}
+	
+	public List<ProjectResource> getProjects(){
+		List<ProjectResource> result=new ArrayList<ProjectResource>();
+		List<Resource> list = get(ResourceType.PROJECT);
+		for (Resource resource : list) {
+			result.add((ProjectResource) resource);
+		}
+		return result;
+	}
+	
+	public boolean isWorkflowTemplateExists(String templateName){
+		return isExists(ResourceType.USER_WORKFLOW, templateName);
+	}
+	
+	public UserWorkflowResource createWorkflowTemplate(String templateName){
+		UserWorkflowResource workflow=(UserWorkflowResource)create(ResourceType.USER_WORKFLOW);
+		workflow.setName(templateName);
+		return workflow;
+	}
+	
+	public UserWorkflowResource getWorkflowTemplate(String templateName){
+		return (UserWorkflowResource)get(ResourceType.USER_WORKFLOW, templateName);
+	}
+	
+	public void removeWorkflowTemplate(String templateName){
+		remove(ResourceType.USER_WORKFLOW, templateName);
+	}
+	
+	public List<UserWorkflowResource> getWorkflowTemplates(){
+		List<UserWorkflowResource> result=new ArrayList<UserWorkflowResource>();
+		List<Resource> list = get(ResourceType.USER_WORKFLOW);
+		for (Resource resource : list) {
+			result.add((UserWorkflowResource) resource);
+		}
+		return result;
+	}
+	
+	public boolean isExperimentExists(String name){
+		return isExists(ResourceType.EXPERIMENT, name);
+	}
+	
+	public ExperimentResource getExperiment(String name){
+		return (ExperimentResource)get(ResourceType.EXPERIMENT, name);
+	}
+	
+	public List<ExperimentResource> getExperiments(){
+		List<ExperimentResource> result=new ArrayList<ExperimentResource>();
+		List<Resource> list = get(ResourceType.EXPERIMENT);
+		for (Resource resource : list) {
+			result.add((ExperimentResource) resource);
+		}
+		return result;
+	}
+	
+	public void removeExperiment(String experimentId){
+		remove(ResourceType.EXPERIMENT, experimentId);
+	}
 }



Mime
View raw message