You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2012/09/07 21:48:53 UTC
svn commit: r1382136 [1/2] - in /incubator/airavata/trunk/modules: commons/
commons/registry-api/src/main/java/org/apache/airavata/registry/api/
registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/
registry/airavat...
Author: samindaw
Date: Fri Sep 7 19:48:52 2012
New Revision: 1382136
URL: http://svn.apache.org/viewvc?rev=1382136&view=rev
Log:
https://issues.apache.org/jira/secure/attachment/12544271/AIRAVATA-562.6.patch + refactoring
Added:
incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAResourceAccessor.java (with props)
Modified:
incubator/airavata/trunk/modules/commons/pom.xml
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/AiravataRegistry2.java
incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java
incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.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/model/Application_Descriptor.java
incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java
incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java
incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java
incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java
incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java
incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java
incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.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/ConfigurationResource.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/HostDescriptorResource.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/ServiceDescriptorResource.java
incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java
incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserWorkflowResource.java
incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/resources/data.sql
Modified: incubator/airavata/trunk/modules/commons/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/pom.xml?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/pom.xml (original)
+++ incubator/airavata/trunk/modules/commons/pom.xml Fri Sep 7 19:48:52 2012
@@ -29,12 +29,12 @@
<activeByDefault>true</activeByDefault>
</activation>
<modules>
- <module>workflow-tracking</module>
- <module>gfac-schema</module>
+ <!--module>workflow-tracking</module>
+ <module>gfac-schema</module-->
<module>utils</module>
<module>common-registry-api</module>
<module>registry-api</module>
- <module>workflow-execution-context</module>
+ <!--module>workflow-execution-context</module-->
<module>provenance-registry</module>
</modules>
</profile>
Modified: 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/AiravataProvenanceRegistry.java?rev=1382136&r1=1382135&r2=1382136&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/AiravataProvenanceRegistry.java Fri Sep 7 19:48:52 2012
@@ -28,12 +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 abstract class AiravataProvenanceRegistry implements DataRegistry{
- private String user;
-
- public AiravataProvenanceRegistry(String user) {
- setUser(user);
- }
+public interface AiravataProvenanceRegistry extends AiravataSubRegistry{
/*------------------------------------------- Experiment data ---------------------------------------------*/
/**
@@ -278,12 +273,4 @@ public abstract class AiravataProvenance
* @return
*/
public abstract boolean saveWorkflowNodeGramLocalJobID(String workflowInstanceID,String workflowNodeID,String localJobID)throws RegistryException;
-
- public String getUser() {
- return user;
- }
-
- public void setUser(String user) {
- this.user = user;
- }
}
\ No newline at end of file
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=1382136&r1=1382135&r2=1382136&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 Fri Sep 7 19:48:52 2012
@@ -22,7 +22,7 @@
package org.apache.airavata.registry.api;
-public abstract class AiravataRegistry2 implements DescriptorRegistry, ProjectsRegistry, PublishedWorkflowRegistry, UserWorkflowRegistry, ConfigurationRegistry{
+public abstract class AiravataRegistry2 implements DescriptorRegistry, ProjectsRegistry, PublishedWorkflowRegistry, UserWorkflowRegistry, ConfigurationRegistry, AiravataProvenanceRegistry{
private Gateway gateway;
private AiravataUser user;
Added: 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=1382136&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAResourceAccessor.java (added)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAResourceAccessor.java Fri Sep 7 19:48:52 2012
@@ -0,0 +1,52 @@
+/*
+ *
+ * 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;
+
+import org.apache.airavata.persistance.registry.jpa.resources.ConfigurationResource;
+import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.resources.ProjectResource;
+import org.apache.airavata.registry.api.AiravataRegistry2;
+
+public class JPAResourceAccessor {
+ private AiravataRegistry2 registry=null;
+ private GatewayResource gatewayResource;
+
+ public JPAResourceAccessor(AiravataRegistry2 registry) {
+ this.registry=registry;
+ gatewayResource = new GatewayResource();
+ gatewayResource.setGatewayName(this.registry.getGateway().getGatewayName());
+ }
+
+ 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 ConfigurationResource getConfiguration(String key){
+ new ConfigurationResource(configID)
+ }
+}
Propchange: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAResourceAccessor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java Fri Sep 7 19:48:52 2012
@@ -27,8 +27,18 @@ public interface Resource {
void remove(ResourceType type, Object name);
+ void removeMe(Object[] keys);
+
Resource get(ResourceType type, Object name);
+ /**
+ *
+ *
+ * @param keys
+ * @return
+ */
+ List<Resource> getMe(Object[] keys);
+
List<Resource> get(ResourceType type);
void save();
Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java Fri Sep 7 19:48:52 2012
@@ -20,9 +20,11 @@
*/
package org.apache.airavata.persistance.registry.jpa;
+import org.apache.airavata.persistance.registry.jpa.model.Configuration;
import org.apache.airavata.persistance.registry.jpa.model.Gateway;
import org.apache.airavata.persistance.registry.jpa.model.Gateway_Worker;
import org.apache.airavata.persistance.registry.jpa.model.Users;
+import org.apache.airavata.persistance.registry.jpa.resources.ConfigurationResource;
import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
@@ -30,6 +32,8 @@ import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
public class ResourceUtils {
private static final String PERSISTENCE_UNIT_NAME = "airavata_data";
@@ -107,6 +111,7 @@ public class ResourceUtils {
q.setParameter("gate_name", gatewayResource.getGatewayName());
q.setParameter("usr_name", userResource.getUserName());
q.executeUpdate();
+ em.getTransaction().commit();
em.close();
return true;
} catch (Exception e){
@@ -115,4 +120,31 @@ public class ResourceUtils {
}
}
+
+ public static List<ConfigurationResource> getConfigurations (String configKey){
+ List<ConfigurationResource> list = new ArrayList<ConfigurationResource>();
+ factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
+ em = factory.createEntityManager();
+ em.getTransaction().begin();
+ Query q = em.createQuery("SELECT p FROM Configuration p WHERE p.config_key = :confKey");
+ q.setParameter("confKey", configKey);
+ List resultList = q.getResultList();
+ if (resultList.size() != 0) {
+ for (Object result : resultList) {
+ Configuration configuration = (Configuration) result;
+ ConfigurationResource configurationResource = new ConfigurationResource();
+ configurationResource.setConfigKey(configuration.getConfig_key());
+ configurationResource.setConfigVal(configuration.getConfig_val());
+ configurationResource.setExpireDate(configuration.getExpire_date());
+ list.add(configurationResource);
+ }
+ }
+ em.getTransaction().commit();
+ em.close();
+ return list;
+ }
+
+ public static void removeConfiguration(String configkey, String configValue){
+
+ }
}
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=1382136&r1=1382135&r2=1382136&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 Fri Sep 7 19:48:52 2012
@@ -20,39 +20,65 @@
*/
package org.apache.airavata.persistance.registry.jpa.impl;
-import com.sun.jndi.dns.ResourceRecord;
+import java.net.URI;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Query;
+
+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.model.Configuration;
-import org.apache.airavata.persistance.registry.jpa.model.Host_Descriptor;
-import org.apache.airavata.persistance.registry.jpa.resources.*;
-import org.apache.airavata.registry.api.*;
+import org.apache.airavata.persistance.registry.jpa.resources.ApplicationDescriptorResource;
+import org.apache.airavata.persistance.registry.jpa.resources.ExperimentResource;
+import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.resources.HostDescriptorResource;
+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.registry.api.AiravataExperiment;
+import org.apache.airavata.registry.api.AiravataRegistry2;
+import org.apache.airavata.registry.api.AiravataUser;
+import org.apache.airavata.registry.api.ResourceMetadata;
+import org.apache.airavata.registry.api.WorkspaceProject;
+import org.apache.airavata.registry.api.workflow.WorkflowExecution;
+import org.apache.airavata.registry.api.workflow.WorkflowIOData;
+import org.apache.airavata.registry.api.workflow.WorkflowInstanceStatus;
+import org.apache.airavata.registry.api.workflow.WorkflowInstanceStatus.ExecutionStatus;
+import org.apache.airavata.registry.api.workflow.WorkflowNodeGramData;
+import org.apache.airavata.registry.api.workflow.WorkflowRunTimeData;
+import org.apache.airavata.registry.api.workflow.WorkflowServiceIOData;
import org.apache.xmlbeans.XmlException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Query;
-import java.net.URI;
-import java.sql.*;
-import java.util.*;
-import java.util.Date;
-
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() {
-
+ jpa = new JPAResourceAccessor(this);
}
+ /**---------------------------------Configuration Registry----------------------------------**/
+
public Object getConfiguration(String key) {
EntityManager em = factory.createEntityManager();
em.getTransaction().begin();
@@ -193,7 +219,7 @@ public class AiravataJPARegistry extends
// DescriptorRegistry Implementation
public void addHostDescriptor(HostDescription descriptor) {
//todo how to fill other data
- GatewayResource gatewayResource = new GatewayResource();
+ GatewayResource gatewayResource = jpa.getGateway();
HostDescriptorResource resource = (HostDescriptorResource)gatewayResource.create(ResourceType.HOST_DESCRIPTOR);
resource.setContent(descriptor.toXML());
//todo fix the IDs to Names
@@ -207,7 +233,7 @@ public class AiravataJPARegistry extends
}
public HostDescription getHostDescriptor(String hostName) {
- GatewayResource gatewayResource = new GatewayResource();
+ GatewayResource gatewayResource = jpa.getGateway();
Resource resource = gatewayResource.get(ResourceType.HOST_DESCRIPTOR, hostName);
try {
return HostDescription.fromXML(((HostDescriptorResource)resource).getContent());
@@ -218,7 +244,7 @@ public class AiravataJPARegistry extends
}
public void removeHostDescriptor(String hostName) {
- GatewayResource gatewayResource = new GatewayResource();
+ GatewayResource gatewayResource = jpa.getGateway();
gatewayResource.remove(ResourceType.HOST_DESCRIPTOR, hostName);
}
@@ -228,7 +254,7 @@ public class AiravataJPARegistry extends
public void addServiceDescriptor(ServiceDescription descriptor) {
//todo how to fill other data
- GatewayResource gatewayResource = new GatewayResource();
+ GatewayResource gatewayResource = jpa.getGateway();
ServiceDescriptorResource resource = (ServiceDescriptorResource)gatewayResource.create(ResourceType.SERVICE_DESCRIPTOR);
resource.setContent(descriptor.toXML());
//todo fix the IDs to Names
@@ -242,7 +268,7 @@ public class AiravataJPARegistry extends
}
public ServiceDescription getServiceDescriptor(String serviceName) {
- GatewayResource gatewayResource = new GatewayResource();
+ GatewayResource gatewayResource = jpa.getGateway();
Resource resource = gatewayResource.get(ResourceType.SERVICE_DESCRIPTOR, serviceName);
try {
return ServiceDescription.fromXML(((ServiceDescriptorResource) resource).getContent());
@@ -253,7 +279,7 @@ public class AiravataJPARegistry extends
}
public void removeServiceDescriptor(String serviceName) {
- GatewayResource gatewayResource = new GatewayResource();
+ GatewayResource gatewayResource = jpa.getGateway();
gatewayResource.remove(ResourceType.SERVICE_DESCRIPTOR, serviceName);
}
@@ -266,7 +292,7 @@ public class AiravataJPARegistry extends
}
public void addApplicationDescriptor(String serviceName, String hostName, ApplicationDeploymentDescription descriptor) {
- GatewayResource gatewayResource = new GatewayResource();
+ GatewayResource gatewayResource = jpa.getGateway();
ApplicationDescriptorResource resource = (ApplicationDescriptorResource)gatewayResource.create(ResourceType.APPLICATION_DESCRIPTOR);
resource.setContent(descriptor.toXML());
resource.setHostDescName(hostName);
@@ -288,7 +314,7 @@ public class AiravataJPARegistry extends
public ApplicationDeploymentDescription getApplicationDescriptors(String serviceName, String hostname) {
//todo finish implementation
- GatewayResource gatewayResource = new GatewayResource();
+ GatewayResource gatewayResource = jpa.getGateway();
ApplicationDescriptorResource resource = (ApplicationDescriptorResource)gatewayResource.create(ResourceType.APPLICATION_DESCRIPTOR);
resource.setHostDescName(hostname);
resource.setServiceDescName(serviceName);
@@ -298,7 +324,7 @@ public class AiravataJPARegistry extends
}
public Map<String, ApplicationDeploymentDescription> getApplicationDescriptors(String serviceName) {
- GatewayResource gatewayResource = new GatewayResource();
+ GatewayResource gatewayResource = jpa.getGateway();
ServiceDescriptorResource resource = (ServiceDescriptorResource)gatewayResource.get(ResourceType.SERVICE_DESCRIPTOR,serviceName);
resource.setServiceDescName(serviceName);
List<Resource> resources = resource.get(ResourceType.APPLICATION_DESCRIPTOR);
@@ -326,7 +352,7 @@ public class AiravataJPARegistry extends
public void addWorkspaceProject(WorkspaceProject project) {
- GatewayResource gatewayResource = new GatewayResource();
+ GatewayResource gatewayResource = jpa.getGateway();
ProjectResource resource = (ProjectResource)gatewayResource.create(ResourceType.PROJECT);
resource.setName(project.getProjectName());
//todo fix the IDs to Names
@@ -339,19 +365,19 @@ public class AiravataJPARegistry extends
}
public void deleteWorkspaceProject(String projectName) {
- GatewayResource gatewayResource = new GatewayResource();
+ GatewayResource gatewayResource = jpa.getGateway();
gatewayResource.remove(ResourceType.PROJECT,projectName);
}
public WorkspaceProject getWorkspaceProject(String projectName) {
- GatewayResource gatewayResource = new GatewayResource();
+ 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 = new GatewayResource();
+ GatewayResource gatewayResource = jpa.getGateway();
ExperimentResource resource = (ExperimentResource)gatewayResource.create(ResourceType.EXPERIMENT);
resource.setExpID(experiment.getExperimentId());
resource.setSubmittedDate(new java.sql.Date(experiment.getSubmittedDate().getTime()));
@@ -359,7 +385,7 @@ public class AiravataJPARegistry extends
}
public void removeExperiment(String experimentId) {
- GatewayResource gatewayResource = new GatewayResource();
+ GatewayResource gatewayResource = jpa.getGateway();
gatewayResource.remove(ResourceType.EXPERIMENT, experimentId);
}
@@ -421,7 +447,7 @@ public class AiravataJPARegistry extends
UserResource userResource = new UserResource();
userResource.setUserName(getUser().getUserName());
UserWorkflowResource resource = (UserWorkflowResource)userResource.get(ResourceType.USER_WORKFLOW, workflowName);
- GatewayResource gatewayResource = new GatewayResource();
+ 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()));
@@ -433,7 +459,7 @@ public class AiravataJPARegistry extends
UserResource userResource = new UserResource();
userResource.setUserName(getUser().getUserName());
UserWorkflowResource resource = (UserWorkflowResource)userResource.get(ResourceType.USER_WORKFLOW, workflowName);
- GatewayResource gatewayResource = new GatewayResource();
+ 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()));
@@ -442,7 +468,7 @@ public class AiravataJPARegistry extends
}
public String getPublishedWorkflowGraphXML(String workflowName) {
- GatewayResource gatewayResource = new GatewayResource();
+ GatewayResource gatewayResource = jpa.getGateway();
PublishWorkflowResource resource1 = (PublishWorkflowResource) gatewayResource.get(ResourceType.PUBLISHED_WORKFLOW, workflowName);
return resource1.getContent();
}
@@ -452,7 +478,7 @@ public class AiravataJPARegistry extends
}
public void removePublishedWorkflow(String workflowName) {
- GatewayResource gatewayResource = new GatewayResource();
+ GatewayResource gatewayResource = jpa.getGateway();
gatewayResource.remove(ResourceType.PUBLISHED_WORKFLOW, workflowName);
}
@@ -470,7 +496,7 @@ public class AiravataJPARegistry extends
}
public String getWorkflowGraphXML(String workflowName) {
- GatewayResource gatewayResource = new GatewayResource();
+ 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();
@@ -481,7 +507,7 @@ public class AiravataJPARegistry extends
}
public void removeWorkflow(String workflowName) {
- GatewayResource gatewayResource = new GatewayResource();
+ GatewayResource gatewayResource = jpa.getGateway();
UserResource resource = (UserResource)gatewayResource.get(ResourceType.USER_WORKFLOW, getUser().getUserName());
resource.remove(ResourceType.USER_WORKFLOW, workflowName);
}
@@ -493,4 +519,204 @@ public class AiravataJPARegistry extends
public void setAiravataUser(AiravataUser user) {
//To change body of implemented methods use File | Settings | File Templates.
}
+
+ @Override
+ public boolean saveWorkflowExecutionUser(String experimentId, String user)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public String getWorkflowExecutionUser(String experimentId)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getWorkflowExecutionName(String experimentId)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean saveWorkflowExecutionName(String experimentId,
+ String workflowIntanceName) throws RegistryException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean saveWorkflowExecutionStatus(String experimentId,
+ ExecutionStatus status) throws RegistryException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public WorkflowInstanceStatus getWorkflowExecutionStatus(String experimentId)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getWorkflowExecutionMetadata(String experimentId)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean saveWorkflowExecutionMetadata(String experimentId,
+ String metadata) throws RegistryException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean saveWorkflowExecutionServiceInput(
+ WorkflowServiceIOData workflowInputData) throws RegistryException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean saveWorkflowExecutionServiceOutput(
+ WorkflowServiceIOData workflowOutputData) throws RegistryException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public List<WorkflowServiceIOData> searchWorkflowExecutionServiceInput(
+ String experimentIdRegEx, String workflowNameRegEx,
+ String nodeNameRegEx) throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<WorkflowServiceIOData> searchWorkflowExecutionServiceOutput(
+ String experimentIdRegEx, String workflowNameRegEx,
+ String nodeNameRegEx) throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean saveWorkflowExecutionOutput(String experimentId,
+ String outputNodeName, String output) throws RegistryException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean saveWorkflowExecutionOutput(String experimentId,
+ WorkflowIOData data) throws RegistryException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public WorkflowIOData getWorkflowExecutionOutput(String experimentId,
+ String outputNodeName) throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<WorkflowIOData> getWorkflowExecutionOutput(String experimentId)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String[] getWorkflowExecutionOutputNames(String exeperimentId)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public WorkflowExecution getWorkflowExecution(String experimentId)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<String> getWorkflowExecutionIdByUser(String user)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<WorkflowExecution> getWorkflowExecutionByUser(String user)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<WorkflowExecution> getWorkflowExecutionByUser(String user,
+ int pageSize, int pageNo) throws RegistryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean saveWorkflowData(WorkflowRunTimeData runTimeData)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean saveWorkflowStatus(String workflowInstanceID,
+ WorkflowInstanceStatus workflowStatus) throws RegistryException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean saveWorkflowLastUpdateTime(String workflowInstanceID,
+ Timestamp lastUpdateTime) throws RegistryException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean saveWorkflowNodeStatus(String workflowInstanceID,
+ String workflowNodeID, ExecutionStatus status)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean saveWorkflowNodeLastUpdateTime(String workflowInstanceID,
+ String workflowNodeID, Timestamp lastUpdateTime)
+ throws RegistryException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean saveWorkflowNodeGramData(
+ WorkflowNodeGramData workflowNodeGramData) throws RegistryException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean saveWorkflowNodeGramLocalJobID(String workflowInstanceID,
+ String workflowNodeID, String localJobID) throws RegistryException {
+ // TODO Auto-generated method stub
+ return false;
+ }
}
Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Application_Descriptor.java Fri Sep 7 19:48:52 2012
@@ -24,23 +24,22 @@ package org.apache.airavata.persistance.
import javax.persistence.*;
@Entity
+@IdClass(Application_Descriptor_PK.class)
public class Application_Descriptor {
@Id
private String application_descriptor_ID;
+ @Id
+ private String host_descriptor_ID;
+ @Id
+ private String service_descriptor_ID;
+
private String application_descriptor_xml;
+ @Id
@ManyToOne
@JoinColumn(name = "gateway_name")
private Gateway gateway;
- @OneToOne
- @JoinColumn(name = "service_descriptor_ID")
- private Service_Descriptor service_descriptor;
-
- @ManyToOne
- @JoinColumn(name = "host_descriptor_ID")
- private Host_Descriptor host_descriptor;
-
@ManyToOne
@JoinColumn(name = "user_name")
private Users user;
@@ -57,12 +56,20 @@ public class Application_Descriptor {
return gateway;
}
- public Service_Descriptor getService_descriptor() {
- return service_descriptor;
+ public String getHost_descriptor_ID() {
+ return host_descriptor_ID;
+ }
+
+ public String getService_descriptor_ID() {
+ return service_descriptor_ID;
+ }
+
+ public void setHost_descriptor_ID(String host_descriptor_ID) {
+ this.host_descriptor_ID = host_descriptor_ID;
}
- public Host_Descriptor getHost_descriptor() {
- return host_descriptor;
+ public void setService_descriptor_ID(String service_descriptor_ID) {
+ this.service_descriptor_ID = service_descriptor_ID;
}
public void setApplication_descriptor_ID(String application_descriptor_ID) {
@@ -77,14 +84,6 @@ public class Application_Descriptor {
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;
}
@@ -93,3 +92,56 @@ public class Application_Descriptor {
this.user = user;
}
}
+
+class Application_Descriptor_PK{
+ private String gateway_name;
+ private String application_descriptor_ID;
+ private String host_descriptor_ID;
+ private String service_descriptor_ID;
+
+ public Application_Descriptor_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getGateway_name() {
+ return gateway_name;
+ }
+
+ public String getApplication_descriptor_ID() {
+ return application_descriptor_ID;
+ }
+
+ public String getHost_descriptor_ID() {
+ return host_descriptor_ID;
+ }
+
+ public String getService_descriptor_ID() {
+ return service_descriptor_ID;
+ }
+
+ public void setGateway_name(String gateway_name) {
+ this.gateway_name = gateway_name;
+ }
+
+ public void setApplication_descriptor_ID(String application_descriptor_ID) {
+ this.application_descriptor_ID = application_descriptor_ID;
+ }
+
+ public void setHost_descriptor_ID(String host_descriptor_ID) {
+ this.host_descriptor_ID = host_descriptor_ID;
+ }
+
+ public void setService_descriptor_ID(String service_descriptor_ID) {
+ this.service_descriptor_ID = service_descriptor_ID;
+ }
+}
Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java Fri Sep 7 19:48:52 2012
@@ -25,7 +25,6 @@ import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
import java.sql.Date;
@Entity
@@ -39,6 +38,10 @@ public class Experiment {
private Users user;
@ManyToOne
+ @JoinColumn(name = "gateway_name")
+ private Gateway gateway;
+
+ @ManyToOne
@JoinColumn(name = "project_ID")
private Project project;
@@ -73,4 +76,12 @@ public class Experiment {
public void setProject(Project project) {
this.project = project;
}
+
+ public Gateway getGateway() {
+ return gateway;
+ }
+
+ public void setGateway(Gateway gateway) {
+ this.gateway = gateway;
+ }
}
Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java Fri Sep 7 19:48:52 2012
@@ -27,6 +27,7 @@ import javax.persistence.Id;
public class Gateway {
@Id
private String gateway_name;
+ private String owner;
public String getGateway_name() {
return gateway_name;
@@ -35,4 +36,12 @@ public class Gateway {
public void setGateway_name(String gateway_name) {
this.gateway_name = gateway_name;
}
+
+ public String getOwner() {
+ return owner;
+ }
+
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
}
Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java Fri Sep 7 19:48:52 2012
@@ -29,28 +29,30 @@ import javax.persistence.ManyToOne;
@Entity
@IdClass(Gateway_Worker_PK.class)
public class Gateway_Worker {
- @Id
- private String gateway_name;
+// @Id
+// private String gateway_name;
+//
+// @Id
+// private String user_name;
@Id
- private String user_name;
-
@ManyToOne
@JoinColumn(name = "gateway_name")
private Gateway gateway;
+ @Id
@ManyToOne
@JoinColumn(name = "user_name")
private Users user;
- public String getUser_name() {
- return user_name;
- }
-
- public void setUser_name(String user_name) {
- this.user_name = user_name;
- }
+// public String getUser_name() {
+// return user_name;
+// }
+//
+// public void setUser_name(String user_name) {
+// this.user_name = user_name;
+// }
public void setGateway(Gateway gateway) {
this.gateway = gateway;
@@ -68,13 +70,13 @@ public class Gateway_Worker {
this.user = user;
}
- public String getGateway_name() {
- return gateway_name;
- }
-
- public void setGateway_name(String gateway_name) {
- this.gateway_name = gateway_name;
- }
+// public String getGateway_name() {
+// return gateway_name;
+// }
+//
+// public void setGateway_name(String gateway_name) {
+// this.gateway_name = gateway_name;
+// }
}
class Gateway_Worker_PK {
Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Host_Descriptor.java Fri Sep 7 19:48:52 2012
@@ -23,11 +23,13 @@ package org.apache.airavata.persistance.
import javax.persistence.*;
@Entity
+@IdClass(Host_Descriptor_PK.class)
public class Host_Descriptor {
@Id
private String host_descriptor_ID;
private String host_descriptor_xml;
+ @Id
@ManyToOne
@JoinColumn(name = "gateway_name")
private Gateway gateway;
@@ -68,3 +70,39 @@ public class Host_Descriptor {
this.user = user;
}
}
+
+class Host_Descriptor_PK {
+ private String gateway_name;
+ private String host_descriptor_ID;
+
+ public Host_Descriptor_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getGateway_name() {
+ return gateway_name;
+ }
+
+ public String getHost_descriptor_ID() {
+ return host_descriptor_ID;
+ }
+
+ public void setGateway_name(String gateway_name) {
+ this.gateway_name = gateway_name;
+ }
+
+ public void setHost_descriptor_ID(String host_descriptor_ID) {
+ this.host_descriptor_ID = host_descriptor_ID;
+ }
+
+}
Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Published_Workflow.java Fri Sep 7 19:48:52 2012
@@ -34,17 +34,25 @@ public class Published_Workflow {
@Id
private String publish_workflow_name;
+
+ @Id
+ @ManyToOne
+ @JoinColumn(name = "gateway_name")
+ private Gateway gateway;
+
private String version;
private Date published_date;
private String workflow_content;
+ private String path;
- @Id
- private String gateway_name;
+ @ManyToOne
+ @JoinColumn(name = "user_name")
+ private Users user;
// @Id
-// @ManyToOne
-// @JoinColumn(name = "gateway_ID")
-// private Gateway gateway;
+// private String gateway_name;
+
+
public String getPublish_workflow_name() {
return publish_workflow_name;
@@ -62,9 +70,9 @@ public class Published_Workflow {
return workflow_content;
}
-// public Gateway getGateway() {
-// return gateway;
-// }
+ public Gateway getGateway() {
+ return gateway;
+ }
public void setPublish_workflow_name(String publish_workflow_name) {
this.publish_workflow_name = publish_workflow_name;
@@ -82,17 +90,33 @@ public class Published_Workflow {
this.workflow_content = workflow_content;
}
- public String getGateway_name() {
- return gateway_name;
+ public String getPath() {
+ return path;
}
- public void setGateway_name(String gateway_name) {
- this.gateway_name = gateway_name;
+ public void setPath(String path) {
+ this.path = path;
}
- // public void setGateway(Gateway gateway) {
-// this.gateway = gateway;
+ // public String getGateway_name() {
+// return gateway_name;
// }
+//
+// public void setGateway_name(String gateway_name) {
+// this.gateway_name = gateway_name;
+// }
+
+ public Users getUser() {
+ return user;
+ }
+
+ public void setUser(Users user) {
+ this.user = user;
+ }
+
+ public void setGateway(Gateway gateway) {
+ this.gateway = gateway;
+ }
}
class Published_Workflow_PK {
Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Service_Descriptor.java Fri Sep 7 19:48:52 2012
@@ -23,11 +23,13 @@ package org.apache.airavata.persistance.
import javax.persistence.*;
@Entity
+@IdClass(Service_Descriptor_PK.class)
public class Service_Descriptor {
@Id
private String service_descriptor_ID;
private String service_descriptor_xml;
+ @Id
@ManyToOne
@JoinColumn(name = "gateway_name")
private Gateway gateway;
@@ -69,3 +71,39 @@ public class Service_Descriptor {
}
}
+class Service_Descriptor_PK{
+ private String gateway_name;
+ private String service_descriptor_ID;
+
+ public Service_Descriptor_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getGateway_name() {
+ return gateway_name;
+ }
+
+ public String getService_descriptor_ID() {
+ return service_descriptor_ID;
+ }
+
+ public void setGateway_name(String gateway_name) {
+ this.gateway_name = gateway_name;
+ }
+
+ public void setService_descriptor_ID(String service_descriptor_ID) {
+ this.service_descriptor_ID = service_descriptor_ID;
+ }
+}
+
+
Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/User_Workflow.java Fri Sep 7 19:48:52 2012
@@ -24,22 +24,26 @@ import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
-import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
import java.sql.Date;
@Entity
@IdClass(User_Workflow_PK.class)
public class User_Workflow {
@Id
- private String user_workflow_name;
+ @ManyToOne
+ @JoinColumn(name = "gateway_name")
+ private Gateway gateway;
@Id
- private int project_ID;
+ @ManyToOne
+ @JoinColumn(name = "user_name")
+ private Users user;
@Id
- private String user_name;
+ private String template_name;
+
+ private String path;
// @Id
// @ManyToOne
@@ -51,72 +55,72 @@ public class User_Workflow {
// @JoinColumn(name = "project_ID")
// private Project project;
- private Date last_update_date;
- private String workflow_content;
+ private Date last_updated_date;
+ private String workflow_graph;
- public String getUser_workflow_name() {
- return user_workflow_name;
+ public String getTemplate_name() {
+ return template_name;
+ }
+
+ public Users getUser() {
+ return user;
}
-// public Users getUsers() {
-// return users;
-// }
-//
// public Project getProject() {
// return project;
// }
- public Date getLast_update_date() {
- return last_update_date;
+ public void setTemplate_name(String template_name) {
+ this.template_name = template_name;
}
- public String getWorkflow_content() {
- return workflow_content;
+ public void setUser(Users user) {
+ this.user = user;
}
- public void setUser_workflow_name(String user_workflow_name) {
- this.user_workflow_name = user_workflow_name;
+ public Gateway getGateway() {
+ return gateway;
}
-// public void setUsers(Users users) {
-// this.users = users;
-// }
-//
-// public void setProject(Project project) {
-// this.project = project;
-// }
-
-
- public int getProject_ID() {
- return project_ID;
+ public String getPath() {
+ return path;
}
+ public Date getLast_updated_date() {
+ return last_updated_date;
+ }
- public void setProject_ID(int project_ID) {
- this.project_ID = project_ID;
+ public String getWorkflow_graph() {
+ return workflow_graph;
}
- public String getUser_name() {
- return user_name;
+ public void setGateway(Gateway gateway) {
+ this.gateway = gateway;
}
- public void setUser_name(String user_name) {
- this.user_name = user_name;
+ public void setPath(String path) {
+ this.path = path;
}
- public void setLast_update_date(Date last_update_date) {
- this.last_update_date = last_update_date;
+ public void setWorkflow_graph(String workflow_graph) {
+ this.workflow_graph = workflow_graph;
}
- public void setWorkflow_content(String workflow_content) {
- this.workflow_content = workflow_content;
+ //
+// public void setProject(Project project) {
+// this.project = project;
+// }
+
+ public void setLast_updated_date(Date last_updated_date) {
+ this.last_updated_date = last_updated_date;
}
+
}
class User_Workflow_PK {
- private String user_workflow_name;
- private int project_ID;
- private String user_name;
+ private String template_name;
+ private String gateway_name;
+ private String owner;
public User_Workflow_PK() {
;
@@ -132,29 +136,27 @@ class User_Workflow_PK {
return 1;
}
- public String getUser_workflow_name() {
- return user_workflow_name;
+ public String getTemplate_name() {
+ return template_name;
}
- public int getProject_ID() {
- return project_ID;
+ public String getGateway_name() {
+ return gateway_name;
}
- public String getUser_name() {
- return user_name;
+ public String getOwner() {
+ return owner;
}
- public void setUser_name(String user_name) {
- this.user_name = user_name;
+ public void setOwner(String owner) {
+ this.owner = owner;
}
- public void setUser_workflow_name(String user_workflow_name) {
- this.user_workflow_name = user_workflow_name;
+ public void setTemplate_name(String template_name) {
+ this.template_name = template_name;
}
- public void setProject_ID(int project_ID) {
- this.project_ID = project_ID;
+ public void setGateway_name(String gateway_name) {
+ this.gateway_name = gateway_name;
}
-
-
}
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=1382136&r1=1382135&r2=1382136&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 Fri Sep 7 19:48:52 2012
@@ -22,23 +22,25 @@ package org.apache.airavata.persistance.
import org.apache.airavata.persistance.registry.jpa.Resource;
import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.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 org.apache.airavata.persistance.registry.jpa.model.*;
+import javax.persistence.Query;
+import java.util.ArrayList;
import java.util.List;
public class ApplicationDescriptorResource extends AbstractResource {
private String name;
private String gatewayName;
- private String userName;
+ private String updatedUser;
private String content;
private String hostDescName;
private String serviceDescName;
- public ApplicationDescriptorResource(String name) {
+ public ApplicationDescriptorResource(String name, String gatewayName, String hostDescName, String serviceDescName) {
this.name = name;
+ this.gatewayName = gatewayName;
+ this.hostDescName = hostDescName;
+ this.serviceDescName = serviceDescName;
}
public ApplicationDescriptorResource() {
@@ -52,12 +54,12 @@ public class ApplicationDescriptorResour
this.gatewayName = gatewayName;
}
- public String getUserName() {
- return userName;
+ public String getUpdatedUser() {
+ return updatedUser;
}
- public void setUserName(String userName) {
- this.userName = userName;
+ public void setUpdatedUser(String updatedUser) {
+ this.updatedUser = updatedUser;
}
public String getName() {
@@ -96,10 +98,50 @@ public class ApplicationDescriptorResour
throw new UnsupportedOperationException();
}
+ /**
+ * key should be gateway_name, application_descriptor_ID, host_descriptor_ID, service_descriptor_ID
+ * @param keys
+ */
+ public void removeMe(Object[] keys) {
+ begin();
+ Query q = em.createQuery("Delete p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_id and p.gateway_name=:gate_name and p.host_descriptor_ID =:host_id " +
+ "and p.service_descriptor_ID =: service_desc");
+ q.setParameter("gate_name", keys[0]);
+ q.setParameter("app_desc_id", keys[1]);
+ q.setParameter("host_id", keys[2]);
+ q.setParameter("service_desc", keys[3]);
+ q.executeUpdate();
+ end();
+ }
+
public Resource get(ResourceType type, Object name) {
throw new UnsupportedOperationException();
}
+ /**
+ * keys should contain gateway_name, application_descriptor_ID, host_descriptor_ID, service_descriptor_ID
+ * @param keys
+ * @return
+ */
+ public List<Resource> getMe(Object[] keys) {
+ List<Resource> list = new ArrayList<Resource>();
+ begin();
+ Query q = em.createQuery("SELECT p FROM Application_Descriptor p WHERE p.application_descriptor_ID = :app_desc_name and p.gateway_name=:gate_name and p.host_descriptor_ID =:host_id " +
+ "and p.service_descriptor_ID =: service_desc");
+ q.setParameter("gate_name", keys[0]);
+ q.setParameter("app_desc_id", keys[1]);
+ q.setParameter("host_id", keys[2]);
+ q.setParameter("service_desc", keys[3]);
+ Application_Descriptor applicationDescriptor = (Application_Descriptor)q.getSingleResult();
+ ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(applicationDescriptor.getApplication_descriptor_ID(),
+ applicationDescriptor.getGateway().getGateway_name(), applicationDescriptor.getHost_descriptor_ID(), applicationDescriptor.getService_descriptor_ID());
+ applicationDescriptorResource.setUpdatedUser(applicationDescriptor.getUser().getUser_name());
+ applicationDescriptorResource.setContent(applicationDescriptor.getApplication_descriptor_xml());
+ end();
+ list.add(applicationDescriptorResource);
+ return list;
+ }
+
public List<Resource> get(ResourceType type) {
throw new UnsupportedOperationException();
}
@@ -111,11 +153,12 @@ public class ApplicationDescriptorResour
Gateway gateway = new Gateway();
gateway.setGateway_name(gatewayName);
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);
+ Users user = new Users();
+ user.setUser_name(updatedUser);
+ applicationDescriptor.setUser(user);
applicationDescriptor.setApplication_descriptor_xml(content);
+ applicationDescriptor.setService_descriptor_ID(serviceDescName);
+ applicationDescriptor.setHost_descriptor_ID(hostDescName);
em.persist(applicationDescriptor);
end();
Modified: incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.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/ConfigurationResource.java?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java Fri Sep 7 19:48:52 2012
@@ -24,7 +24,9 @@ import org.apache.airavata.persistance.r
import org.apache.airavata.persistance.registry.jpa.ResourceType;
import org.apache.airavata.persistance.registry.jpa.model.Configuration;
+import javax.persistence.Query;
import java.sql.Date;
+import java.util.ArrayList;
import java.util.List;
public class ConfigurationResource extends AbstractResource {
@@ -33,6 +35,9 @@ public class ConfigurationResource exten
private String configVal;
private Date expireDate;
+ public ConfigurationResource() {
+ }
+
public ConfigurationResource(int configID) {
this.configID = configID;
}
@@ -45,10 +50,48 @@ public class ConfigurationResource exten
throw new UnsupportedOperationException();
}
+ /**
+ * keys should be config key and config content
+ * @param keys
+ */
+ public void removeMe(Object[] keys) {
+
+ }
+
public Resource get(ResourceType type, Object name) {
throw new UnsupportedOperationException();
}
+ /**
+ * key should be the configuration name
+ * @param keys
+ * @return
+ */
+ public List<Resource> getMe(Object[] keys) {
+ List<Resource> list = new ArrayList<Resource>();
+ begin();
+ Query q = em.createQuery("SELECT p FROM Configuration p WHERE p.config_key = :confKey");
+ q.setParameter("confKey", keys[0]);
+ List resultList = q.getResultList();
+ if (resultList.size() != 0) {
+ for (Object result : resultList) {
+ Configuration configuration = (Configuration) result;
+ ConfigurationResource configurationResource = new ConfigurationResource();
+ configurationResource.setConfigKey(configuration.getConfig_key());
+ configurationResource.setConfigVal(configuration.getConfig_val());
+ configurationResource.setExpireDate(configuration.getExpire_date());
+ list.add(configurationResource);
+ }
+ }
+ end();
+ return list;
+
+ }
+
+ public List<ConfigurationResource> getValues(){
+ return null;
+ }
+
public List<Resource> get(ResourceType type) {
throw new UnsupportedOperationException();
}
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=1382136&r1=1382135&r2=1382136&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 Fri Sep 7 19:48:52 2012
@@ -26,7 +26,9 @@ import org.apache.airavata.persistance.r
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 {
@@ -34,6 +36,7 @@ public class ExperimentResource extends
private String userName;
private String expID;
private Date submittedDate;
+ private String gatewayName;
public ExperimentResource() {
}
@@ -70,6 +73,14 @@ public class ExperimentResource extends
this.submittedDate = submittedDate;
}
+ public String getGatewayName() {
+ return gatewayName;
+ }
+
+ public void setGatewayName(String gatewayName) {
+ this.gatewayName = gatewayName;
+ }
+
public Resource create(ResourceType type) {
throw new UnsupportedOperationException();
}
@@ -78,10 +89,35 @@ public class ExperimentResource extends
throw new UnsupportedOperationException();
}
+ public void removeMe(Object[] keys) {
+
+ }
+
public Resource get(ResourceType type, Object name) {
throw new UnsupportedOperationException();
}
+ /**
+ * key should be the experiment ID
+ * @param keys
+ * @return
+ */
+ public List<Resource> getMe(Object[] keys) {
+ List<Resource> list = new ArrayList<Resource>();
+ begin();
+ Query q = em.createQuery("SELECT p FROM Experiment p WHERE p.experiment_ID = :exp_ID");
+ 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.setSubmittedDate(experiment.getSubmitted_date());
+ end();
+ list.add(experimentResource);
+ return list;
+
+ }
+
public List<Resource> get(ResourceType type) {
throw new UnsupportedOperationException();
}
@@ -106,8 +142,4 @@ public class ExperimentResource extends
public boolean isExists(ResourceType type, Object name) {
throw new UnsupportedOperationException();
}
-
- public void setExpID(String expID) {
- this.expID = expID;
- }
}
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=1382136&r1=1382135&r2=1382136&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 Fri Sep 7 19:48:52 2012
@@ -22,13 +22,7 @@ package org.apache.airavata.persistance.
import org.apache.airavata.persistance.registry.jpa.Resource;
import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.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 org.apache.airavata.persistance.registry.jpa.model.*;
import javax.persistence.Query;
import java.util.ArrayList;
@@ -36,7 +30,7 @@ import java.util.List;
public class GatewayResource extends AbstractResource {
private String gatewayName;
- private String name;
+ private String owner;
public String getGatewayName() {
return gatewayName;
@@ -46,6 +40,14 @@ public class GatewayResource extends Abs
this.gatewayName = gatewayName;
}
+ public String getOwner() {
+ return owner;
+ }
+
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
+
public Resource create(ResourceType type) {
if (type == ResourceType.PROJECT) {
ProjectResource projectResource = new ProjectResource();
@@ -59,7 +61,11 @@ public class GatewayResource extends Abs
PublishWorkflowResource publishWorkflowResource = new PublishWorkflowResource();
publishWorkflowResource.setGatewayName(gatewayName);
return publishWorkflowResource;
- } else if (type == ResourceType.HOST_DESCRIPTOR) {
+ }else if(type == ResourceType.USER_WORKFLOW){
+ UserWorkflowResource userWorkflowResource = new UserWorkflowResource();
+ userWorkflowResource.setGatewayname(gatewayName);
+ return userWorkflowResource;
+ }else if (type == ResourceType.HOST_DESCRIPTOR) {
HostDescriptorResource hostDescriptorResource = new HostDescriptorResource();
hostDescriptorResource.setGatewayName(gatewayName);
return hostDescriptorResource;
@@ -71,7 +77,11 @@ public class GatewayResource extends Abs
ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource();
applicationDescriptorResource.setGatewayName(gatewayName);
return applicationDescriptorResource;
- } else {
+ } else if(type == ResourceType.EXPERIMENT){
+ ExperimentResource experimentResource =new ExperimentResource();
+ experimentResource.setGatewayName(gatewayName);
+ return experimentResource;
+ }else {
return null;
}
}
@@ -105,17 +115,23 @@ public class GatewayResource extends Abs
q.setParameter("service_desc_id", name);
q.setParameter("gate_name", gatewayName);
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_name = :gate_name");
- q.setParameter("app_desc_id", name);
- q.setParameter("gate_name", gatewayName);
- 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_name = :gate_name");
+// q.setParameter("app_desc_id", name);
+// q.setParameter("gate_name", gatewayName);
+// q.executeUpdate();
+// }
+
end();
}
+ public void removeMe(Object[] keys) {
+ }
+
public Resource get(ResourceType type, Object name) {
begin();
if (type == ResourceType.PROJECT) {
@@ -168,24 +184,37 @@ public class GatewayResource extends Abs
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_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().getHost_descriptor_ID());
- applicationDescriptorResource.setServiceDescName(eappDesc.getService_descriptor().getService_descriptor_ID());
- end();
- return applicationDescriptorResource;
- } else {
- return null;
+// }
+// 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.setSubmittedDate(experiment.getSubmitted_date());
+ return experimentResource;
}
}
+ public List<Resource> getMe(Object[] keys) {
+ throw new UnsupportedOperationException();
+ }
+
public List<Resource> get(ResourceType type) {
List<Resource> resourceList = new ArrayList<Resource>();
begin();
@@ -263,24 +292,39 @@ public class GatewayResource extends Abs
if (results.size() != 0) {
for (Object result : results) {
Application_Descriptor applicationDescriptor = (Application_Descriptor) result;
- ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(applicationDescriptor.getApplication_descriptor_ID());
- applicationDescriptorResource.setGatewayName(gatewayName);
+ ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(applicationDescriptor.getApplication_descriptor_ID(),applicationDescriptor.getGateway().getGateway_name(),
+ applicationDescriptor.getHost_descriptor_ID(), applicationDescriptor.getService_descriptor_ID());
applicationDescriptorResource.setContent(applicationDescriptor.getApplication_descriptor_xml());
- applicationDescriptorResource.setHostDescName(applicationDescriptor.getHost_descriptor().getHost_descriptor_ID());
- applicationDescriptorResource.setServiceDescName(applicationDescriptor.getService_descriptor().getService_descriptor_ID());
+ applicationDescriptorResource.setUpdatedUser(applicationDescriptor.getUser().getUser_name());
resourceList.add(applicationDescriptorResource);
}
}
+ } else if (type == ResourceType.EXPERIMENT) {
+ Query q = em.createQuery("SELECT p FROM Experiment p WHERE p.gateway_name =:gate_name");
+ q.setParameter("gate_name", gatewayName);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ 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.setSubmittedDate(experiment.getSubmitted_date());
+ experimentResource.setProjectID(experiment.getProject().getProject_ID());
+ resourceList.add(experimentResource);
+ }
+ }
}
end();
return resourceList;
+
}
public void save() {
// save me..
begin();
Gateway gateway = new Gateway();
- gateway.setGateway_name(name);
+ gateway.setGateway_name(gatewayName);
em.persist(gateway);
System.out.println(gateway);
end();
@@ -329,12 +373,5 @@ public class GatewayResource extends Abs
return false;
}
- public String getName() {
- return name;
- }
-
- 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/HostDescriptorResource.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/HostDescriptorResource.java?rev=1382136&r1=1382135&r2=1382136&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java (original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/HostDescriptorResource.java Fri Sep 7 19:48:52 2012
@@ -33,7 +33,7 @@ import java.util.List;
public class HostDescriptorResource extends AbstractResource {
private String hostDescName;
private String gatewayName;
- private int userID;
+ private String userName;
private String content;
public HostDescriptorResource(String hostDescName) {
@@ -43,12 +43,12 @@ public class HostDescriptorResource exte
public HostDescriptorResource() {
}
- public int getUserID() {
- return userID;
+ public String getUserName() {
+ return userName;
}
- public void setUserID(int userID) {
- this.userID = userID;
+ public void setUserName(String userName) {
+ this.userName = userName;
}
public String getHostDescName() {
@@ -93,6 +93,10 @@ public class HostDescriptorResource exte
}
}
+ public void removeMe(Object[] keys) {
+
+ }
+
public Resource get(ResourceType type, Object name) {
if (type == ResourceType.APPLICATION_DESCRIPTOR) {
begin();
@@ -101,17 +105,38 @@ public class HostDescriptorResource exte
q.setParameter("host_desc_name", hostDescName);
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 applicationDescriptorResource = new ApplicationDescriptorResource(eappDesc.getApplication_descriptor_ID(),
+ eappDesc.getGateway().getGateway_name(),
+ eappDesc.getHost_descriptor_ID(),
+ eappDesc.getService_descriptor_ID());
applicationDescriptorResource.setContent(eappDesc.getApplication_descriptor_xml());
- applicationDescriptorResource.setHostDescName(eappDesc.getHost_descriptor().getHost_descriptor_ID());
- applicationDescriptorResource.setServiceDescName(hostDescName);
+ applicationDescriptorResource.setUpdatedUser(eappDesc.getUser().getUser_name());
end();
return applicationDescriptorResource;
}
return null;
}
+ /**
+ * key should be host_descriptor_name
+ * @param keys
+ * @return
+ */
+ public List<Resource> getMe(Object[] keys) {
+ List<Resource> list = new ArrayList<Resource>();
+ begin();
+ Query q = em.createQuery("SELECT p FROM Host_Descriptor p WHERE p.host_descriptor_ID = :host_desc_name");
+ q.setParameter("host_desc_name", keys[0]);
+ Host_Descriptor hostDescriptor = (Host_Descriptor)q.getSingleResult();
+ HostDescriptorResource hostDescriptorResource = new HostDescriptorResource(hostDescriptor.getHost_descriptor_ID());
+ hostDescriptorResource.setGatewayName(hostDescriptor.getGateway().getGateway_name());
+ hostDescriptorResource.setUserName(hostDescriptor.getUser().getUser_name());
+ hostDescriptorResource.setContent(hostDescriptor.getHost_descriptor_xml());
+ end();
+ list.add(hostDescriptorResource);
+ return list;
+ }
+
public List<Resource> get(ResourceType type) {
List<Resource> resourceList = new ArrayList<Resource>();
if (type == ResourceType.APPLICATION_DESCRIPTOR) {
@@ -123,11 +148,12 @@ public class HostDescriptorResource exte
if (results.size() != 0) {
for (Object result : results) {
Application_Descriptor applicationDescriptor = (Application_Descriptor) result;
- ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(applicationDescriptor.getApplication_descriptor_ID());
- applicationDescriptorResource.setGatewayName(gatewayName);
+ ApplicationDescriptorResource applicationDescriptorResource = new ApplicationDescriptorResource(applicationDescriptor.getApplication_descriptor_ID(),
+ applicationDescriptor.getGateway().getGateway_name(),
+ applicationDescriptor.getHost_descriptor_ID(),
+ applicationDescriptor.getService_descriptor_ID());
applicationDescriptorResource.setContent(applicationDescriptor.getApplication_descriptor_xml());
- applicationDescriptorResource.setHostDescName(hostDescName);
- applicationDescriptorResource.setServiceDescName(applicationDescriptor.getService_descriptor().getService_descriptor_ID());
+ applicationDescriptor.setUser(applicationDescriptor.getUser());
resourceList.add(applicationDescriptorResource);
}
}