You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2015/06/02 22:40:57 UTC
[01/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Repository: airavata
Updated Branches:
refs/heads/master 6a6657abd -> 22bcbb40c
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/RegistryUseCaseTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/RegistryUseCaseTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/RegistryUseCaseTest.java
new file mode 100644
index 0000000..d1989bf
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/RegistryUseCaseTest.java
@@ -0,0 +1,296 @@
+/*
+ *
+ * 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.experiment.catalog;
+
+import junit.framework.Assert;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
+import org.apache.airavata.model.workspace.Project;
+import org.apache.airavata.model.workspace.experiment.*;
+import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.experiment.catalog.util.Initialize;
+import org.apache.airavata.registry.cpi.*;
+import org.apache.airavata.registry.cpi.utils.Constants;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * This class contains test cases for the RegistryImpl class which is the default registry
+ * implementation. These test cases are written from the perspective of the Airavata API
+ * such as creating/updating/deleting/searching projects and experiments etc.
+ */
+public class RegistryUseCaseTest {
+
+ private static Registry registry;
+ private static Initialize initialize;
+
+ @BeforeClass
+ public static void setupBeforeClass() throws RegistryException, SQLException {
+ initialize = new Initialize("registry-derby.sql");
+ initialize.initializeDB();
+ registry = RegistryFactory.getDefaultRegistry();
+ }
+
+ @Test
+ public void testProject(){
+ try {
+ String TAG = System.currentTimeMillis() + "";
+
+ String gatewayId = ServerSettings.getDefaultUserGateway();
+
+ //testing the creation of a project
+ Project project = new Project();
+ project.setOwner("TestUser"+TAG);
+ project.setName("TestProject"+TAG);
+ project.setDescription("This is a test project"+TAG);
+ String projectId1 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
+ Assert.assertNotNull(projectId1);
+
+ //testing the update of a project
+ Project updatedProject = new Project();
+ updatedProject.setProjectID(projectId1);
+ updatedProject.setOwner("TestUser"+TAG);
+ updatedProject.setName("UpdatedTestProject"+TAG);
+ updatedProject.setDescription("This is an updated test project"+TAG);
+ registry.update(RegistryModelType.PROJECT, updatedProject, projectId1);
+
+ //testing project retrieval
+ Project retrievedProject = (Project)registry.get(RegistryModelType.PROJECT, projectId1);
+ Assert.assertEquals(updatedProject.getProjectID(), retrievedProject.getProjectID());
+ Assert.assertEquals(updatedProject.getOwner(), retrievedProject.getOwner());
+ Assert.assertEquals(updatedProject.getName(), retrievedProject.getName());
+ Assert.assertEquals(updatedProject.getDescription(), retrievedProject.getDescription());
+ Assert.assertNotNull(retrievedProject.getCreationTime());
+ //created user should be in the shared users list
+ Assert.assertTrue(retrievedProject.getSharedUsers().size()==1);
+
+ //creating more projects for the same user
+ project = new Project();
+ project.setOwner("TestUser"+TAG);
+ project.setName("Project Terrible"+TAG);
+ project.setDescription("This is a test project_2"+TAG);
+ String projectId2 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
+ Assert.assertNotNull(projectId2);
+
+ project = new Project();
+ project.setOwner("TestUser"+TAG);
+ project.setName("Project Funny"+TAG);
+ project.setDescription("This is a test project_3"+TAG);
+ String projectId3 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
+ Assert.assertNotNull(projectId3);
+
+ project = new Project();
+ project.setOwner("TestUser"+TAG);
+ project.setName("Project Stupid"+TAG);
+ project.setDescription("This is a test project_4"+TAG);
+ String projectId4 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
+ Assert.assertNotNull(projectId4);
+
+ project = new Project();
+ project.setOwner("TestUser"+TAG);
+ project.setName("Project Boring"+TAG);
+ project.setDescription("This is a test project_5"+TAG);
+ String projectId5 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
+ Assert.assertNotNull(projectId5);
+
+ //test get all projects created by the user
+ List<Object> list = registry.get(RegistryModelType.PROJECT,
+ Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
+ Assert.assertTrue(list.size()==5);
+
+ //search project by project name
+ Map<String, String> filters = new HashMap<String, String>();
+ filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
+ filters.put(Constants.FieldConstants.ProjectConstants.PROJECT_NAME, "Terrible"+TAG);
+ list = registry.search(RegistryModelType.PROJECT, filters);
+ Assert.assertTrue(list.size()==1);
+
+ //search project by project description
+ filters = new HashMap<String, String>();
+ filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
+ filters.put(Constants.FieldConstants.ProjectConstants.DESCRIPTION, "test project_2"+TAG);
+ list = registry.search(RegistryModelType.PROJECT, filters);
+ Assert.assertTrue(list.size()==1);
+
+ //search project with only ownername
+ filters = new HashMap<String, String>();
+ filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
+ list = registry.search(RegistryModelType.PROJECT, filters);
+ Assert.assertTrue(list.size()==5);
+
+ //search projects with pagination
+ filters = new HashMap<String, String>();
+ filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
+ list = registry.search(RegistryModelType.PROJECT, filters, 2, 2,
+ Constants.FieldConstants.ProjectConstants.CREATION_TIME, ResultOrderType.DESC);
+ Assert.assertTrue(list.size()==2);
+ Project project1 = (Project)list.get(0);
+ Project project2 = (Project)list.get(1);
+ Assert.assertTrue(project1.getCreationTime()-project2.getCreationTime() > 0);
+ } catch (RegistryException e) {
+ e.printStackTrace();
+ Assert.fail();
+ } catch (ApplicationSettingsException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testExperiment(){
+ try {
+ long time = System.currentTimeMillis();
+ String TAG = time + "";
+
+ String gatewayId = ServerSettings.getDefaultUserGateway();
+
+ //creating project
+ Project project = new Project();
+ project.setOwner("TestUser"+TAG);
+ project.setName("TestProject"+TAG);
+ project.setDescription("This is a test project"+TAG);
+ String projectId1 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
+ Assert.assertNotNull(projectId1);
+
+ //creating sample echo experiment. assumes echo application is already defined
+ InputDataObjectType inputDataObjectType = new InputDataObjectType();
+ inputDataObjectType.setName("Input_to_Echo");
+ inputDataObjectType.setValue("Hello World");
+
+ ComputationalResourceScheduling scheduling = new ComputationalResourceScheduling();
+ scheduling.setResourceHostId(UUID.randomUUID().toString());
+ scheduling.setComputationalProjectAccount("TG-STA110014S");
+ scheduling.setTotalCPUCount(1);
+ scheduling.setNodeCount(1);
+ scheduling.setWallTimeLimit(15);
+ scheduling.setQueueName("normal");
+
+ UserConfigurationData userConfigurationData = new UserConfigurationData();
+ userConfigurationData.setAiravataAutoSchedule(false);
+ userConfigurationData.setOverrideManualScheduledParams(false);
+ userConfigurationData.setComputationalResourceScheduling(scheduling);
+
+ Experiment experiment = new Experiment();
+ experiment.setProjectID(projectId1);
+ experiment.setUserName("TestUser" + TAG);
+ experiment.setName("TestExperiment"+TAG);
+ experiment.setDescription("Test 1 experiment");
+ experiment.setApplicationId(UUID.randomUUID().toString());
+ experiment.setUserConfigurationData(userConfigurationData);
+ experiment.addToExperimentInputs(inputDataObjectType);
+
+ String experimentId1 = (String)registry.add(ParentDataType.EXPERIMENT, experiment, gatewayId);
+ Assert.assertNotNull(experimentId1);
+
+ //retrieving the stored experiment
+ Experiment retrievedExperiment = (Experiment)registry.get(RegistryModelType.EXPERIMENT,
+ experimentId1);
+ Assert.assertNotNull(retrievedExperiment);
+ Assert.assertEquals(retrievedExperiment.getProjectID(), experiment.getProjectID());
+ Assert.assertEquals(retrievedExperiment.getDescription(), experiment.getDescription());
+ Assert.assertEquals(retrievedExperiment.getName(), experiment.getName());
+ Assert.assertEquals(retrievedExperiment.getApplicationId(), experiment.getApplicationId());
+ Assert.assertNotNull(retrievedExperiment.getUserConfigurationData());
+ Assert.assertNotNull(retrievedExperiment.getExperimentInputs());
+
+ //updating an existing experiment
+ experiment.setName("NewExperimentName"+TAG);
+ OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
+ outputDataObjectType.setName("Output_to_Echo");
+ outputDataObjectType.setValue("Hello World");
+ experiment.addToExperimentOutputs(outputDataObjectType);
+ registry.update(RegistryModelType.EXPERIMENT, experiment, experimentId1);
+
+ //creating more experiments
+ experiment = new Experiment();
+ experiment.setProjectID(projectId1);
+ experiment.setUserName("TestUser" + TAG);
+ experiment.setName("TestExperiment2" + TAG);
+ experiment.setDescription("Test 2 experiment");
+ experiment.setApplicationId(UUID.randomUUID().toString());
+ experiment.setUserConfigurationData(userConfigurationData);
+ experiment.addToExperimentInputs(inputDataObjectType);
+
+ String experimentId2 = (String)registry.add(ParentDataType.EXPERIMENT, experiment, gatewayId);
+ Assert.assertNotNull(experimentId2);
+
+ experiment = new Experiment();
+ experiment.setProjectID(projectId1);
+ experiment.setUserName("TestUser" + TAG);
+ experiment.setName("TestExperiment3"+TAG);
+ experiment.setDescription("Test 3 experiment");
+ experiment.setApplicationId(UUID.randomUUID().toString());
+ experiment.setUserConfigurationData(userConfigurationData);
+ experiment.addToExperimentInputs(inputDataObjectType);
+
+ String experimentId3 = (String)registry.add(ParentDataType.EXPERIMENT, experiment, gatewayId);
+ Assert.assertNotNull(experimentId3);
+
+ //searching experiments by
+ Map<String, String> filters = new HashMap<String, String>();
+ filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, "TestUser" + TAG);
+ filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
+ filters.put(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_NAME, "Experiment2");
+ filters.put(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_STATUS, ExperimentState.CREATED.toString());
+ filters.put(Constants.FieldConstants.ExperimentConstants.FROM_DATE, time - 999999999 + "");
+ filters.put(Constants.FieldConstants.ExperimentConstants.TO_DATE, time + 999999999 + "");
+ List<Object> results = registry.search(RegistryModelType.EXPERIMENT, filters);
+ Assert.assertTrue(results.size()==1);
+
+ //retrieving all experiments in project
+ List<Object> list = registry.get(RegistryModelType.EXPERIMENT,
+ Constants.FieldConstants.ExperimentConstants.PROJECT_ID, projectId1);
+ Assert.assertTrue(list.size()==3);
+
+ //searching all user experiments
+ filters = new HashMap();
+ filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, "TestUser" + TAG);
+ filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
+ list = registry.search(RegistryModelType.EXPERIMENT, filters);
+ Assert.assertTrue(list.size()==3);
+
+ //searching user experiments with pagination
+ filters = new HashMap();
+ filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, "TestUser" + TAG);
+ filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
+ list = registry.search(RegistryModelType.EXPERIMENT, filters, 2, 1,
+ Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC);
+ Assert.assertTrue(list.size()==2);
+ ExperimentSummary exp1 = (ExperimentSummary)list.get(0);
+ ExperimentSummary exp2 = (ExperimentSummary)list.get(1);
+ Assert.assertTrue(exp1.getCreationTime()-exp2.getCreationTime() > 0);
+
+ } catch (RegistryException e) {
+ e.printStackTrace();
+ Assert.fail();
+ } catch (ApplicationSettingsException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailResourceTest.java
new file mode 100644
index 0000000..916f03e
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailResourceTest.java
@@ -0,0 +1,93 @@
+/**
+ * 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.experiment.catalog;
+
+import static org.junit.Assert.*;
+
+import java.sql.Timestamp;
+import java.util.Date;
+
+import org.apache.airavata.experiment.catalog.resources.ExperimentResource;
+import org.apache.airavata.experiment.catalog.resources.TaskDetailResource;
+import org.apache.airavata.experiment.catalog.resources.WorkflowNodeDetailResource;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TaskDetailResourceTest extends AbstractResourceTest{
+
+ private ExperimentResource experimentResource;
+ private TaskDetailResource taskDetailResource;
+ private WorkflowNodeDetailResource nodeDetailResource;
+ private String experimentID = "testExpID";
+ private String applicationID = "testAppID";
+ private String taskID = "testTask";
+ private String nodeID = "testNode";
+
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ Timestamp creationTime = new Timestamp(new Date().getTime());
+
+ experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
+ experimentResource.setExpID(experimentID);
+ experimentResource.setExecutionUser(getWorkerResource().getUser());
+ experimentResource.setProjectId(getProjectResource().getId());
+ experimentResource.setCreationTime(creationTime);
+ experimentResource.save();
+
+ nodeDetailResource = (WorkflowNodeDetailResource) experimentResource.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ nodeDetailResource.setExperimentId(experimentResource.getExpID());
+ nodeDetailResource.setNodeInstanceId(nodeID);
+ nodeDetailResource.setNodeName(nodeID);
+ nodeDetailResource.setCreationTime(creationTime);
+ nodeDetailResource.save();
+
+ taskDetailResource = (TaskDetailResource)nodeDetailResource.create(ResourceType.TASK_DETAIL);
+ taskDetailResource.setNodeId(nodeDetailResource.getNodeInstanceId());
+ taskDetailResource.setTaskId(taskID);
+ taskDetailResource.setApplicationId(applicationID);
+ taskDetailResource.setApplicationVersion("1.0");
+ taskDetailResource.setCreationTime(creationTime);
+ taskDetailResource.save();
+ }
+
+
+ @Test
+ public void testCreate() throws Exception {
+ assertNotNull("task data resource has being created ", taskDetailResource);
+ }
+
+ @Test
+ public void testSave() throws Exception {
+ assertTrue("task save successfully", nodeDetailResource.isExists(ResourceType.TASK_DETAIL, taskID));
+ }
+
+ @Test
+ public void testGet() throws Exception {
+ assertNotNull("task data retrieved successfully", nodeDetailResource.get(ResourceType.TASK_DETAIL, taskID));
+ }
+
+ @Test
+ public void testRemove() throws Exception {
+ nodeDetailResource.remove(ResourceType.TASK_DETAIL, taskID);
+ assertFalse("task data removed successfully", nodeDetailResource.isExists(ResourceType.TASK_DETAIL, taskID));
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/UserResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/UserResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/UserResourceTest.java
new file mode 100644
index 0000000..dfd45b1
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/UserResourceTest.java
@@ -0,0 +1,54 @@
+/*
+*
+* 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.experiment.catalog;
+
+import static org.junit.Assert.*;
+
+import org.apache.airavata.experiment.catalog.resources.GatewayResource;
+import org.apache.airavata.experiment.catalog.resources.UserResource;
+import org.junit.After;
+import org.junit.Test;
+
+public class UserResourceTest extends AbstractResourceTest {
+ private UserResource userResource;
+ private GatewayResource gatewayResource;
+ private String userName = "testUser";
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ gatewayResource = super.getGatewayResource();
+ userResource = super.getUserResource();
+ userResource.setUserName(userName);
+ userResource.setPassword("testPassword");
+ userResource.save();
+ }
+
+ @Test
+ public void testSave() throws Exception {
+ assertTrue("user resource saved successfully", gatewayResource.isExists(ResourceType.USER, "admin"));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkerResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkerResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkerResourceTest.java
new file mode 100644
index 0000000..8a9caee
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkerResourceTest.java
@@ -0,0 +1,122 @@
+///*
+//*
+//* 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.experiment.registry.jpa;
+//
+//import org.apache.airavata.experiment.registry.jpa.resources.*;
+//
+//import java.sql.Timestamp;
+//import java.util.Calendar;
+//
+//public class WorkerResourceTest extends AbstractResourceTest {
+// private GatewayResource gatewayResource;
+// private WorkerResource workerResource;
+// private ProjectResource testProject;
+// private UserWorkflowResource userWorkflowResource;
+// private ExperimentMetadataResource experimentResource;
+//
+// @Override
+// public void setUp() throws Exception {
+// super.setUp();
+// gatewayResource = super.getGatewayResource();
+// workerResource = super.getWorkerResource();
+//
+// testProject = workerResource.createProject("testProject");
+// userWorkflowResource = workerResource.createWorkflowTemplate("workflow1");
+// experimentResource = (ExperimentMetadataResource) workerResource.create(ResourceType.EXPERIMENT_METADATA);
+//
+// testProject.setGateway(gatewayResource);
+// testProject.save();
+//
+// userWorkflowResource.setGateway(gatewayResource);
+// userWorkflowResource.setContent("testContent");
+// userWorkflowResource.save();
+//
+// experimentResource.setGateway(gatewayResource);
+// experimentResource.setExpID("testExpID");
+// experimentResource.setExperimentName("testExpID");
+// experimentResource.setProject(testProject);
+// experimentResource.setExecutionUser(workerResource.getUser());
+// experimentResource.setSubmittedDate(getCurrentTimestamp());
+// experimentResource.save();
+//
+//
+// }
+//
+// public void testCreate() throws Exception {
+// assertNotNull("project resource created successfully", testProject);
+// assertNotNull("user workflow created successfully", userWorkflowResource);
+// }
+//
+// public void testGet() throws Exception {
+// assertNotNull("project resource retrieved successfully", workerResource.get(ResourceType.PROJECT, "testProject"));
+// assertNotNull("user workflow retrieved successfully", workerResource.get(ResourceType.USER_WORKFLOW, "workflow1"));
+// assertNotNull("experiment retrieved successfully", workerResource.get(ResourceType.EXPERIMENT_METADATA, "testExpID"));
+// }
+//
+// public void testGetList() throws Exception {
+// assertNotNull("project resources retrieved successfully", workerResource.get(ResourceType.PROJECT));
+// assertNotNull("user workflows retrieved successfully", workerResource.get(ResourceType.USER_WORKFLOW));
+// assertNotNull("experiments retrieved successfully", workerResource.get(ResourceType.EXPERIMENT_METADATA));
+//
+// }
+//
+// public void testSave() throws Exception {
+// workerResource.save();
+// assertTrue("worker resource saved successfully", gatewayResource.isExists(ResourceType.USER, "admin"));
+// //remove
+//// ResourceUtils.removeGatewayWorker(gatewayResource, userResource);
+//// gatewayResource.remove(ResourceType.USER, "testUser");
+// }
+//
+// public void testRemove() throws Exception {
+// workerResource.removeWorkflowTemplate("workflow1");
+//// workerResource.removeExperiment("testExpID");
+//// workerResource.removeProject("testProject");
+//
+// assertTrue("user workflow has been removed successfully", !workerResource.isWorkflowTemplateExists("workflow1"));
+//// assertTrue("experiment has been removed successfully", !workerResource.isExperimentExists("testExpID"));
+//
+//// assertTrue("project has been removed successfully", !workerResource.isProjectExists("testProject"));
+//
+//
+//// testProject.setGateway(gatewayResource);
+//// testProject.save();
+////
+//// userWorkflowResource.setGateway(gatewayResource);
+//// userWorkflowResource.setContent("testContent");
+//// userWorkflowResource.save();
+////
+//// experimentResource.setGateway(gatewayResource);
+//// experimentResource.setExpID("testExpID");
+//// experimentResource.setProject(testProject);
+//// experimentResource.setSubmittedDate(getCurrentTimestamp());
+//// experimentResource.save();
+//
+// }
+//
+// @Override
+// public void tearDown() throws Exception {
+// super.tearDown();
+// }
+//
+//
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkflowDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkflowDataResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkflowDataResourceTest.java
new file mode 100644
index 0000000..7aac186
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkflowDataResourceTest.java
@@ -0,0 +1,106 @@
+///*
+//*
+//* 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.experiment.registry.jpa;
+//
+//import org.apache.airavata.experiment.registry.jpa.resources.*;
+//
+//import java.sql.Timestamp;
+//import java.util.Calendar;
+//
+//public class WorkflowDataResourceTest extends AbstractResourceTest {
+// private ExperimentMetadataResource experimentResource;
+// private WorkflowDataResource workflowDataResource;
+// private NodeDataResource nodeDataResource;
+// private GramDataResource gramDataResource;
+//
+// @Override
+// public void setUp() throws Exception {
+// super.setUp();
+// GatewayResource gatewayResource = super.getGatewayResource();
+// WorkerResource workerResource = super.getWorkerResource();
+//
+// experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
+// experimentResource.setExpID("testExpID");
+// experimentResource.setExperimentName("testExpID");
+// experimentResource.setExecutionUser(workerResource.getUser());
+// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+// experimentResource.save();
+//
+// workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
+// workflowDataResource.setWorkflowInstanceID("testWFInstance");
+// workflowDataResource.setTemplateName("testTemplate");
+// workflowDataResource.setExperimentID("testExpID");
+// Calendar calender = Calendar.getInstance();
+// java.util.Date d = calender.getTime();
+// Timestamp timestamp = new Timestamp(d.getTime());
+// workflowDataResource.setLastUpdatedTime(timestamp);
+// workflowDataResource.save();
+//
+// nodeDataResource = workflowDataResource.createNodeData("testNodeID");
+// gramDataResource = workflowDataResource.createGramData("testNodeID");
+//
+// nodeDataResource.setWorkflowDataResource(workflowDataResource);
+// nodeDataResource.setInputs("testInput");
+// nodeDataResource.setOutputs("testOutput");
+// nodeDataResource.setStatus("testStatus");
+// nodeDataResource.save();
+//
+// gramDataResource.setRsl("testRSL");
+// gramDataResource.setWorkflowDataResource(workflowDataResource);
+// gramDataResource.save();
+// }
+//
+// public void testCreate() throws Exception {
+// assertNotNull("node data resource created successfully", nodeDataResource);
+// assertNotNull("gram data resource created successfully", gramDataResource);
+// }
+//
+// public void testGet() throws Exception {
+// assertNotNull("Node data retrieved successfully", workflowDataResource.getNodeData("testNodeID"));
+// assertNotNull("Gram data retrieved successfully", workflowDataResource.getGramData("testNodeID"));
+// }
+//
+// public void testGetList() throws Exception {
+// assertNotNull("Node data retrieved successfully", workflowDataResource.getNodeData());
+// assertNotNull("Gram data retrieved successfully", workflowDataResource.getGramData());
+// }
+//
+// public void testRemove() throws Exception {
+// workflowDataResource.removeNodeData("testNodeID");
+// workflowDataResource.removeGramData("testNodeID");
+//
+// assertTrue("node date removed successfully", !workflowDataResource.isNodeExists("testNodeID"));
+// assertTrue("gram date removed successfully", !workflowDataResource.isGramDataExists("testNodeID"));
+//
+// }
+//
+// public void testSave() throws Exception {
+// assertTrue("workflow data saved successfully", experimentResource.isExists(ResourceType.WORKFLOW_DATA, "testWFInstance"));
+// }
+//
+// @Override
+// public void tearDown() throws Exception {
+// super.tearDown();
+// }
+//
+//
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailResourceTest.java
new file mode 100644
index 0000000..37b98cb
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailResourceTest.java
@@ -0,0 +1,85 @@
+/**
+ * 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.experiment.catalog;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Timestamp;
+import java.util.Date;
+
+import org.apache.airavata.experiment.catalog.resources.ExperimentResource;
+import org.apache.airavata.experiment.catalog.resources.WorkflowNodeDetailResource;
+import org.junit.Before;
+import org.junit.Test;
+
+public class WorkflowNodeDetailResourceTest extends AbstractResourceTest {
+
+ private ExperimentResource experimentResource;
+ private WorkflowNodeDetailResource nodeDetailResource;
+ private String experimentID = "testExpID";
+ private String applicationID = "testAppID";
+ private String nodeID = "testNode";
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ Timestamp creationTime = new Timestamp(new Date().getTime());
+
+ experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
+ experimentResource.setExpID(experimentID);
+ experimentResource.setExecutionUser(getWorkerResource().getUser());
+ experimentResource.setProjectId(getProjectResource().getId());
+ experimentResource.setCreationTime(creationTime);
+ experimentResource.setApplicationId(applicationID);
+ experimentResource.save();
+
+ nodeDetailResource = (WorkflowNodeDetailResource) experimentResource.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ nodeDetailResource.setExperimentId(experimentResource.getExpID());
+ nodeDetailResource.setNodeInstanceId(nodeID);
+ nodeDetailResource.setNodeName(nodeID);
+ nodeDetailResource.setCreationTime(creationTime);
+ nodeDetailResource.save();
+
+ }
+
+ @Test
+ public void testCreate() throws Exception {
+ assertNotNull("task data resource has being created ", nodeDetailResource);
+ }
+
+ @Test
+ public void testSave() throws Exception {
+ assertTrue("task save successfully", experimentResource.isExists(ResourceType.WORKFLOW_NODE_DETAIL, nodeID));
+ }
+
+ @Test
+ public void testGet() throws Exception {
+ assertNotNull("task data retrieved successfully", experimentResource.get(ResourceType.WORKFLOW_NODE_DETAIL, nodeID));
+ }
+
+ @Test
+ public void testRemove() throws Exception {
+ experimentResource.remove(ResourceType.WORKFLOW_NODE_DETAIL, nodeID);
+ assertFalse("task data removed successfully", experimentResource.isExists(ResourceType.WORKFLOW_NODE_DETAIL, nodeID));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java
new file mode 100644
index 0000000..dfae817
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java
@@ -0,0 +1,333 @@
+/*
+ *
+ * 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.experiment.catalog.util;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.resources.GatewayResource;
+import org.apache.airavata.experiment.catalog.resources.ProjectResource;
+import org.apache.airavata.experiment.catalog.resources.UserResource;
+import org.apache.airavata.experiment.catalog.resources.Utils;
+import org.apache.airavata.experiment.catalog.resources.WorkerResource;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.apache.derby.drda.NetworkServerControl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.InetAddress;
+import java.sql.*;
+import java.util.StringTokenizer;
+
+public class Initialize {
+ private static final Logger logger = LoggerFactory.getLogger(Initialize.class);
+ public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
+ public String scriptName = "registry-derby.sql";
+ private NetworkServerControl server;
+ private static final String delimiter = ";";
+ public static final String PERSISTANT_DATA = "Configuration";
+
+ public Initialize(String scriptName) {
+ this.scriptName = scriptName;
+ }
+
+ public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
+ if (suffix.length() > buffer.length()) {
+ return false;
+ }
+ // this loop is done on purpose to avoid memory allocation performance
+ // problems on various JDKs
+ // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
+ // implementation is ok though does allocation/copying
+ // StringBuffer.toString().endsWith() does massive memory
+ // allocation/copying on JDK 1.5
+ // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
+ int endIndex = suffix.length() - 1;
+ int bufferIndex = buffer.length() - 1;
+ while (endIndex >= 0) {
+ if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
+ return false;
+ }
+ bufferIndex--;
+ endIndex--;
+ }
+ return true;
+ }
+
+ private static boolean isServerStarted(NetworkServerControl server, int ntries)
+ {
+ for (int i = 1; i <= ntries; i ++)
+ {
+ try {
+ Thread.sleep(500);
+ server.ping();
+ return true;
+ }
+ catch (Exception e) {
+ if (i == ntries)
+ return false;
+ }
+ }
+ return false;
+ }
+
+ public void initializeDB() throws SQLException{
+ String jdbcUrl = null;
+ String jdbcUser = null;
+ String jdbcPassword = null;
+ try{
+ jdbcUrl = ServerSettings.getSetting("registry.jdbc.url");
+ jdbcUser = ServerSettings.getSetting("registry.jdbc.user");
+ jdbcPassword = ServerSettings.getSetting("registry.jdbc.password");
+ jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+ } catch (ApplicationSettingsException e) {
+ logger.error("Unable to read properties", e);
+ }
+ startDerbyInServerMode();
+ if(!isServerStarted(server, 20)){
+ throw new RuntimeException("Derby server cound not started within five seconds...");
+ }
+
+ Connection conn = null;
+ try {
+ Class.forName(Utils.getJDBCDriver()).newInstance();
+ conn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword);
+ if (!isDatabaseStructureCreated(PERSISTANT_DATA, conn)) {
+ executeSQLScript(conn);
+ logger.info("New Database created for Registry");
+ } else {
+ logger.debug("Database already created for Registry!");
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RuntimeException("Database failure", e);
+ } finally {
+ try {
+ if (conn != null){
+ if (!conn.getAutoCommit()) {
+ conn.commit();
+ }
+ conn.close();
+ }
+ } catch (SQLException e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ try{
+ GatewayResource gatewayResource = new GatewayResource();
+ gatewayResource.setGatewayId(ServerSettings.getSetting("default.registry.gateway"));
+ gatewayResource.setGatewayName(ServerSettings.getSetting("default.registry.gateway"));
+ gatewayResource.setDomain("test-domain");
+ gatewayResource.setEmailAddress("test-email");
+ gatewayResource.save();
+
+ UserResource userResource = new UserResource();
+ userResource.setUserName(ServerSettings.getSetting("default.registry.user"));
+ userResource.setPassword(ServerSettings.getSetting("default.registry.password"));
+ userResource.save();
+
+ WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
+ workerResource.setUser(userResource.getUserName());
+ workerResource.save();
+
+ ProjectResource projectResource = (ProjectResource)workerResource.create(ResourceType.PROJECT);
+ projectResource.setGatewayId(gatewayResource.getGatewayId());
+ projectResource.setId("default");
+ projectResource.setName("default");
+ projectResource.setWorker(workerResource);
+ projectResource.save();
+
+
+ } catch (ApplicationSettingsException e) {
+ logger.error("Unable to read properties", e);
+ throw new SQLException(e.getMessage(), e);
+ } catch (RegistryException e) {
+ logger.error("Unable to save data to registry", e);
+ throw new SQLException(e.getMessage(), e);
+ }
+ }
+
+ public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
+ try {
+ System.out.println("Running a query to test the database tables existence.");
+ // check whether the tables are already created with a query
+ Statement statement = null;
+ try {
+ statement = conn.createStatement();
+ ResultSet rs = statement.executeQuery("select * from " + tableName);
+ if (rs != null) {
+ rs.close();
+ }
+ } finally {
+ try {
+ if (statement != null) {
+ statement.close();
+ }
+ } catch (SQLException e) {
+ return false;
+ }
+ }
+ } catch (SQLException e) {
+ return false;
+ }
+
+ return true;
+ }
+
+ private void executeSQLScript(Connection conn) throws Exception {
+ StringBuffer sql = new StringBuffer();
+ BufferedReader reader = null;
+ try{
+
+ InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(scriptName);
+ reader = new BufferedReader(new InputStreamReader(inputStream));
+ String line;
+ while ((line = reader.readLine()) != null) {
+ line = line.trim();
+ if (line.startsWith("//")) {
+ continue;
+ }
+ if (line.startsWith("--")) {
+ continue;
+ }
+ StringTokenizer st = new StringTokenizer(line);
+ if (st.hasMoreTokens()) {
+ String token = st.nextToken();
+ if ("REM".equalsIgnoreCase(token)) {
+ continue;
+ }
+ }
+ sql.append(" ").append(line);
+
+ // SQL defines "--" as a comment to EOL
+ // and in Oracle it may contain a hint
+ // so we cannot just remove it, instead we must end it
+ if (line.indexOf("--") >= 0) {
+ sql.append("\n");
+ }
+ if ((checkStringBufferEndsWith(sql, delimiter))) {
+ executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
+ sql.replace(0, sql.length(), "");
+ }
+ }
+ // Catch any statements not followed by ;
+ if (sql.length() > 0) {
+ executeSQL(sql.toString(), conn);
+ }
+ }catch (IOException e){
+ logger.error("Error occurred while executing SQL script for creating Airavata database", e);
+ throw new Exception("Error occurred while executing SQL script for creating Airavata database", e);
+ }finally {
+ if (reader != null) {
+ reader.close();
+ }
+
+ }
+
+ }
+
+ private static void executeSQL(String sql, Connection conn) throws Exception {
+ // Check and ignore empty statements
+ if ("".equals(sql.trim())) {
+ return;
+ }
+
+ Statement statement = null;
+ try {
+ logger.debug("SQL : " + sql);
+
+ boolean ret;
+ int updateCount = 0, updateCountTotal = 0;
+ statement = conn.createStatement();
+ ret = statement.execute(sql);
+ updateCount = statement.getUpdateCount();
+ do {
+ if (!ret) {
+ if (updateCount != -1) {
+ updateCountTotal += updateCount;
+ }
+ }
+ ret = statement.getMoreResults();
+ if (ret) {
+ updateCount = statement.getUpdateCount();
+ }
+ } while (ret);
+
+ logger.debug(sql + " : " + updateCountTotal + " rows affected");
+
+ SQLWarning warning = conn.getWarnings();
+ while (warning != null) {
+ logger.warn(warning + " sql warning");
+ warning = warning.getNextWarning();
+ }
+ conn.clearWarnings();
+ } catch (SQLException e) {
+ if (e.getSQLState().equals("X0Y32")) {
+ // eliminating the table already exception for the derby
+ // database
+ logger.info("Table Already Exists", e);
+ } else {
+ throw new Exception("Error occurred while executing : " + sql, e);
+ }
+ } finally {
+ if (statement != null) {
+ try {
+ statement.close();
+ } catch (SQLException e) {
+ logger.error("Error occurred while closing result set.", e);
+ }
+ }
+ }
+ }
+
+ private void startDerbyInServerMode() {
+ try {
+ System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
+ server = new NetworkServerControl(InetAddress.getByName(Utils.getHost()),
+ 20000,
+ Utils.getJDBCUser(), Utils.getJDBCPassword());
+ java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
+ server.start(consoleWriter);
+ } catch (IOException e) {
+ logger.error("Unable to start Apache derby in the server mode! Check whether " +
+ "specified port is available");
+ } catch (Exception e) {
+ logger.error("Unable to start Apache derby in the server mode! Check whether " +
+ "specified port is available");
+ }
+
+ }
+
+ public void stopDerbyServer() throws SQLException{
+ try {
+ server.shutdown();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new SQLException("Error while stopping derby server", e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/resources/registry-derby.sql
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/resources/registry-derby.sql b/modules/registry/experiment-catalog/src/test/resources/registry-derby.sql
new file mode 100644
index 0000000..7ab3755
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/resources/registry-derby.sql
@@ -0,0 +1,391 @@
+/*
+ *
+ * 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.
+ *
+ */
+CREATE TABLE GATEWAY
+(
+ GATEWAY_ID VARCHAR (255),
+ GATEWAY_NAME VARCHAR(255),
+ DOMAIN VARCHAR(255),
+ EMAIL_ADDRESS VARCHAR(255),
+ PRIMARY KEY (GATEWAY_ID)
+);
+
+CREATE TABLE CONFIGURATION
+(
+ CONFIG_KEY VARCHAR(255),
+ CONFIG_VAL VARCHAR(255),
+ EXPIRE_DATE TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ CATEGORY_ID VARCHAR (255),
+ PRIMARY KEY(CONFIG_KEY, CONFIG_VAL, CATEGORY_ID)
+);
+
+INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL, EXPIRE_DATE, CATEGORY_ID) VALUES('registry.version', '0.15', CURRENT_TIMESTAMP ,'SYSTEM');
+
+CREATE TABLE USERS
+(
+ USER_NAME VARCHAR(255),
+ PASSWORD VARCHAR(255),
+ PRIMARY KEY(USER_NAME)
+);
+
+CREATE TABLE GATEWAY_WORKER
+(
+ GATEWAY_ID VARCHAR(255),
+ USER_NAME VARCHAR(255),
+ PRIMARY KEY (GATEWAY_ID, USER_NAME),
+ FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
+ FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE PROJECT
+(
+ GATEWAY_ID VARCHAR(255),
+ USER_NAME VARCHAR(255) NOT NULL,
+ PROJECT_ID VARCHAR(255),
+ PROJECT_NAME VARCHAR(255) NOT NULL,
+ DESCRIPTION VARCHAR(255),
+ CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (PROJECT_ID),
+ FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
+ FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE PROJECT_USER
+(
+ PROJECT_ID VARCHAR(255),
+ USER_NAME VARCHAR(255),
+ PRIMARY KEY (PROJECT_ID,USER_NAME),
+ FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE EXPERIMENT
+(
+ EXPERIMENT_ID VARCHAR(255),
+ GATEWAY_ID VARCHAR(255),
+ EXECUTION_USER VARCHAR(255) NOT NULL,
+ PROJECT_ID VARCHAR(255) NOT NULL,
+ CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ EXPERIMENT_NAME VARCHAR(255) NOT NULL,
+ EXPERIMENT_DESCRIPTION VARCHAR(255),
+ APPLICATION_ID VARCHAR(255),
+ APPLICATION_VERSION VARCHAR(255),
+ WORKFLOW_TEMPLATE_ID VARCHAR(255),
+ WORKFLOW_TEMPLATE_VERSION VARCHAR(255),
+ WORKFLOW_EXECUTION_ID VARCHAR(255),
+ ALLOW_NOTIFICATION SMALLINT,
+ GATEWAY_EXECUTION_ID VARCHAR(255),
+ PRIMARY KEY(EXPERIMENT_ID),
+ FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
+ FOREIGN KEY (EXECUTION_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE,
+ FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE EXPERIMENT_INPUT
+(
+ EXPERIMENT_ID VARCHAR(255),
+ INPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ METADATA VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ STANDARD_INPUT SMALLINT,
+ USER_FRIENDLY_DESC VARCHAR(255),
+ VALUE CLOB,
+ INPUT_ORDER INTEGER,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_STAGED SMALLINT,
+ PRIMARY KEY(EXPERIMENT_ID,INPUT_KEY),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE EXPERIMENT_OUTPUT
+(
+ EXPERIMENT_ID VARCHAR(255),
+ OUTPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ VALUE CLOB,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_MOVEMENT SMALLINT,
+ DATA_NAME_LOCATION VARCHAR(255),
+ SEARCH_QUERY VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ PRIMARY KEY(EXPERIMENT_ID,OUTPUT_KEY),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
+);
+
+
+CREATE TABLE WORKFLOW_NODE_DETAIL
+(
+ EXPERIMENT_ID VARCHAR(255) NOT NULL,
+ NODE_INSTANCE_ID VARCHAR(255),
+ CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ NODE_NAME VARCHAR(255) NOT NULL,
+ EXECUTION_UNIT VARCHAR(255) NOT NULL,
+ EXECUTION_UNIT_DATA VARCHAR(255),
+ PRIMARY KEY(NODE_INSTANCE_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE TASK_DETAIL
+(
+ TASK_ID VARCHAR(255),
+ NODE_INSTANCE_ID VARCHAR(255),
+ CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ APPLICATION_ID VARCHAR(255),
+ APPLICATION_VERSION VARCHAR(255),
+ APPLICATION_DEPLOYMENT_ID VARCHAR(255),
+ ALLOW_NOTIFICATION SMALLINT,
+ PRIMARY KEY(TASK_ID),
+ FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE NOTIFICATION_EMAIL
+(
+ EMAIL_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ EMAIL_ADDRESS VARCHAR(255),
+ PRIMARY KEY(EMAIL_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE ERROR_DETAIL
+(
+ ERROR_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ NODE_INSTANCE_ID VARCHAR(255),
+ JOB_ID VARCHAR(255),
+ CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ ACTUAL_ERROR_MESSAGE CLOB,
+ USER_FRIEDNLY_ERROR_MSG VARCHAR(255),
+ TRANSIENT_OR_PERSISTENT SMALLINT,
+ ERROR_CATEGORY VARCHAR(255),
+ CORRECTIVE_ACTION VARCHAR(255),
+ ACTIONABLE_GROUP VARCHAR(255),
+ PRIMARY KEY(ERROR_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
+ FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE APPLICATION_INPUT
+(
+ TASK_ID VARCHAR(255),
+ INPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ METADATA VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ STANDARD_INPUT SMALLINT,
+ USER_FRIENDLY_DESC VARCHAR(255),
+ VALUE CLOB,
+ INPUT_ORDER INTEGER,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_STAGED SMALLINT,
+ PRIMARY KEY(TASK_ID,INPUT_KEY),
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE APPLICATION_OUTPUT
+(
+ TASK_ID VARCHAR(255),
+ OUTPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ VALUE CLOB,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_MOVEMENT SMALLINT,
+ DATA_NAME_LOCATION VARCHAR(255),
+ SEARCH_QUERY VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ PRIMARY KEY(TASK_ID,OUTPUT_KEY),
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE NODE_INPUT
+(
+ NODE_INSTANCE_ID VARCHAR(255),
+ INPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ METADATA VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ STANDARD_INPUT SMALLINT,
+ USER_FRIENDLY_DESC VARCHAR(255),
+ VALUE VARCHAR(255),
+ INPUT_ORDER INTEGER,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_STAGED SMALLINT,
+ PRIMARY KEY(NODE_INSTANCE_ID,INPUT_KEY),
+ FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE NODE_OUTPUT
+(
+ NODE_INSTANCE_ID VARCHAR(255),
+ OUTPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ VALUE VARCHAR(255),
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_MOVEMENT SMALLINT,
+ DATA_NAME_LOCATION VARCHAR(255),
+ SEARCH_QUERY VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ PRIMARY KEY(NODE_INSTANCE_ID,OUTPUT_KEY),
+ FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE JOB_DETAIL
+(
+ JOB_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ JOB_DESCRIPTION CLOB NOT NULL,
+ CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ COMPUTE_RESOURCE_CONSUMED VARCHAR(255),
+ JOBNAME VARCHAR (255),
+ WORKING_DIR VARCHAR(255),
+ PRIMARY KEY (TASK_ID, JOB_ID),
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE DATA_TRANSFER_DETAIL
+(
+ TRANSFER_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ TRANSFER_DESC VARCHAR(255) NOT NULL,
+ PRIMARY KEY(TRANSFER_ID),
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE STATUS
+(
+ STATUS_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ EXPERIMENT_ID VARCHAR(255),
+ NODE_INSTANCE_ID VARCHAR(255),
+ TRANSFER_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ JOB_ID VARCHAR(255),
+ STATE VARCHAR(255),
+ STATUS_UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ STATUS_TYPE VARCHAR(255),
+ PRIMARY KEY(STATUS_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
+ FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TRANSFER_ID) REFERENCES DATA_TRANSFER_DETAIL(TRANSFER_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE CONFIG_DATA
+(
+ EXPERIMENT_ID VARCHAR(255),
+ AIRAVATA_AUTO_SCHEDULE SMALLINT NOT NULL,
+ OVERRIDE_MANUAL_SCHEDULE_PARAMS SMALLINT NOT NULL,
+ SHARE_EXPERIMENT SMALLINT,
+ USER_DN VARCHAR(255),
+ GENERATE_CERT SMALLINT,
+ PRIMARY KEY(EXPERIMENT_ID)
+);
+
+CREATE TABLE COMPUTATIONAL_RESOURCE_SCHEDULING
+(
+ RESOURCE_SCHEDULING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ RESOURCE_HOST_ID VARCHAR(255),
+ CPU_COUNT INTEGER,
+ NODE_COUNT INTEGER,
+ NO_OF_THREADS INTEGER,
+ QUEUE_NAME VARCHAR(255),
+ WALLTIME_LIMIT INTEGER,
+ JOB_START_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ TOTAL_PHYSICAL_MEMORY INTEGER,
+ COMPUTATIONAL_PROJECT_ACCOUNT VARCHAR(255),
+ CHESSIS_NAME VARCHAR(255),
+ PRIMARY KEY(RESOURCE_SCHEDULING_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE ADVANCE_INPUT_DATA_HANDLING
+(
+ INPUT_DATA_HANDLING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ WORKING_DIR_PARENT VARCHAR(255),
+ UNIQUE_WORKING_DIR VARCHAR(255),
+ STAGE_INPUT_FILES_TO_WORKING_DIR SMALLINT,
+ CLEAN_AFTER_JOB SMALLINT,
+ PRIMARY KEY(INPUT_DATA_HANDLING_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE ADVANCE_OUTPUT_DATA_HANDLING
+(
+ OUTPUT_DATA_HANDLING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ OUTPUT_DATA_DIR VARCHAR(255),
+ DATA_REG_URL VARCHAR (255),
+ PERSIST_OUTPUT_DATA SMALLINT,
+ PRIMARY KEY(OUTPUT_DATA_HANDLING_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE QOS_PARAM
+(
+ QOS_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ START_EXECUTION_AT VARCHAR(255),
+ EXECUTE_BEFORE VARCHAR(255),
+ NO_OF_RETRIES INTEGER,
+ PRIMARY KEY(QOS_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE COMMUNITY_USER
+(
+ GATEWAY_ID VARCHAR(256) NOT NULL,
+ COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
+ TOKEN_ID VARCHAR(256) NOT NULL,
+ COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
+ PRIMARY KEY (GATEWAY_ID, COMMUNITY_USER_NAME, TOKEN_ID)
+);
+
+CREATE TABLE CREDENTIALS
+(
+ GATEWAY_ID VARCHAR(256) NOT NULL,
+ TOKEN_ID VARCHAR(256) NOT NULL,
+ CREDENTIAL BLOB NOT NULL,
+ PORTAL_USER_ID VARCHAR(256) NOT NULL,
+ TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
+);
+
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/pom.xml
----------------------------------------------------------------------
diff --git a/modules/registry/pom.xml b/modules/registry/pom.xml
index 128430b..055d9f4 100644
--- a/modules/registry/pom.xml
+++ b/modules/registry/pom.xml
@@ -31,7 +31,7 @@
</activation>
<modules>
<module>registry-cpi</module>
- <module>airavata-jpa-registry</module>
+ <module>experiment-catalog</module>
<!--<module>jpa-gen</module>-->
</modules>
</profile>
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/workflow-model/workflow-engine/pom.xml
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/pom.xml b/modules/workflow-model/workflow-engine/pom.xml
index 96522e3..71f48bc 100644
--- a/modules/workflow-model/workflow-engine/pom.xml
+++ b/modules/workflow-model/workflow-engine/pom.xml
@@ -252,7 +252,7 @@
<!--</dependency>-->
<dependency>
<groupId>org.apache.airavata</groupId>
- <artifactId>airavata-jpa-registry</artifactId>
+ <artifactId>airavata-experiment-catalog</artifactId>
<version>${project.version}</version>
</dependency>
<!-- JCR Support -->
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineImpl.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineImpl.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineImpl.java
index 0af8881..0aa9d73 100644
--- a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineImpl.java
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowEngineImpl.java
@@ -30,7 +30,7 @@ import org.apache.airavata.model.error.AiravataClientConnectException;
import org.apache.airavata.model.workspace.experiment.Experiment;
import org.apache.airavata.orchestrator.client.OrchestratorClientFactory;
import org.apache.airavata.orchestrator.cpi.OrchestratorService;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.Registry;
import org.apache.airavata.registry.cpi.RegistryException;
import org.apache.airavata.registry.cpi.RegistryModelType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java
index 5c604d5..af7bdc8 100644
--- a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java
@@ -38,7 +38,7 @@ import org.apache.airavata.model.messaging.event.*;
import org.apache.airavata.model.util.ExperimentModelUtil;
import org.apache.airavata.model.workspace.experiment.*;
import org.apache.airavata.orchestrator.cpi.OrchestratorService;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.ChildDataType;
import org.apache.airavata.registry.cpi.Registry;
import org.apache.airavata.registry.cpi.RegistryException;
@@ -74,7 +74,6 @@ import org.apache.airavata.workflow.model.wf.WorkflowExecutionState;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.xmlpull.infoset.XmlElement;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/workflow/workflow-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/pom.xml b/modules/workflow/workflow-core/pom.xml
index c89fc0f..9f6e056 100644
--- a/modules/workflow/workflow-core/pom.xml
+++ b/modules/workflow/workflow-core/pom.xml
@@ -27,7 +27,7 @@
</dependency>
<dependency>
<groupId>org.apache.airavata</groupId>
- <artifactId>airavata-jpa-registry</artifactId>
+ <artifactId>airavata-experiment-catalog</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/SimpleWorkflowInterpreter.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/SimpleWorkflowInterpreter.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/SimpleWorkflowInterpreter.java
index 778fee2..6b9b5b4 100644
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/SimpleWorkflowInterpreter.java
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/SimpleWorkflowInterpreter.java
@@ -42,7 +42,7 @@ import org.apache.airavata.model.workspace.experiment.TaskState;
import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
import org.apache.airavata.model.workspace.experiment.WorkflowNodeStatus;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.ChildDataType;
import org.apache.airavata.registry.cpi.Registry;
import org.apache.airavata.registry.cpi.RegistryException;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowParser.java
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowParser.java b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowParser.java
index 185671d..5842211 100644
--- a/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowParser.java
+++ b/modules/workflow/workflow-core/src/main/java/org/apache/airavata/workflow/core/parser/AiravataWorkflowParser.java
@@ -27,7 +27,7 @@ import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
import org.apache.airavata.model.workspace.experiment.Experiment;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.Registry;
import org.apache.airavata.registry.cpi.RegistryException;
import org.apache.airavata.registry.cpi.RegistryModelType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/xbaya-gui/pom.xml
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/pom.xml b/modules/xbaya-gui/pom.xml
index 0afe34f..1e172cc 100644
--- a/modules/xbaya-gui/pom.xml
+++ b/modules/xbaya-gui/pom.xml
@@ -221,7 +221,7 @@
</dependency>
<dependency>
<groupId>org.apache.airavata</groupId>
- <artifactId>airavata-jpa-registry</artifactId>
+ <artifactId>airavata-experiment-catalog</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/NewRegistryUserDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/NewRegistryUserDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/NewRegistryUserDialog.java
index df9db51..3987773 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/NewRegistryUserDialog.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/NewRegistryUserDialog.java
@@ -27,11 +27,11 @@ import java.net.URL;
import javax.swing.*;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
-import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
-import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.resources.GatewayResource;
+import org.apache.airavata.experiment.catalog.resources.UserResource;
+import org.apache.airavata.experiment.catalog.resources.WorkerResource;
import org.apache.airavata.xbaya.XBayaEngine;
import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
import org.apache.airavata.xbaya.ui.widgets.GridPanel;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 2234b67..2623d60 100644
--- a/pom.xml
+++ b/pom.xml
@@ -560,7 +560,7 @@
<module>modules/server</module>
<module>modules/test-suite</module>
<module>modules/distribution</module>
- <!--<module>modules/integration-tests</module>-->
+ <module>modules/integration-tests</module>
<module>modules/workflow</module>
<module>modules/xbaya-gui</module>
</modules>
[13/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java
deleted file mode 100644
index 55757fc..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- *
- * 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 junit.framework.Assert;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
-import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
-import org.apache.airavata.model.workspace.Project;
-import org.apache.airavata.model.workspace.experiment.*;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
-import org.apache.airavata.persistance.registry.jpa.util.Initialize;
-import org.apache.airavata.registry.cpi.*;
-import org.apache.airavata.registry.cpi.utils.Constants;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-/**
- * This class contains test cases for the RegistryImpl class which is the default registry
- * implementation. These test cases are written from the perspective of the Airavata API
- * such as creating/updating/deleting/searching projects and experiments etc.
- */
-public class RegistryUseCaseTest {
-
- private static Registry registry;
- private static Initialize initialize;
-
- @BeforeClass
- public static void setupBeforeClass() throws RegistryException, SQLException {
- initialize = new Initialize("registry-derby.sql");
- initialize.initializeDB();
- registry = RegistryFactory.getDefaultRegistry();
- }
-
- @Test
- public void testProject(){
- try {
- String TAG = System.currentTimeMillis() + "";
-
- String gatewayId = ServerSettings.getDefaultUserGateway();
-
- //testing the creation of a project
- Project project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("TestProject"+TAG);
- project.setDescription("This is a test project"+TAG);
- String projectId1 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId1);
-
- //testing the update of a project
- Project updatedProject = new Project();
- updatedProject.setProjectID(projectId1);
- updatedProject.setOwner("TestUser"+TAG);
- updatedProject.setName("UpdatedTestProject"+TAG);
- updatedProject.setDescription("This is an updated test project"+TAG);
- registry.update(RegistryModelType.PROJECT, updatedProject, projectId1);
-
- //testing project retrieval
- Project retrievedProject = (Project)registry.get(RegistryModelType.PROJECT, projectId1);
- Assert.assertEquals(updatedProject.getProjectID(), retrievedProject.getProjectID());
- Assert.assertEquals(updatedProject.getOwner(), retrievedProject.getOwner());
- Assert.assertEquals(updatedProject.getName(), retrievedProject.getName());
- Assert.assertEquals(updatedProject.getDescription(), retrievedProject.getDescription());
- Assert.assertNotNull(retrievedProject.getCreationTime());
- //created user should be in the shared users list
- Assert.assertTrue(retrievedProject.getSharedUsers().size()==1);
-
- //creating more projects for the same user
- project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("Project Terrible"+TAG);
- project.setDescription("This is a test project_2"+TAG);
- String projectId2 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId2);
-
- project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("Project Funny"+TAG);
- project.setDescription("This is a test project_3"+TAG);
- String projectId3 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId3);
-
- project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("Project Stupid"+TAG);
- project.setDescription("This is a test project_4"+TAG);
- String projectId4 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId4);
-
- project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("Project Boring"+TAG);
- project.setDescription("This is a test project_5"+TAG);
- String projectId5 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId5);
-
- //test get all projects created by the user
- List<Object> list = registry.get(RegistryModelType.PROJECT,
- Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
- Assert.assertTrue(list.size()==5);
-
- //search project by project name
- Map<String, String> filters = new HashMap<String, String>();
- filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
- filters.put(Constants.FieldConstants.ProjectConstants.PROJECT_NAME, "Terrible"+TAG);
- list = registry.search(RegistryModelType.PROJECT, filters);
- Assert.assertTrue(list.size()==1);
-
- //search project by project description
- filters = new HashMap<String, String>();
- filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
- filters.put(Constants.FieldConstants.ProjectConstants.DESCRIPTION, "test project_2"+TAG);
- list = registry.search(RegistryModelType.PROJECT, filters);
- Assert.assertTrue(list.size()==1);
-
- //search project with only ownername
- filters = new HashMap<String, String>();
- filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
- list = registry.search(RegistryModelType.PROJECT, filters);
- Assert.assertTrue(list.size()==5);
-
- //search projects with pagination
- filters = new HashMap<String, String>();
- filters.put(Constants.FieldConstants.ProjectConstants.OWNER, "TestUser"+TAG);
- list = registry.search(RegistryModelType.PROJECT, filters, 2, 2,
- Constants.FieldConstants.ProjectConstants.CREATION_TIME, ResultOrderType.DESC);
- Assert.assertTrue(list.size()==2);
- Project project1 = (Project)list.get(0);
- Project project2 = (Project)list.get(1);
- Assert.assertTrue(project1.getCreationTime()-project2.getCreationTime() > 0);
- } catch (RegistryException e) {
- e.printStackTrace();
- Assert.fail();
- } catch (ApplicationSettingsException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testExperiment(){
- try {
- long time = System.currentTimeMillis();
- String TAG = time + "";
-
- String gatewayId = ServerSettings.getDefaultUserGateway();
-
- //creating project
- Project project = new Project();
- project.setOwner("TestUser"+TAG);
- project.setName("TestProject"+TAG);
- project.setDescription("This is a test project"+TAG);
- String projectId1 = (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
- Assert.assertNotNull(projectId1);
-
- //creating sample echo experiment. assumes echo application is already defined
- InputDataObjectType inputDataObjectType = new InputDataObjectType();
- inputDataObjectType.setName("Input_to_Echo");
- inputDataObjectType.setValue("Hello World");
-
- ComputationalResourceScheduling scheduling = new ComputationalResourceScheduling();
- scheduling.setResourceHostId(UUID.randomUUID().toString());
- scheduling.setComputationalProjectAccount("TG-STA110014S");
- scheduling.setTotalCPUCount(1);
- scheduling.setNodeCount(1);
- scheduling.setWallTimeLimit(15);
- scheduling.setQueueName("normal");
-
- UserConfigurationData userConfigurationData = new UserConfigurationData();
- userConfigurationData.setAiravataAutoSchedule(false);
- userConfigurationData.setOverrideManualScheduledParams(false);
- userConfigurationData.setComputationalResourceScheduling(scheduling);
-
- Experiment experiment = new Experiment();
- experiment.setProjectID(projectId1);
- experiment.setUserName("TestUser" + TAG);
- experiment.setName("TestExperiment"+TAG);
- experiment.setDescription("Test 1 experiment");
- experiment.setApplicationId(UUID.randomUUID().toString());
- experiment.setUserConfigurationData(userConfigurationData);
- experiment.addToExperimentInputs(inputDataObjectType);
-
- String experimentId1 = (String)registry.add(ParentDataType.EXPERIMENT, experiment, gatewayId);
- Assert.assertNotNull(experimentId1);
-
- //retrieving the stored experiment
- Experiment retrievedExperiment = (Experiment)registry.get(RegistryModelType.EXPERIMENT,
- experimentId1);
- Assert.assertNotNull(retrievedExperiment);
- Assert.assertEquals(retrievedExperiment.getProjectID(), experiment.getProjectID());
- Assert.assertEquals(retrievedExperiment.getDescription(), experiment.getDescription());
- Assert.assertEquals(retrievedExperiment.getName(), experiment.getName());
- Assert.assertEquals(retrievedExperiment.getApplicationId(), experiment.getApplicationId());
- Assert.assertNotNull(retrievedExperiment.getUserConfigurationData());
- Assert.assertNotNull(retrievedExperiment.getExperimentInputs());
-
- //updating an existing experiment
- experiment.setName("NewExperimentName"+TAG);
- OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
- outputDataObjectType.setName("Output_to_Echo");
- outputDataObjectType.setValue("Hello World");
- experiment.addToExperimentOutputs(outputDataObjectType);
- registry.update(RegistryModelType.EXPERIMENT, experiment, experimentId1);
-
- //creating more experiments
- experiment = new Experiment();
- experiment.setProjectID(projectId1);
- experiment.setUserName("TestUser" + TAG);
- experiment.setName("TestExperiment2" + TAG);
- experiment.setDescription("Test 2 experiment");
- experiment.setApplicationId(UUID.randomUUID().toString());
- experiment.setUserConfigurationData(userConfigurationData);
- experiment.addToExperimentInputs(inputDataObjectType);
-
- String experimentId2 = (String)registry.add(ParentDataType.EXPERIMENT, experiment, gatewayId);
- Assert.assertNotNull(experimentId2);
-
- experiment = new Experiment();
- experiment.setProjectID(projectId1);
- experiment.setUserName("TestUser" + TAG);
- experiment.setName("TestExperiment3"+TAG);
- experiment.setDescription("Test 3 experiment");
- experiment.setApplicationId(UUID.randomUUID().toString());
- experiment.setUserConfigurationData(userConfigurationData);
- experiment.addToExperimentInputs(inputDataObjectType);
-
- String experimentId3 = (String)registry.add(ParentDataType.EXPERIMENT, experiment, gatewayId);
- Assert.assertNotNull(experimentId3);
-
- //searching experiments by
- Map<String, String> filters = new HashMap<String, String>();
- filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, "TestUser" + TAG);
- filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
- filters.put(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_NAME, "Experiment2");
- filters.put(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_STATUS, ExperimentState.CREATED.toString());
- filters.put(Constants.FieldConstants.ExperimentConstants.FROM_DATE, time - 999999999 + "");
- filters.put(Constants.FieldConstants.ExperimentConstants.TO_DATE, time + 999999999 + "");
- List<Object> results = registry.search(RegistryModelType.EXPERIMENT, filters);
- Assert.assertTrue(results.size()==1);
-
- //retrieving all experiments in project
- List<Object> list = registry.get(RegistryModelType.EXPERIMENT,
- Constants.FieldConstants.ExperimentConstants.PROJECT_ID, projectId1);
- Assert.assertTrue(list.size()==3);
-
- //searching all user experiments
- filters = new HashMap();
- filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, "TestUser" + TAG);
- filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
- list = registry.search(RegistryModelType.EXPERIMENT, filters);
- Assert.assertTrue(list.size()==3);
-
- //searching user experiments with pagination
- filters = new HashMap();
- filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, "TestUser" + TAG);
- filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);
- list = registry.search(RegistryModelType.EXPERIMENT, filters, 2, 1,
- Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC);
- Assert.assertTrue(list.size()==2);
- ExperimentSummary exp1 = (ExperimentSummary)list.get(0);
- ExperimentSummary exp2 = (ExperimentSummary)list.get(1);
- Assert.assertTrue(exp1.getCreationTime()-exp2.getCreationTime() > 0);
-
- } catch (RegistryException e) {
- e.printStackTrace();
- Assert.fail();
- } catch (ApplicationSettingsException e) {
- e.printStackTrace();
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/TaskDetailResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/TaskDetailResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/TaskDetailResourceTest.java
deleted file mode 100644
index f971838..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/TaskDetailResourceTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * 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 static org.junit.Assert.*;
-
-import java.sql.Timestamp;
-import java.util.Date;
-
-import org.apache.airavata.persistance.registry.jpa.resources.ExperimentResource;
-import org.apache.airavata.persistance.registry.jpa.resources.TaskDetailResource;
-import org.apache.airavata.persistance.registry.jpa.resources.WorkflowNodeDetailResource;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TaskDetailResourceTest extends AbstractResourceTest{
-
- private ExperimentResource experimentResource;
- private TaskDetailResource taskDetailResource;
- private WorkflowNodeDetailResource nodeDetailResource;
- private String experimentID = "testExpID";
- private String applicationID = "testAppID";
- private String taskID = "testTask";
- private String nodeID = "testNode";
-
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- Timestamp creationTime = new Timestamp(new Date().getTime());
-
- experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- experimentResource.setCreationTime(creationTime);
- experimentResource.save();
-
- nodeDetailResource = (WorkflowNodeDetailResource) experimentResource.create(ResourceType.WORKFLOW_NODE_DETAIL);
- nodeDetailResource.setExperimentId(experimentResource.getExpID());
- nodeDetailResource.setNodeInstanceId(nodeID);
- nodeDetailResource.setNodeName(nodeID);
- nodeDetailResource.setCreationTime(creationTime);
- nodeDetailResource.save();
-
- taskDetailResource = (TaskDetailResource)nodeDetailResource.create(ResourceType.TASK_DETAIL);
- taskDetailResource.setNodeId(nodeDetailResource.getNodeInstanceId());
- taskDetailResource.setTaskId(taskID);
- taskDetailResource.setApplicationId(applicationID);
- taskDetailResource.setApplicationVersion("1.0");
- taskDetailResource.setCreationTime(creationTime);
- taskDetailResource.save();
- }
-
-
- @Test
- public void testCreate() throws Exception {
- assertNotNull("task data resource has being created ", taskDetailResource);
- }
-
- @Test
- public void testSave() throws Exception {
- assertTrue("task save successfully", nodeDetailResource.isExists(ResourceType.TASK_DETAIL, taskID));
- }
-
- @Test
- public void testGet() throws Exception {
- assertNotNull("task data retrieved successfully", nodeDetailResource.get(ResourceType.TASK_DETAIL, taskID));
- }
-
- @Test
- public void testRemove() throws Exception {
- nodeDetailResource.remove(ResourceType.TASK_DETAIL, taskID);
- assertFalse("task data removed successfully", nodeDetailResource.isExists(ResourceType.TASK_DETAIL, taskID));
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java
deleted file mode 100644
index 4facbc7..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-*
-* 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 static org.junit.Assert.*;
-
-import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
-import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
-import org.junit.After;
-import org.junit.Test;
-
-public class UserResourceTest extends AbstractResourceTest {
- private UserResource userResource;
- private GatewayResource gatewayResource;
- private String userName = "testUser";
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- gatewayResource = super.getGatewayResource();
- userResource = super.getUserResource();
- userResource.setUserName(userName);
- userResource.setPassword("testPassword");
- userResource.save();
- }
-
- @Test
- public void testSave() throws Exception {
- assertTrue("user resource saved successfully", gatewayResource.isExists(ResourceType.USER, "admin"));
- }
-
- @After
- public void tearDown() throws Exception {
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.java
deleted file mode 100644
index 876452f..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-///*
-//*
-//* 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.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class WorkerResourceTest extends AbstractResourceTest {
-// private GatewayResource gatewayResource;
-// private WorkerResource workerResource;
-// private ProjectResource testProject;
-// private UserWorkflowResource userWorkflowResource;
-// private ExperimentMetadataResource experimentResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// gatewayResource = super.getGatewayResource();
-// workerResource = super.getWorkerResource();
-//
-// testProject = workerResource.createProject("testProject");
-// userWorkflowResource = workerResource.createWorkflowTemplate("workflow1");
-// experimentResource = (ExperimentMetadataResource) workerResource.create(ResourceType.EXPERIMENT_METADATA);
-//
-// testProject.setGateway(gatewayResource);
-// testProject.save();
-//
-// userWorkflowResource.setGateway(gatewayResource);
-// userWorkflowResource.setContent("testContent");
-// userWorkflowResource.save();
-//
-// experimentResource.setGateway(gatewayResource);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExperimentName("testExpID");
-// experimentResource.setProject(testProject);
-// experimentResource.setExecutionUser(workerResource.getUser());
-// experimentResource.setSubmittedDate(getCurrentTimestamp());
-// experimentResource.save();
-//
-//
-// }
-//
-// public void testCreate() throws Exception {
-// assertNotNull("project resource created successfully", testProject);
-// assertNotNull("user workflow created successfully", userWorkflowResource);
-// }
-//
-// public void testGet() throws Exception {
-// assertNotNull("project resource retrieved successfully", workerResource.get(ResourceType.PROJECT, "testProject"));
-// assertNotNull("user workflow retrieved successfully", workerResource.get(ResourceType.USER_WORKFLOW, "workflow1"));
-// assertNotNull("experiment retrieved successfully", workerResource.get(ResourceType.EXPERIMENT_METADATA, "testExpID"));
-// }
-//
-// public void testGetList() throws Exception {
-// assertNotNull("project resources retrieved successfully", workerResource.get(ResourceType.PROJECT));
-// assertNotNull("user workflows retrieved successfully", workerResource.get(ResourceType.USER_WORKFLOW));
-// assertNotNull("experiments retrieved successfully", workerResource.get(ResourceType.EXPERIMENT_METADATA));
-//
-// }
-//
-// public void testSave() throws Exception {
-// workerResource.save();
-// assertTrue("worker resource saved successfully", gatewayResource.isExists(ResourceType.USER, "admin"));
-// //remove
-//// ResourceUtils.removeGatewayWorker(gatewayResource, userResource);
-//// gatewayResource.remove(ResourceType.USER, "testUser");
-// }
-//
-// public void testRemove() throws Exception {
-// workerResource.removeWorkflowTemplate("workflow1");
-//// workerResource.removeExperiment("testExpID");
-//// workerResource.removeProject("testProject");
-//
-// assertTrue("user workflow has been removed successfully", !workerResource.isWorkflowTemplateExists("workflow1"));
-//// assertTrue("experiment has been removed successfully", !workerResource.isExperimentExists("testExpID"));
-//
-//// assertTrue("project has been removed successfully", !workerResource.isProjectExists("testProject"));
-//
-//
-//// testProject.setGateway(gatewayResource);
-//// testProject.save();
-////
-//// userWorkflowResource.setGateway(gatewayResource);
-//// userWorkflowResource.setContent("testContent");
-//// userWorkflowResource.save();
-////
-//// experimentResource.setGateway(gatewayResource);
-//// experimentResource.setExpID("testExpID");
-//// experimentResource.setProject(testProject);
-//// experimentResource.setSubmittedDate(getCurrentTimestamp());
-//// experimentResource.save();
-//
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-//
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowDataResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowDataResourceTest.java
deleted file mode 100644
index 9c3b107..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowDataResourceTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-///*
-//*
-//* 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.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class WorkflowDataResourceTest extends AbstractResourceTest {
-// private ExperimentMetadataResource experimentResource;
-// private WorkflowDataResource workflowDataResource;
-// private NodeDataResource nodeDataResource;
-// private GramDataResource gramDataResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// GatewayResource gatewayResource = super.getGatewayResource();
-// WorkerResource workerResource = super.getWorkerResource();
-//
-// experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExperimentName("testExpID");
-// experimentResource.setExecutionUser(workerResource.getUser());
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.save();
-//
-// workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
-// workflowDataResource.setWorkflowInstanceID("testWFInstance");
-// workflowDataResource.setTemplateName("testTemplate");
-// workflowDataResource.setExperimentID("testExpID");
-// Calendar calender = Calendar.getInstance();
-// java.util.Date d = calender.getTime();
-// Timestamp timestamp = new Timestamp(d.getTime());
-// workflowDataResource.setLastUpdatedTime(timestamp);
-// workflowDataResource.save();
-//
-// nodeDataResource = workflowDataResource.createNodeData("testNodeID");
-// gramDataResource = workflowDataResource.createGramData("testNodeID");
-//
-// nodeDataResource.setWorkflowDataResource(workflowDataResource);
-// nodeDataResource.setInputs("testInput");
-// nodeDataResource.setOutputs("testOutput");
-// nodeDataResource.setStatus("testStatus");
-// nodeDataResource.save();
-//
-// gramDataResource.setRsl("testRSL");
-// gramDataResource.setWorkflowDataResource(workflowDataResource);
-// gramDataResource.save();
-// }
-//
-// public void testCreate() throws Exception {
-// assertNotNull("node data resource created successfully", nodeDataResource);
-// assertNotNull("gram data resource created successfully", gramDataResource);
-// }
-//
-// public void testGet() throws Exception {
-// assertNotNull("Node data retrieved successfully", workflowDataResource.getNodeData("testNodeID"));
-// assertNotNull("Gram data retrieved successfully", workflowDataResource.getGramData("testNodeID"));
-// }
-//
-// public void testGetList() throws Exception {
-// assertNotNull("Node data retrieved successfully", workflowDataResource.getNodeData());
-// assertNotNull("Gram data retrieved successfully", workflowDataResource.getGramData());
-// }
-//
-// public void testRemove() throws Exception {
-// workflowDataResource.removeNodeData("testNodeID");
-// workflowDataResource.removeGramData("testNodeID");
-//
-// assertTrue("node date removed successfully", !workflowDataResource.isNodeExists("testNodeID"));
-// assertTrue("gram date removed successfully", !workflowDataResource.isGramDataExists("testNodeID"));
-//
-// }
-//
-// public void testSave() throws Exception {
-// assertTrue("workflow data saved successfully", experimentResource.isExists(ResourceType.WORKFLOW_DATA, "testWFInstance"));
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-//
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowNodeDetailResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowNodeDetailResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowNodeDetailResourceTest.java
deleted file mode 100644
index 19590e6..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowNodeDetailResourceTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * 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 static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.sql.Timestamp;
-import java.util.Date;
-
-import org.apache.airavata.persistance.registry.jpa.resources.ExperimentResource;
-import org.apache.airavata.persistance.registry.jpa.resources.WorkflowNodeDetailResource;
-import org.junit.Before;
-import org.junit.Test;
-
-public class WorkflowNodeDetailResourceTest extends AbstractResourceTest {
-
- private ExperimentResource experimentResource;
- private WorkflowNodeDetailResource nodeDetailResource;
- private String experimentID = "testExpID";
- private String applicationID = "testAppID";
- private String nodeID = "testNode";
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- Timestamp creationTime = new Timestamp(new Date().getTime());
-
- experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- experimentResource.setCreationTime(creationTime);
- experimentResource.setApplicationId(applicationID);
- experimentResource.save();
-
- nodeDetailResource = (WorkflowNodeDetailResource) experimentResource.create(ResourceType.WORKFLOW_NODE_DETAIL);
- nodeDetailResource.setExperimentId(experimentResource.getExpID());
- nodeDetailResource.setNodeInstanceId(nodeID);
- nodeDetailResource.setNodeName(nodeID);
- nodeDetailResource.setCreationTime(creationTime);
- nodeDetailResource.save();
-
- }
-
- @Test
- public void testCreate() throws Exception {
- assertNotNull("task data resource has being created ", nodeDetailResource);
- }
-
- @Test
- public void testSave() throws Exception {
- assertTrue("task save successfully", experimentResource.isExists(ResourceType.WORKFLOW_NODE_DETAIL, nodeID));
- }
-
- @Test
- public void testGet() throws Exception {
- assertNotNull("task data retrieved successfully", experimentResource.get(ResourceType.WORKFLOW_NODE_DETAIL, nodeID));
- }
-
- @Test
- public void testRemove() throws Exception {
- experimentResource.remove(ResourceType.WORKFLOW_NODE_DETAIL, nodeID);
- assertFalse("task data removed successfully", experimentResource.isExists(ResourceType.WORKFLOW_NODE_DETAIL, nodeID));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
deleted file mode 100644
index 6ebf1d9..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- *
- * 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.util;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-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.UserResource;
-import org.apache.airavata.persistance.registry.jpa.resources.Utils;
-import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.derby.drda.NetworkServerControl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.InetAddress;
-import java.sql.*;
-import java.util.StringTokenizer;
-
-public class Initialize {
- private static final Logger logger = LoggerFactory.getLogger(Initialize.class);
- public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
- public String scriptName = "registry-derby.sql";
- private NetworkServerControl server;
- private static final String delimiter = ";";
- public static final String PERSISTANT_DATA = "Configuration";
-
- public Initialize(String scriptName) {
- this.scriptName = scriptName;
- }
-
- public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
- if (suffix.length() > buffer.length()) {
- return false;
- }
- // this loop is done on purpose to avoid memory allocation performance
- // problems on various JDKs
- // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
- // implementation is ok though does allocation/copying
- // StringBuffer.toString().endsWith() does massive memory
- // allocation/copying on JDK 1.5
- // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
- int endIndex = suffix.length() - 1;
- int bufferIndex = buffer.length() - 1;
- while (endIndex >= 0) {
- if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
- return false;
- }
- bufferIndex--;
- endIndex--;
- }
- return true;
- }
-
- private static boolean isServerStarted(NetworkServerControl server, int ntries)
- {
- for (int i = 1; i <= ntries; i ++)
- {
- try {
- Thread.sleep(500);
- server.ping();
- return true;
- }
- catch (Exception e) {
- if (i == ntries)
- return false;
- }
- }
- return false;
- }
-
- public void initializeDB() throws SQLException{
- String jdbcUrl = null;
- String jdbcUser = null;
- String jdbcPassword = null;
- try{
- jdbcUrl = ServerSettings.getSetting("registry.jdbc.url");
- jdbcUser = ServerSettings.getSetting("registry.jdbc.user");
- jdbcPassword = ServerSettings.getSetting("registry.jdbc.password");
- jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
- } catch (ApplicationSettingsException e) {
- logger.error("Unable to read properties", e);
- }
- startDerbyInServerMode();
- if(!isServerStarted(server, 20)){
- throw new RuntimeException("Derby server cound not started within five seconds...");
- }
-
- Connection conn = null;
- try {
- Class.forName(Utils.getJDBCDriver()).newInstance();
- conn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword);
- if (!isDatabaseStructureCreated(PERSISTANT_DATA, conn)) {
- executeSQLScript(conn);
- logger.info("New Database created for Registry");
- } else {
- logger.debug("Database already created for Registry!");
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RuntimeException("Database failure", e);
- } finally {
- try {
- if (conn != null){
- if (!conn.getAutoCommit()) {
- conn.commit();
- }
- conn.close();
- }
- } catch (SQLException e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- try{
- GatewayResource gatewayResource = new GatewayResource();
- gatewayResource.setGatewayId(ServerSettings.getSetting("default.registry.gateway"));
- gatewayResource.setGatewayName(ServerSettings.getSetting("default.registry.gateway"));
- gatewayResource.setDomain("test-domain");
- gatewayResource.setEmailAddress("test-email");
- gatewayResource.save();
-
- UserResource userResource = new UserResource();
- userResource.setUserName(ServerSettings.getSetting("default.registry.user"));
- userResource.setPassword(ServerSettings.getSetting("default.registry.password"));
- userResource.save();
-
- WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
- workerResource.setUser(userResource.getUserName());
- workerResource.save();
-
- ProjectResource projectResource = (ProjectResource)workerResource.create(ResourceType.PROJECT);
- projectResource.setGatewayId(gatewayResource.getGatewayId());
- projectResource.setId("default");
- projectResource.setName("default");
- projectResource.setWorker(workerResource);
- projectResource.save();
-
-
- } catch (ApplicationSettingsException e) {
- logger.error("Unable to read properties", e);
- throw new SQLException(e.getMessage(), e);
- } catch (RegistryException e) {
- logger.error("Unable to save data to registry", e);
- throw new SQLException(e.getMessage(), e);
- }
- }
-
- public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
- try {
- System.out.println("Running a query to test the database tables existence.");
- // check whether the tables are already created with a query
- Statement statement = null;
- try {
- statement = conn.createStatement();
- ResultSet rs = statement.executeQuery("select * from " + tableName);
- if (rs != null) {
- rs.close();
- }
- } finally {
- try {
- if (statement != null) {
- statement.close();
- }
- } catch (SQLException e) {
- return false;
- }
- }
- } catch (SQLException e) {
- return false;
- }
-
- return true;
- }
-
- private void executeSQLScript(Connection conn) throws Exception {
- StringBuffer sql = new StringBuffer();
- BufferedReader reader = null;
- try{
-
- InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(scriptName);
- reader = new BufferedReader(new InputStreamReader(inputStream));
- String line;
- while ((line = reader.readLine()) != null) {
- line = line.trim();
- if (line.startsWith("//")) {
- continue;
- }
- if (line.startsWith("--")) {
- continue;
- }
- StringTokenizer st = new StringTokenizer(line);
- if (st.hasMoreTokens()) {
- String token = st.nextToken();
- if ("REM".equalsIgnoreCase(token)) {
- continue;
- }
- }
- sql.append(" ").append(line);
-
- // SQL defines "--" as a comment to EOL
- // and in Oracle it may contain a hint
- // so we cannot just remove it, instead we must end it
- if (line.indexOf("--") >= 0) {
- sql.append("\n");
- }
- if ((checkStringBufferEndsWith(sql, delimiter))) {
- executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
- sql.replace(0, sql.length(), "");
- }
- }
- // Catch any statements not followed by ;
- if (sql.length() > 0) {
- executeSQL(sql.toString(), conn);
- }
- }catch (IOException e){
- logger.error("Error occurred while executing SQL script for creating Airavata database", e);
- throw new Exception("Error occurred while executing SQL script for creating Airavata database", e);
- }finally {
- if (reader != null) {
- reader.close();
- }
-
- }
-
- }
-
- private static void executeSQL(String sql, Connection conn) throws Exception {
- // Check and ignore empty statements
- if ("".equals(sql.trim())) {
- return;
- }
-
- Statement statement = null;
- try {
- logger.debug("SQL : " + sql);
-
- boolean ret;
- int updateCount = 0, updateCountTotal = 0;
- statement = conn.createStatement();
- ret = statement.execute(sql);
- updateCount = statement.getUpdateCount();
- do {
- if (!ret) {
- if (updateCount != -1) {
- updateCountTotal += updateCount;
- }
- }
- ret = statement.getMoreResults();
- if (ret) {
- updateCount = statement.getUpdateCount();
- }
- } while (ret);
-
- logger.debug(sql + " : " + updateCountTotal + " rows affected");
-
- SQLWarning warning = conn.getWarnings();
- while (warning != null) {
- logger.warn(warning + " sql warning");
- warning = warning.getNextWarning();
- }
- conn.clearWarnings();
- } catch (SQLException e) {
- if (e.getSQLState().equals("X0Y32")) {
- // eliminating the table already exception for the derby
- // database
- logger.info("Table Already Exists", e);
- } else {
- throw new Exception("Error occurred while executing : " + sql, e);
- }
- } finally {
- if (statement != null) {
- try {
- statement.close();
- } catch (SQLException e) {
- logger.error("Error occurred while closing result set.", e);
- }
- }
- }
- }
-
- private void startDerbyInServerMode() {
- try {
- System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
- server = new NetworkServerControl(InetAddress.getByName(Utils.getHost()),
- 20000,
- Utils.getJDBCUser(), Utils.getJDBCPassword());
- java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
- server.start(consoleWriter);
- } catch (IOException e) {
- logger.error("Unable to start Apache derby in the server mode! Check whether " +
- "specified port is available");
- } catch (Exception e) {
- logger.error("Unable to start Apache derby in the server mode! Check whether " +
- "specified port is available");
- }
-
- }
-
- public void stopDerbyServer() throws SQLException{
- try {
- server.shutdown();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new SQLException("Error while stopping derby server", e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java
deleted file mode 100644
index 0b32b82..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- *
- * 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.provenance.test;
-
-import static org.junit.Assert.assertTrue;
-
-public class JpaTest {
-// private static final String PERSISTENCE_UNIT_NAME = "airavata_provenance";
-// private EntityManagerFactory factory;
-//
-// @Before
-// public void setUp() throws Exception {
-// factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
-// EntityManager em = factory.createEntityManager();
-//
-// // Begin a new local transaction so that we can persist a new entity
-// em.getTransaction().begin();
-//
-// // Read the existing entries
-// Query q = em.createQuery("select m from Experiment_Data m");
-// // Persons should be empty
-//
-// // Do we have entries?
-// boolean createNewEntries = (q.getResultList().size() == 0);
-//
-// // No, so lets create new entries
-// if (createNewEntries) {
-// assertTrue(q.getResultList().size() == 0);
-// Experiment_Data data = new Experiment_Data();
-// data.setExperiment_ID("Experiement_ID1");
-// data.setName("Name1");
-// em.persist(data);
-// for (int i = 0; i < 5; i++) {
-// Workflow_Data wData = new Workflow_Data();
-// wData.setWorkflow_instanceID("instance_ID" + i);
-// wData.setExperiment_Data(data);
-// em.persist(wData);
-// for (int j = 0; j < 5; j++) {
-// Node_Data nData = new Node_Data();
-// nData.setNode_id("node_ID" + j);
-// nData.setWorkflow_Data(wData);
-// em.persist(nData);
-//
-// Gram_Data gData = new Gram_Data();
-// gData.setNode_id("node_ID" + j);
-// gData.setWorkflow_Data(wData);
-// em.persist(gData);
-// }
-// // Now persists the family person relationship
-// // data.getWorkflows().add(wData);
-// // em.persist(wData);
-// // em.persist(data);
-// }
-// }
-//
-// // Commit the transaction, which will cause the entity to
-// // be stored in the database
-// em.getTransaction().commit();
-//
-// // It is always good practice to close the EntityManager so that
-// // resources are conserved.
-// em.close();
-//
-// }
-//
-// @Test
-// public void checkInsertedWorkflow() {
-//
-// // Now lets check the database and see if the created entries are there
-// // Create a fresh, new EntityManager
-// EntityManager em = factory.createEntityManager();
-//
-// // Perform a simple query for all the Message entities
-// Query q = em.createQuery("select m from Workflow_Data m");
-//
-// // We should have 5 Persons in the database
-// assertTrue(q.getResultList().size() == 5);
-//
-// em.close();
-// }
-//
-// @Test
-// public void checkInsertedNode() {
-// EntityManager em = factory.createEntityManager();
-//
-// Query q = em.createQuery("select m from Node_Data m");
-//
-// assertTrue(q.getResultList().size() == 25);
-//
-// em.close();
-// }
-//
-// @Test (expected = javax.persistence.NoResultException.class)
-// public void deleteNode_Data() throws InterruptedException {
-// Thread.sleep(1000);
-// EntityManager em = factory.createEntityManager();
-// // Begin a new local transaction so that we can persist a new entity
-// em.getTransaction().begin();
-// Query q = em.createQuery("SELECT p FROM Experiment_Data p WHERE p.experiment_ID = :firstName");
-// q.setParameter("firstName", "Experiement_ID1");
-// Experiment_Data eData = (Experiment_Data) q.getSingleResult();
-//
-// q = em.createQuery("SELECT p FROM Workflow_Data p WHERE p.experiment_Data = :firstName AND p.workflow_instanceID = :lastName");
-// q.setParameter("firstName", eData);
-// q.setParameter("lastName", "instance_ID4");
-// Workflow_Data wData = (Workflow_Data) q.getSingleResult();
-//
-// q = em.createQuery("SELECT p FROM Node_Data p WHERE p.workflow_Data = :firstName AND p.node_id = :lastName");
-// q.setParameter("firstName", wData);
-// q.setParameter("lastName", "node_ID4");
-// Node_Data nData = (Node_Data) q.getSingleResult();
-//
-// //System.out.println(nData.getStart_time());
-// em.remove(nData);
-//
-// q = em.createQuery("SELECT p FROM Node_Data p WHERE p.workflow_Data = :firstName AND p.node_id = :lastName");
-// q.setParameter("firstName", wData);
-// q.setParameter("lastName", "node_ID3");
-// nData = (Node_Data) q.getSingleResult();
-// nData.setStatus("finished");
-// Thread.sleep(5000);
-// em.getTransaction().commit();
-//
-// q = em.createQuery("SELECT p FROM Node_Data p WHERE p.workflow_Data = :firstName AND p.node_id = :lastName");
-// q.setParameter("firstName", wData);
-// q.setParameter("lastName", "node_ID4");
-// Node_Data person = (Node_Data) q.getSingleResult();
-// person.getInputs();
-// // Begin a new local transaction so that we can persist a new entity
-//
-// em.close();
-// }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/resources/registry-derby.sql
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/resources/registry-derby.sql b/modules/registry/airavata-jpa-registry/src/test/resources/registry-derby.sql
deleted file mode 100644
index 7ab3755..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/resources/registry-derby.sql
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- *
- * 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.
- *
- */
-CREATE TABLE GATEWAY
-(
- GATEWAY_ID VARCHAR (255),
- GATEWAY_NAME VARCHAR(255),
- DOMAIN VARCHAR(255),
- EMAIL_ADDRESS VARCHAR(255),
- PRIMARY KEY (GATEWAY_ID)
-);
-
-CREATE TABLE CONFIGURATION
-(
- CONFIG_KEY VARCHAR(255),
- CONFIG_VAL VARCHAR(255),
- EXPIRE_DATE TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- CATEGORY_ID VARCHAR (255),
- PRIMARY KEY(CONFIG_KEY, CONFIG_VAL, CATEGORY_ID)
-);
-
-INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL, EXPIRE_DATE, CATEGORY_ID) VALUES('registry.version', '0.15', CURRENT_TIMESTAMP ,'SYSTEM');
-
-CREATE TABLE USERS
-(
- USER_NAME VARCHAR(255),
- PASSWORD VARCHAR(255),
- PRIMARY KEY(USER_NAME)
-);
-
-CREATE TABLE GATEWAY_WORKER
-(
- GATEWAY_ID VARCHAR(255),
- USER_NAME VARCHAR(255),
- PRIMARY KEY (GATEWAY_ID, USER_NAME),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE PROJECT
-(
- GATEWAY_ID VARCHAR(255),
- USER_NAME VARCHAR(255) NOT NULL,
- PROJECT_ID VARCHAR(255),
- PROJECT_NAME VARCHAR(255) NOT NULL,
- DESCRIPTION VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (PROJECT_ID),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE PROJECT_USER
-(
- PROJECT_ID VARCHAR(255),
- USER_NAME VARCHAR(255),
- PRIMARY KEY (PROJECT_ID,USER_NAME),
- FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT
-(
- EXPERIMENT_ID VARCHAR(255),
- GATEWAY_ID VARCHAR(255),
- EXECUTION_USER VARCHAR(255) NOT NULL,
- PROJECT_ID VARCHAR(255) NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- EXPERIMENT_NAME VARCHAR(255) NOT NULL,
- EXPERIMENT_DESCRIPTION VARCHAR(255),
- APPLICATION_ID VARCHAR(255),
- APPLICATION_VERSION VARCHAR(255),
- WORKFLOW_TEMPLATE_ID VARCHAR(255),
- WORKFLOW_TEMPLATE_VERSION VARCHAR(255),
- WORKFLOW_EXECUTION_ID VARCHAR(255),
- ALLOW_NOTIFICATION SMALLINT,
- GATEWAY_EXECUTION_ID VARCHAR(255),
- PRIMARY KEY(EXPERIMENT_ID),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (EXECUTION_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE,
- FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT_INPUT
-(
- EXPERIMENT_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- VALUE CLOB,
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(EXPERIMENT_ID,INPUT_KEY),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT_OUTPUT
-(
- EXPERIMENT_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE CLOB,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(EXPERIMENT_ID,OUTPUT_KEY),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-
-CREATE TABLE WORKFLOW_NODE_DETAIL
-(
- EXPERIMENT_ID VARCHAR(255) NOT NULL,
- NODE_INSTANCE_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- NODE_NAME VARCHAR(255) NOT NULL,
- EXECUTION_UNIT VARCHAR(255) NOT NULL,
- EXECUTION_UNIT_DATA VARCHAR(255),
- PRIMARY KEY(NODE_INSTANCE_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE TASK_DETAIL
-(
- TASK_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- APPLICATION_ID VARCHAR(255),
- APPLICATION_VERSION VARCHAR(255),
- APPLICATION_DEPLOYMENT_ID VARCHAR(255),
- ALLOW_NOTIFICATION SMALLINT,
- PRIMARY KEY(TASK_ID),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NOTIFICATION_EMAIL
-(
- EMAIL_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- EMAIL_ADDRESS VARCHAR(255),
- PRIMARY KEY(EMAIL_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ERROR_DETAIL
-(
- ERROR_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- JOB_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- ACTUAL_ERROR_MESSAGE CLOB,
- USER_FRIEDNLY_ERROR_MSG VARCHAR(255),
- TRANSIENT_OR_PERSISTENT SMALLINT,
- ERROR_CATEGORY VARCHAR(255),
- CORRECTIVE_ACTION VARCHAR(255),
- ACTIONABLE_GROUP VARCHAR(255),
- PRIMARY KEY(ERROR_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_INPUT
-(
- TASK_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- VALUE CLOB,
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(TASK_ID,INPUT_KEY),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_OUTPUT
-(
- TASK_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE CLOB,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(TASK_ID,OUTPUT_KEY),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NODE_INPUT
-(
- NODE_INSTANCE_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- VALUE VARCHAR(255),
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(NODE_INSTANCE_ID,INPUT_KEY),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NODE_OUTPUT
-(
- NODE_INSTANCE_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE VARCHAR(255),
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(NODE_INSTANCE_ID,OUTPUT_KEY),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE JOB_DETAIL
-(
- JOB_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- JOB_DESCRIPTION CLOB NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- COMPUTE_RESOURCE_CONSUMED VARCHAR(255),
- JOBNAME VARCHAR (255),
- WORKING_DIR VARCHAR(255),
- PRIMARY KEY (TASK_ID, JOB_ID),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE DATA_TRANSFER_DETAIL
-(
- TRANSFER_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- TRANSFER_DESC VARCHAR(255) NOT NULL,
- PRIMARY KEY(TRANSFER_ID),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE STATUS
-(
- STATUS_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- TRANSFER_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- JOB_ID VARCHAR(255),
- STATE VARCHAR(255),
- STATUS_UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- STATUS_TYPE VARCHAR(255),
- PRIMARY KEY(STATUS_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE,
- FOREIGN KEY (TRANSFER_ID) REFERENCES DATA_TRANSFER_DETAIL(TRANSFER_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE CONFIG_DATA
-(
- EXPERIMENT_ID VARCHAR(255),
- AIRAVATA_AUTO_SCHEDULE SMALLINT NOT NULL,
- OVERRIDE_MANUAL_SCHEDULE_PARAMS SMALLINT NOT NULL,
- SHARE_EXPERIMENT SMALLINT,
- USER_DN VARCHAR(255),
- GENERATE_CERT SMALLINT,
- PRIMARY KEY(EXPERIMENT_ID)
-);
-
-CREATE TABLE COMPUTATIONAL_RESOURCE_SCHEDULING
-(
- RESOURCE_SCHEDULING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- RESOURCE_HOST_ID VARCHAR(255),
- CPU_COUNT INTEGER,
- NODE_COUNT INTEGER,
- NO_OF_THREADS INTEGER,
- QUEUE_NAME VARCHAR(255),
- WALLTIME_LIMIT INTEGER,
- JOB_START_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- TOTAL_PHYSICAL_MEMORY INTEGER,
- COMPUTATIONAL_PROJECT_ACCOUNT VARCHAR(255),
- CHESSIS_NAME VARCHAR(255),
- PRIMARY KEY(RESOURCE_SCHEDULING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ADVANCE_INPUT_DATA_HANDLING
-(
- INPUT_DATA_HANDLING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- WORKING_DIR_PARENT VARCHAR(255),
- UNIQUE_WORKING_DIR VARCHAR(255),
- STAGE_INPUT_FILES_TO_WORKING_DIR SMALLINT,
- CLEAN_AFTER_JOB SMALLINT,
- PRIMARY KEY(INPUT_DATA_HANDLING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ADVANCE_OUTPUT_DATA_HANDLING
-(
- OUTPUT_DATA_HANDLING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- OUTPUT_DATA_DIR VARCHAR(255),
- DATA_REG_URL VARCHAR (255),
- PERSIST_OUTPUT_DATA SMALLINT,
- PRIMARY KEY(OUTPUT_DATA_HANDLING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE QOS_PARAM
-(
- QOS_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- START_EXECUTION_AT VARCHAR(255),
- EXECUTE_BEFORE VARCHAR(255),
- NO_OF_RETRIES INTEGER,
- PRIMARY KEY(QOS_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE COMMUNITY_USER
-(
- GATEWAY_ID VARCHAR(256) NOT NULL,
- COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
- TOKEN_ID VARCHAR(256) NOT NULL,
- COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
- PRIMARY KEY (GATEWAY_ID, COMMUNITY_USER_NAME, TOKEN_ID)
-);
-
-CREATE TABLE CREDENTIALS
-(
- GATEWAY_ID VARCHAR(256) NOT NULL,
- TOKEN_ID VARCHAR(256) NOT NULL,
- CREDENTIAL BLOB NOT NULL,
- PORTAL_USER_ID VARCHAR(256) NOT NULL,
- TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
-);
-
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/pom.xml
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/pom.xml b/modules/registry/experiment-catalog/pom.xml
new file mode 100644
index 0000000..c624e2e
--- /dev/null
+++ b/modules/registry/experiment-catalog/pom.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--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. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>registry</artifactId>
+ <version>0.16-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>airavata-experiment-catalog</artifactId>
+ <packaging>jar</packaging>
+ <name>Airavata Experiment Catalog</name>
+ <url>http://airavata.apache.org/</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <!--dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-common-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency-->
+ <!-- Test -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-all</artifactId>
+ <version>2.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-credential-store</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-data-models</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-registry-cpi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!--dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>${mysql.connector.version}</version>
+ </dependency-->
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>${derby.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbyclient</artifactId>
+ <version>${derby.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbynet</artifactId>
+ <version>${derby.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbytools</artifactId>
+ <version>${derby.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-server-configuration</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>${antrun.version}</version>
+ <executions>
+ <execution>
+ <phase>process-classes</phase>
+ <configuration>
+ <tasks>
+ <taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask" classpathref="maven.compile.classpath" />
+ <openjpac>
+ <classpath refid="maven.compile.classpath" />
+ </openjpac>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
+ <inherited>true</inherited>
+ <configuration>
+ <failIfNoTests>false</failIfNoTests>
+ <skipTests>${skipTests}</skipTests>
+ <workingDirectory>${project.build.testOutputDirectory}</workingDirectory>
+ <!-- making sure that the sure-fire plugin doesn't run the integration tests-->
+ <!-- Integration tests are run using the fail-safe plugin in the module pom-->
+ <excludes>
+ <exclude>**/TaskDetailResourceTest.java</exclude>
+ <exclude>**/WorkflowNodeDetailResourceTest.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/JPAConstants.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/JPAConstants.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/JPAConstants.java
new file mode 100644
index 0000000..b558d03
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/JPAConstants.java
@@ -0,0 +1,33 @@
+/*
+ *
+ * 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.experiment.catalog;
+
+public class JPAConstants {
+ public static final String KEY_JDBC_URL = "registry.jdbc.url";
+ public static final String KEY_JDBC_USER = "registry.jdbc.user";
+ public static final String KEY_JDBC_PASSWORD = "registry.jdbc.password";
+ public static final String KEY_JDBC_DRIVER = "registry.jdbc.driver";
+ public static final String KEY_DERBY_START_ENABLE = "start.derby.server.mode";
+ public static final String VALIDATION_QUERY = "validationQuery";
+ public static final String JPA_CACHE_SIZE = "jpa.cache.size";
+ public static final String ENABLE_CACHING = "cache.enable";
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/Resource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/Resource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/Resource.java
new file mode 100644
index 0000000..bdfd948
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/Resource.java
@@ -0,0 +1,71 @@
+/*
+ *
+ * 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.experiment.catalog;
+
+import org.apache.airavata.registry.cpi.RegistryException;
+
+import java.util.List;
+
+public interface Resource {
+ /**
+ * This method will create associate resource objects for the given resource type.
+ * @param type child resource type
+ * @return associate child resource
+ */
+ Resource create(ResourceType type) throws RegistryException, RegistryException;
+
+ /**
+ * This method will remove the given child resource from the database
+ * @param type child resource type
+ * @param name child resource name
+ */
+ void remove(ResourceType type, Object name) throws RegistryException;
+
+ /**
+ * This method will return the given child resource from the database
+ * @param type child resource type
+ * @param name child resource name
+ * @return associate child resource
+ */
+ Resource get(ResourceType type, Object name) throws RegistryException;
+
+ /**
+ * This method will list all the child resources for the given resource type
+ * @param type child resource type
+ * @return list of child resources of the given child resource type
+ */
+ List<Resource> get(ResourceType type) throws RegistryException;
+
+ /**
+ * This method will save the resource to the database.
+ */
+ void save() throws RegistryException;
+
+ /**
+ * This method will check whether an entry from the given resource type and resource name
+ * exists in the database
+ * @param type child resource type
+ * @param name child resource name
+ * @return whether the entry exists in the database or not
+ */
+ boolean isExists(ResourceType type, Object name) throws RegistryException;
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceType.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceType.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceType.java
new file mode 100644
index 0000000..ea66a90
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceType.java
@@ -0,0 +1,50 @@
+/*
+ *
+ * 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.experiment.catalog;
+
+public enum ResourceType {
+ GATEWAY,
+ PROJECT,
+ USER,
+ PROJECT_USER,
+ CONFIGURATION,
+ GATEWAY_WORKER,
+ EXPERIMENT,
+ EXPERIMENT_SUMMARY,
+ NOTIFICATION_EMAIL,
+ EXPERIMENT_INPUT,
+ EXPERIMENT_OUTPUT,
+ WORKFLOW_NODE_DETAIL,
+ TASK_DETAIL,
+ ERROR_DETAIL,
+ APPLICATION_INPUT,
+ APPLICATION_OUTPUT,
+ NODE_INPUT,
+ NODE_OUTPUT,
+ JOB_DETAIL,
+ DATA_TRANSFER_DETAIL,
+ STATUS,
+ CONFIG_DATA,
+ COMPUTATIONAL_RESOURCE_SCHEDULING,
+ ADVANCE_INPUT_DATA_HANDLING,
+ ADVANCE_OUTPUT_DATA_HANDLING,
+ QOS_PARAM
+}
[10/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/GatewayRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/GatewayRegistry.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/GatewayRegistry.java
new file mode 100644
index 0000000..a98de72
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/GatewayRegistry.java
@@ -0,0 +1,115 @@
+/*
+ *
+ * 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.experiment.catalog.impl;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.model.workspace.Gateway;
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.resources.GatewayResource;
+import org.apache.airavata.experiment.catalog.utils.ThriftDataModelConversion;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class GatewayRegistry {
+
+ private final static Logger logger = LoggerFactory.getLogger(GatewayRegistry.class);
+ public GatewayResource getDefaultGateway () throws ApplicationSettingsException, RegistryException {
+ return (GatewayResource)ResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
+ }
+
+ public GatewayResource getExistingGateway (String gatewayName) throws RegistryException {
+ return (GatewayResource)ResourceUtils.getGateway(gatewayName);
+ }
+
+ public String addGateway (Gateway gateway) throws RegistryException{
+ try {
+ GatewayResource resource = (GatewayResource)ResourceUtils.createGateway(gateway.getGatewayId());
+ resource.setGatewayName(gateway.getGatewayName());
+ resource.setEmailAddress(gateway.getEmailAddress());
+ resource.setDomain(gateway.getDomain());
+ resource.save();
+ return gateway.getGatewayId();
+ }catch (RegistryException e){
+ logger.error("Error while saving gateway to registry", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public void updateGateway (String gatewayId, Gateway updatedGateway) throws RegistryException{
+ try {
+ GatewayResource existingGateway = (GatewayResource)ResourceUtils.getGateway(gatewayId);
+ existingGateway.setGatewayName(updatedGateway.getGatewayName());
+ existingGateway.setEmailAddress(updatedGateway.getEmailAddress());
+ existingGateway.setDomain(updatedGateway.getDomain());
+ existingGateway.save();
+ }catch (RegistryException e){
+ logger.error("Error while updating gateway to registry", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public Gateway getGateway (String gatewayId) throws RegistryException{
+ try {
+ GatewayResource resource = (GatewayResource)ResourceUtils.getGateway(gatewayId);
+ return ThriftDataModelConversion.getGateway(resource);
+ }catch (RegistryException e){
+ logger.error("Error while getting gateway", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public boolean isGatewayExist (String gatewayId) throws RegistryException{
+ try {
+ return ResourceUtils.isGatewayExist(gatewayId);
+ }catch (RegistryException e){
+ logger.error("Error while checking gateway exists", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public boolean removeGateway (String gatewayId) throws RegistryException{
+ try {
+ return ResourceUtils.removeGateway(gatewayId);
+ }catch (Exception e){
+ logger.error("Error while removing the gateway", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public List<Gateway> getAllGateways () throws RegistryException {
+ List<Gateway> gatewayList = new ArrayList<Gateway>();
+ try {
+ List<Resource> allGateways = ResourceUtils.getAllGateways();
+ return ThriftDataModelConversion.getAllGateways(allGateways);
+ }catch (Exception e){
+ logger.error("Error while getting all the gateways", e);
+ throw new RegistryException(e);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/LoggingRegistryImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/LoggingRegistryImpl.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/LoggingRegistryImpl.java
new file mode 100644
index 0000000..d4b735a
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/LoggingRegistryImpl.java
@@ -0,0 +1,97 @@
+/*
+ *
+ * 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.experiment.catalog.impl;
+
+import org.apache.airavata.registry.cpi.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.Map;
+
+public class LoggingRegistryImpl implements Registry {
+ private final static Logger logger = LoggerFactory.getLogger(LoggingRegistryImpl.class);
+
+ @Override
+ public Object add(ParentDataType dataType, Object newObjectToAdd, String gatewayId) throws RegistryException {
+ return null;
+ }
+
+ @Override
+ public Object add(ChildDataType dataType, Object newObjectToAdd, Object dependentIdentifiers) throws RegistryException {
+ return null;
+ }
+
+ @Override
+ public void update(RegistryModelType dataType, Object newObjectToUpdate, Object identifier) throws RegistryException {
+
+ }
+
+ @Override
+ public void update(RegistryModelType dataType, Object identifier, String fieldName, Object value) throws RegistryException {
+
+ }
+
+ @Override
+ public Object get(RegistryModelType dataType, Object identifier) throws RegistryException {
+ return null;
+ }
+
+ @Override
+ public List<Object> get(RegistryModelType dataType, String fieldName, Object value) throws RegistryException {
+ return null;
+ }
+
+ @Override
+ public List<Object> get(RegistryModelType dataType, String fieldName, Object value, int limit, int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
+ return null;
+ }
+
+ @Override
+ public List<Object> search(RegistryModelType dataType, Map<String, String> filters) throws RegistryException {
+ return null;
+ }
+
+ @Override
+ public List<Object> search(RegistryModelType dataType, Map<String, String> filters, int limit, int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
+ return null;
+ }
+
+ @Override
+ public Object getValue(RegistryModelType dataType, Object identifier, String field) throws RegistryException {
+ return null;
+ }
+
+ @Override
+ public List<String> getIds(RegistryModelType dataType, String fieldName, Object value) throws RegistryException {
+ return null;
+ }
+
+ @Override
+ public void remove(RegistryModelType dataType, Object identifier) throws RegistryException {
+
+ }
+
+ @Override
+ public boolean isExist(RegistryModelType dataType, Object identifier) throws RegistryException {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/ProjectRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/ProjectRegistry.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/ProjectRegistry.java
new file mode 100644
index 0000000..52a9ee4
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/ProjectRegistry.java
@@ -0,0 +1,303 @@
+/*
+ *
+ * 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.experiment.catalog.impl;
+
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.model.workspace.Project;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.resources.*;
+import org.apache.airavata.experiment.catalog.utils.ThriftDataModelConversion;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.apache.airavata.registry.cpi.ResultOrderType;
+import org.apache.airavata.registry.cpi.utils.Constants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.*;
+
+public class ProjectRegistry {
+ private GatewayResource gatewayResource;
+ private WorkerResource workerResource;
+ private final static Logger logger = LoggerFactory.getLogger(ProjectRegistry.class);
+
+ public ProjectRegistry(GatewayResource gatewayResource, UserResource user) throws RegistryException {
+ if (!ResourceUtils.isGatewayExist(gatewayResource.getGatewayId())){
+ this.gatewayResource = gatewayResource;
+ }else {
+ this.gatewayResource = (GatewayResource)ResourceUtils.getGateway(gatewayResource.getGatewayId());
+ }
+ if (!gatewayResource.isExists(ResourceType.GATEWAY_WORKER, user.getUserName())){
+ workerResource = ResourceUtils.addGatewayWorker(gatewayResource, user);
+ }else {
+ workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayId(),
+ user.getUserName());
+ }
+ }
+
+ public String addProject (Project project, String gatewayId) throws RegistryException{
+ String projectId;
+ try {
+ if (!ResourceUtils.isUserExist(project.getOwner())){
+ ResourceUtils.addUser(project.getOwner(), null);
+ }
+ ProjectResource projectResource = new ProjectResource();
+ projectId = getProjectId(project.getName());
+ projectResource.setId(projectId);
+ project.setProjectID(projectId);
+ projectResource.setName(project.getName());
+ projectResource.setDescription(project.getDescription());
+ projectResource.setCreationTime(AiravataUtils.getTime(project.getCreationTime()));
+ projectResource.setGatewayId(gatewayId);
+ WorkerResource worker = new WorkerResource(project.getOwner(), gatewayId);
+ projectResource.setWorker(worker);
+ projectResource.save();
+ ProjectUserResource resource = (ProjectUserResource)projectResource.create(
+ ResourceType.PROJECT_USER);
+ resource.setProjectId(project.getProjectID());
+ resource.setUserName(project.getOwner());
+ resource.save();
+ List<String> sharedGroups = project.getSharedGroups();
+ if (sharedGroups != null && !sharedGroups.isEmpty()){
+ for (String group : sharedGroups){
+ //TODO - add shared groups
+ logger.info("Groups are not supported at the moment...");
+ }
+ }
+
+ List<String> sharedUsers = project.getSharedUsers();
+ if (sharedUsers != null && !sharedUsers.isEmpty()){
+ for (String username : sharedUsers){
+ ProjectUserResource pr = (ProjectUserResource)projectResource.
+ create(ResourceType.PROJECT_USER);
+ pr.setUserName(username);
+ pr.save();
+ }
+ }
+ }catch (Exception e){
+ logger.error("Error while saving project to registry", e);
+ throw new RegistryException(e);
+ }
+ return projectId;
+ }
+
+ private String getProjectId (String projectName){
+ String pro = projectName.replaceAll("\\s", "");
+ return pro + "_" + UUID.randomUUID();
+ }
+
+ public void updateProject (Project project, String projectId) throws RegistryException{
+ try {
+ ProjectResource existingProject = workerResource.getProject(projectId);
+ existingProject.setDescription(project.getDescription());
+ existingProject.setName(project.getName());
+// existingProject.setGateway(gatewayResource);
+ UserResource user = (UserResource)ResourceUtils.getUser(project.getOwner());
+ if (!gatewayResource.isExists(ResourceType.GATEWAY_WORKER, user.getUserName())){
+ workerResource = ResourceUtils.addGatewayWorker(gatewayResource, user);
+ }else {
+ workerResource = (WorkerResource)ResourceUtils.getWorker(
+ gatewayResource.getGatewayName(), user.getUserName());
+ }
+ WorkerResource worker = new WorkerResource(project.getOwner(), gatewayResource.getGatewayId());
+ existingProject.setWorker(worker);
+ existingProject.save();
+ ProjectUserResource resource = (ProjectUserResource)existingProject.create(
+ ResourceType.PROJECT_USER);
+ resource.setProjectId(projectId);
+ resource.setUserName(project.getOwner());
+ resource.save();
+ List<String> sharedGroups = project.getSharedGroups();
+ if (sharedGroups != null && !sharedGroups.isEmpty()){
+ for (String group : sharedGroups){
+ //TODO - add shared groups
+ logger.info("Groups are not supported at the moment...");
+ }
+ }
+
+ List<String> sharedUsers = project.getSharedUsers();
+ if (sharedUsers != null && !sharedUsers.isEmpty()){
+ for (String username : sharedUsers){
+ ProjectUserResource pr = (ProjectUserResource)existingProject.create(
+ ResourceType.PROJECT_USER);
+ pr.setUserName(username);
+ pr.save();
+ }
+ }
+ }catch (Exception e){
+ logger.error("Error while saving project to registry", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public Project getProject (String projectId) throws RegistryException{
+ try {
+ ProjectResource project = workerResource.getProject(projectId);
+ if (project != null){
+ return ThriftDataModelConversion.getProject(project);
+ }
+ }catch (Exception e){
+ logger.error("Error while retrieving project from registry", e);
+ throw new RegistryException(e);
+ }
+ return null;
+ }
+
+ /**
+ * Get list of projects of the user
+ * @param fieldName
+ * @param value
+ * @return
+ * @throws RegistryException
+ */
+ public List<Project> getProjectList (String fieldName, Object value) throws RegistryException{
+ return getProjectList(fieldName, value, -1, -1, null, null);
+ }
+
+ /**
+ * Get projects list with pagination and result ordering
+ * @param fieldName
+ * @param value
+ * @param limit
+ * @param offset
+ * @param orderByIdentifier
+ * @param resultOrderType
+ * @return
+ * @throws RegistryException
+ */
+ public List<Project> getProjectList (String fieldName, Object value, int limit, int offset,
+ Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException{
+ List<Project> projects = new ArrayList<Project>();
+ try {
+ if (fieldName.equals(Constants.FieldConstants.ProjectConstants.OWNER)){
+ workerResource.setUser((String)value);
+ List<ProjectResource> projectList = workerResource.getProjects();
+ if (projectList != null && !projectList.isEmpty()){
+ for (ProjectResource pr : projectList){
+ projects.add(ThriftDataModelConversion.getProject(pr));
+ }
+ }
+ return projects;
+ }
+ }catch (Exception e){
+ logger.error("Error while retrieving project from registry", e);
+ throw new RegistryException(e);
+ }
+ return projects;
+ }
+
+ /**
+ * To search projects of user with the given filter criteria. All the matching results will be sent.
+ * Results are not ordered in any order
+ * @param filters
+ * @return
+ * @throws RegistryException
+ */
+ public List<Project> searchProjects (Map<String, String> filters) throws RegistryException{
+ return searchProjects(filters, -1, -1, null, null);
+ }
+
+ /**
+ * To search the projects of user with the given filter criteria and retrieve the results with
+ * pagination support. Results can be ordered based on an identifier (i.e column) either ASC or
+ * DESC.
+ *
+ * @param filters
+ * @param limit
+ * @param offset
+ * @param orderByIdentifier
+ * @param resultOrderType
+ * @return
+ * @throws RegistryException
+ */
+ public List<Project> searchProjects(Map<String, String> filters, int limit,
+ int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
+ Map<String, String> fil = new HashMap<String, String>();
+ if (filters != null && filters.size() != 0){
+ List<Project> projects = new ArrayList<Project>();
+ try {
+ for (String field : filters.keySet()){
+ if (field.equals(Constants.FieldConstants.ProjectConstants.PROJECT_NAME)){
+ fil.put(AbstractResource.ProjectConstants.PROJECT_NAME, filters.get(field));
+ }else if (field.equals(Constants.FieldConstants.ProjectConstants.OWNER)){
+ fil.put(AbstractResource.ProjectConstants.USERNAME, filters.get(field));
+ }else if (field.equals(Constants.FieldConstants.ProjectConstants.DESCRIPTION)){
+ fil.put(AbstractResource.ProjectConstants.DESCRIPTION, filters.get(field));
+ }else if (field.equals(Constants.FieldConstants.ProjectConstants.GATEWAY_ID)){
+ fil.put(AbstractResource.ProjectConstants.GATEWAY_ID, filters.get(field));
+ }
+ }
+ List<ProjectResource> projectResources = workerResource
+ .searchProjects(fil, limit, offset, orderByIdentifier, resultOrderType);
+ if (projectResources != null && !projectResources.isEmpty()){
+ for (ProjectResource pr : projectResources){
+ projects.add(ThriftDataModelConversion.getProject(pr));
+ }
+ }
+ return projects;
+ }catch (Exception e){
+ logger.error("Error while retrieving project from registry", e);
+ throw new RegistryException(e);
+ }
+ }
+ return null;
+ }
+
+ public List<String> getProjectIDs (String fieldName, Object value) throws RegistryException{
+ List<String> projectIds = new ArrayList<String>();
+ try {
+ if (fieldName.equals(Constants.FieldConstants.ProjectConstants.OWNER)){
+ workerResource.setUser((String)value);
+ List<ProjectResource> projectList = workerResource.getProjects();
+ if (projectList != null && !projectList.isEmpty()){
+ for (ProjectResource pr : projectList){
+ projectIds.add(pr.getName());
+ }
+ }
+ return projectIds;
+ }
+ }catch (Exception e){
+ logger.error("Error while retrieving projects from registry", e);
+ throw new RegistryException(e);
+ }
+ return projectIds;
+ }
+
+ public void removeProject (String projectId) throws RegistryException {
+ try {
+ workerResource.removeProject(projectId);
+ } catch (Exception e) {
+ logger.error("Error while removing the project..", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public boolean isProjectExist(String projectId) throws RegistryException {
+ try {
+ return workerResource.isProjectExists(projectId);
+ } catch (Exception e) {
+ logger.error("Error while retrieving project...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/RegistryFactory.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/RegistryFactory.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/RegistryFactory.java
new file mode 100644
index 0000000..80eb09c
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/RegistryFactory.java
@@ -0,0 +1,80 @@
+/*
+ *
+ * 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.experiment.catalog.impl;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RegistryFactory {
+ private static Registry registry;
+ private static Logger logger = LoggerFactory.getLogger(RegistryFactory.class);
+
+ public static Registry getRegistry(String gateway, String username, String password) throws RegistryException {
+ try {
+ if (registry == null) {
+ registry = new RegistryImpl(gateway, username, password);
+ }
+ } catch (RegistryException e) {
+ logger.error("Unable to create registry instance", e);
+ throw new RegistryException(e);
+ }
+ return registry;
+ }
+
+ public static Registry getRegistry(String gateway) throws RegistryException {
+ try {
+ if (registry == null) {
+ registry = new RegistryImpl(gateway, ServerSettings.getDefaultUser(), ServerSettings.getDefaultUserPassword());
+ }
+ } catch (RegistryException e) {
+ logger.error("Unable to create registry instance", e);
+ throw new RegistryException(e);
+ } catch (ApplicationSettingsException e) {
+ logger.error("Unable to create registry instance", e);
+ throw new RegistryException(e);
+ }
+ return registry;
+ }
+
+ public static Registry getDefaultRegistry () throws RegistryException {
+ try {
+ if (registry == null) {
+ registry = new RegistryImpl();
+ }
+ } catch (RegistryException e) {
+ logger.error("Unable to create registry instance", e);
+ throw new RegistryException(e);
+ }
+ return registry;
+ }
+
+ public static Registry getLoggingRegistry() {
+ if(registry == null) {
+ registry = new LoggingRegistryImpl();
+ }
+ return registry;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/RegistryImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/RegistryImpl.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/RegistryImpl.java
new file mode 100644
index 0000000..3cee954
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/RegistryImpl.java
@@ -0,0 +1,735 @@
+/*
+ *
+ * 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.experiment.catalog.impl;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
+import org.apache.airavata.model.workspace.Gateway;
+import org.apache.airavata.model.workspace.Project;
+import org.apache.airavata.model.workspace.experiment.*;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.resources.GatewayResource;
+import org.apache.airavata.experiment.catalog.resources.UserResource;
+import org.apache.airavata.registry.cpi.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class RegistryImpl implements Registry {
+ private GatewayResource gatewayResource;
+ private UserResource user;
+ private final static Logger logger = LoggerFactory.getLogger(RegistryImpl.class);
+ private ExperimentRegistry experimentRegistry = null;
+ private ProjectRegistry projectRegistry = null;
+ private GatewayRegistry gatewayRegistry = null;
+
+ public RegistryImpl() throws RegistryException{
+ try {
+ if (!ResourceUtils.isGatewayExist(ServerSettings.getDefaultUserGateway())){
+ gatewayResource = (GatewayResource) ResourceUtils.createGateway(ServerSettings.getDefaultUserGateway());
+ gatewayResource.setGatewayName(ServerSettings.getDefaultUserGateway());
+ gatewayResource.save();
+ }else {
+ gatewayResource = (GatewayResource)ResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
+ }
+
+ if (!ResourceUtils.isUserExist(ServerSettings.getDefaultUser())){
+ user = ResourceUtils.createUser(ServerSettings.getDefaultUser(), ServerSettings.getDefaultUserPassword());
+ user.save();
+ }else {
+ user = (UserResource)ResourceUtils.getUser(ServerSettings.getDefaultUser());
+ }
+ experimentRegistry = new ExperimentRegistry(gatewayResource, user);
+ projectRegistry = new ProjectRegistry(gatewayResource, user);
+ gatewayRegistry = new GatewayRegistry();
+ } catch (ApplicationSettingsException e) {
+ logger.error("Unable to read airavata server properties..", e);
+ throw new RegistryException("Unable to read airavata server properties..", e);
+ }
+ }
+
+ public RegistryImpl(String gateway, String username, String password) throws RegistryException{
+ if (!ResourceUtils.isGatewayExist(gateway)){
+ gatewayResource = (GatewayResource) ResourceUtils.createGateway(gateway);
+ gatewayResource.save();
+ }else {
+ gatewayResource = (GatewayResource)ResourceUtils.getGateway(gateway);
+ }
+
+ if (!ResourceUtils.isUserExist(username)){
+ user = ResourceUtils.createUser(username, password);
+ user.save();
+ }else {
+ user = (UserResource)ResourceUtils.getUser(username);
+ }
+ experimentRegistry = new ExperimentRegistry(gatewayResource, user);
+ projectRegistry = new ProjectRegistry(gatewayResource, user);
+ }
+
+ /**
+ * This method is to add an object in to the registry
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param newObjectToAdd Object which contains the fields that need to be saved in to registry. This object is a
+ * thrift model object. In experiment case this object can be BasicMetadata, ConfigurationData
+ * etc
+ * @return return the identifier to identify the object
+ */
+ @Override
+ public Object add(ParentDataType dataType, Object newObjectToAdd, String gatewayId) throws RegistryException {
+ try {
+ switch (dataType) {
+ case PROJECT:
+ return projectRegistry.addProject((Project)newObjectToAdd, gatewayId);
+ case EXPERIMENT:
+ return experimentRegistry.addExperiment((Experiment) newObjectToAdd, gatewayId);
+ case GATEWAY:
+ return gatewayRegistry.addGateway((Gateway)newObjectToAdd);
+ default:
+ logger.error("Unsupported top level type..", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while adding the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while adding the resource " + dataType.toString(), e);
+ }
+ }
+
+ /**
+ * This method is to add an object in to the registry
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param newObjectToAdd Object which contains the fields that need to be saved in to registry. This object is a
+ * thrift model object. In experiment case this object can be BasicMetadata, ConfigurationData
+ * etc
+ * @param dependentIdentifier Object which contains the identifier if the object that is going to add is not a top
+ * level object in the data model. If it is a top level object, programmer can pass it as
+ * null
+ */
+ @Override
+ public Object add(ChildDataType dataType, Object newObjectToAdd, Object dependentIdentifier) throws RegistryException {
+ try {
+ switch (dataType) {
+ case EXPERIMENT_CONFIGURATION_DATA:
+ return experimentRegistry.addUserConfigData((UserConfigurationData) newObjectToAdd, (String) dependentIdentifier);
+ case EXPERIMENT_OUTPUT:
+ return experimentRegistry.addExpOutputs((List<OutputDataObjectType>) newObjectToAdd, (String) dependentIdentifier);
+ case EXPERIMENT_STATUS:
+ return experimentRegistry.updateExperimentStatus((ExperimentStatus) newObjectToAdd, (String) dependentIdentifier);
+ case WORKFLOW_NODE_DETAIL:
+ return experimentRegistry.addWorkflowNodeDetails((WorkflowNodeDetails) newObjectToAdd, (String) dependentIdentifier);
+ case WORKFLOW_NODE_STATUS:
+ return experimentRegistry.addWorkflowNodeStatus((WorkflowNodeStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case NODE_OUTPUT:
+ return experimentRegistry.addNodeOutputs((List<OutputDataObjectType>) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case TASK_DETAIL:
+ return experimentRegistry.addTaskDetails((TaskDetails) newObjectToAdd, (String) dependentIdentifier);
+ case APPLICATION_OUTPUT:
+ return experimentRegistry.addApplicationOutputs((List<OutputDataObjectType>) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case TASK_STATUS:
+ return experimentRegistry.addTaskStatus((TaskStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case JOB_DETAIL:
+ return experimentRegistry.addJobDetails((JobDetails) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case JOB_STATUS:
+ return experimentRegistry.addJobStatus((JobStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case APPLICATION_STATUS:
+ return experimentRegistry.addApplicationStatus((ApplicationStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case DATA_TRANSFER_DETAIL:
+ return experimentRegistry.addDataTransferDetails((DataTransferDetails) newObjectToAdd, (String) dependentIdentifier);
+ case TRANSFER_STATUS:
+ return experimentRegistry.addTransferStatus((TransferStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ return experimentRegistry.addComputationalResourceScheduling((ComputationalResourceScheduling) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ return experimentRegistry.addOutputDataHandling((AdvancedOutputDataHandling) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case ADVANCE_INPUT_DATA_HANDLING:
+ return experimentRegistry.addInputDataHandling((AdvancedInputDataHandling) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case QOS_PARAM:
+ return experimentRegistry.addQosParams((QualityOfServiceParams) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
+ case ERROR_DETAIL:
+ return experimentRegistry.addErrorDetails((ErrorDetails) newObjectToAdd, dependentIdentifier);
+ default:
+ logger.error("Unsupported dependent data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while adding " + dataType.toString() , new RegistryException(e));
+ throw new RegistryException("Error while adding " + dataType.toString(), e);
+ }
+
+ }
+
+ /**
+ * This method is to update the whole object in registry
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param newObjectToUpdate Object which contains the fields that need to be updated in to registry. This object is a
+ * thrift model object. In experiment case this object can be BasicMetadata, ConfigurationData
+ * etc. CPI programmer can only fill necessary fields that need to be updated. He does not
+ * have to fill the whole object. He needs to only fill the mandatory fields and whatever the
+ * other fields that need to be updated.
+ */
+ @Override
+ public void update(RegistryModelType dataType, Object newObjectToUpdate, Object identifier) throws RegistryException {
+ try {
+ switch (dataType) {
+ case PROJECT:
+ projectRegistry.updateProject((Project)newObjectToUpdate, (String)identifier);
+ break;
+ case GATEWAY:
+ gatewayRegistry.updateGateway((String)identifier, (Gateway)newObjectToUpdate);
+ break;
+ case EXPERIMENT:
+ experimentRegistry.updateExperiment((Experiment) newObjectToUpdate, (String) identifier);
+ break;
+ case EXPERIMENT_CONFIGURATION_DATA:
+ experimentRegistry.updateUserConfigData((UserConfigurationData) newObjectToUpdate, (String) identifier);
+ break;
+ case EXPERIMENT_OUTPUT:
+ experimentRegistry.updateExpOutputs((List<OutputDataObjectType>) newObjectToUpdate, (String) identifier);
+ break;
+ case EXPERIMENT_STATUS:
+ experimentRegistry.updateExperimentStatus((ExperimentStatus) newObjectToUpdate, (String) identifier);
+ break;
+ case WORKFLOW_NODE_DETAIL:
+ experimentRegistry.updateWorkflowNodeDetails((WorkflowNodeDetails) newObjectToUpdate, (String) identifier);
+ break;
+ case WORKFLOW_NODE_STATUS:
+ experimentRegistry.updateWorkflowNodeStatus((WorkflowNodeStatus) newObjectToUpdate, (String) identifier);
+ break;
+ case NODE_OUTPUT:
+ experimentRegistry.updateNodeOutputs((List<OutputDataObjectType>) newObjectToUpdate, (String) identifier);
+ break;
+ case TASK_DETAIL:
+ experimentRegistry.updateTaskDetails((TaskDetails) newObjectToUpdate, (String) identifier);
+ break;
+ case APPLICATION_OUTPUT:
+ experimentRegistry.updateAppOutputs((List<OutputDataObjectType>) newObjectToUpdate, (String) identifier);
+ break;
+ case TASK_STATUS:
+ experimentRegistry.updateTaskStatus((TaskStatus) newObjectToUpdate, (String) identifier);
+ break;
+ case JOB_DETAIL:
+ experimentRegistry.updateJobDetails((JobDetails) newObjectToUpdate, (CompositeIdentifier) identifier);
+ break;
+ case JOB_STATUS:
+ experimentRegistry.updateJobStatus((JobStatus) newObjectToUpdate, (CompositeIdentifier) identifier);
+ break;
+ case APPLICATION_STATUS:
+ experimentRegistry.updateApplicationStatus((ApplicationStatus) newObjectToUpdate, (String) identifier);
+ break;
+ case DATA_TRANSFER_DETAIL:
+ experimentRegistry.updateDataTransferDetails((DataTransferDetails) newObjectToUpdate, (String) identifier);
+ break;
+ case TRANSFER_STATUS:
+ experimentRegistry.updateTransferStatus((TransferStatus) newObjectToUpdate, (String) identifier);
+ break;
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ experimentRegistry.updateScheduling((ComputationalResourceScheduling) newObjectToUpdate, (String) identifier, dataType.toString());
+ break;
+ case ADVANCE_INPUT_DATA_HANDLING:
+ experimentRegistry.updateInputDataHandling((AdvancedInputDataHandling) newObjectToUpdate, (String) identifier, dataType.toString());
+ break;
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ experimentRegistry.updateOutputDataHandling((AdvancedOutputDataHandling) newObjectToUpdate, (String) identifier, dataType.toString());
+ break;
+ case QOS_PARAM:
+ experimentRegistry.updateQOSParams((QualityOfServiceParams) newObjectToUpdate, (String) identifier, dataType.toString());
+ break;
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while updating the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while updating the resource.." + dataType.toString(), e);
+ }
+
+ }
+
+ /**
+ * This method is to update a specific field of the data model
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
+ * identifier will be generated experimentID
+ * @param fieldName Field which need to be updated in the registry. In Experiment_Basic_Type, if you want to update the
+ * description, field will be "description". Field names are defined in
+ * org.apache.airavata.registry.cpi.utils.Constants
+ * @param value Value by which the given field need to be updated. If the field is "description", that field will be
+ * updated by given value
+ */
+ @Override
+ public void update(RegistryModelType dataType, Object identifier, String fieldName, Object value) throws RegistryException {
+ try {
+ switch (dataType) {
+ case EXPERIMENT:
+ experimentRegistry.updateExperimentField((String) identifier, fieldName, value);
+ break;
+ case EXPERIMENT_CONFIGURATION_DATA:
+ experimentRegistry.updateExpConfigDataField((String) identifier, fieldName, value);
+ break;
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while updating the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while updating the resource " + dataType.toString(), e);
+ }
+
+ }
+
+ /**
+ * This method is to retrieve object according to the identifier. In the experiment basic data type, if you give the
+ * experiment id, this method will return the BasicMetadata object
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
+ * identifier will be generated experimentID
+ * @return object according to the given identifier.
+ */
+ @Override
+ public Object get(RegistryModelType dataType, Object identifier) throws RegistryException {
+ try {
+ switch (dataType) {
+ case PROJECT:
+ return projectRegistry.getProject((String)identifier);
+ case GATEWAY:
+ return gatewayRegistry.getGateway((String)identifier);
+ case EXPERIMENT:
+ return experimentRegistry.getExperiment((String) identifier, null);
+ case EXPERIMENT_CONFIGURATION_DATA:
+ return experimentRegistry.getConfigData((String) identifier, null);
+ case EXPERIMENT_OUTPUT:
+ return experimentRegistry.getExperimentOutputs((String) identifier);
+ case EXPERIMENT_STATUS:
+ return experimentRegistry.getExperimentStatus((String) identifier);
+ case WORKFLOW_NODE_DETAIL:
+ return experimentRegistry.getWorkflowNodeDetails((String) identifier);
+ case WORKFLOW_NODE_STATUS:
+ return experimentRegistry.getWorkflowNodeStatus((String) identifier);
+ case NODE_OUTPUT:
+ return experimentRegistry.getNodeOutputs((String) identifier);
+ case TASK_DETAIL:
+ return experimentRegistry.getTaskDetails((String) identifier);
+ case APPLICATION_OUTPUT:
+ return experimentRegistry.getApplicationOutputs((String) identifier);
+ case TASK_STATUS:
+ return experimentRegistry.getTaskStatus((String) identifier);
+ case JOB_DETAIL:
+ return experimentRegistry.getJobDetails((CompositeIdentifier) identifier);
+ case JOB_STATUS:
+ return experimentRegistry.getJobStatus((CompositeIdentifier) identifier);
+ case APPLICATION_STATUS:
+ return experimentRegistry.getApplicationStatus((CompositeIdentifier) identifier);
+ case DATA_TRANSFER_DETAIL:
+ return experimentRegistry.getDataTransferDetails((String) identifier);
+ case TRANSFER_STATUS:
+ return experimentRegistry.getDataTransferStatus((String) identifier);
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ return experimentRegistry.getComputationalScheduling(dataType, (String) identifier);
+ case ADVANCE_INPUT_DATA_HANDLING:
+ return experimentRegistry.getInputDataHandling(dataType, (String) identifier);
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ return experimentRegistry.getOutputDataHandling(dataType, (String) identifier);
+ case QOS_PARAM:
+ return experimentRegistry.getQosParams(dataType, (String) identifier);
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while retrieving the resource " + dataType.toString() , e);
+ }
+ }
+
+ /**
+ * This method is to retrieve list of objects according to a given criteria
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param fieldName FieldName is the field that filtering should be done. For example, if we want to retrieve all
+ * the experiments for a given user, filterBy will be "userName"
+ * @param value value for the filtering field. In the experiment case, value for "userName" can be "admin"
+ * @return List of objects according to the given criteria
+ */
+ @Override
+ public List<Object> get(RegistryModelType dataType, String fieldName, Object value) throws RegistryException {
+ try {
+ List<Object> result = new ArrayList<Object>();
+ switch (dataType) {
+ case PROJECT:
+ List<Project> projectList = projectRegistry.getProjectList(fieldName, value);
+ for (Project project : projectList ){
+ result.add(project);
+ }
+ return result;
+ case GATEWAY:
+ List<Gateway> allGateways = gatewayRegistry.getAllGateways();
+ for (Gateway gateway : allGateways){
+ result.add(gateway);
+ }
+ return result;
+ case EXPERIMENT:
+ List<Experiment> experimentList = experimentRegistry.getExperimentList(fieldName, value);
+ for (Experiment experiment : experimentList) {
+ result.add(experiment);
+ }
+ return result;
+ case WORKFLOW_NODE_DETAIL:
+ List<WorkflowNodeDetails> wfNodeDetails = experimentRegistry.getWFNodeDetails(fieldName, value);
+ for (WorkflowNodeDetails wf : wfNodeDetails) {
+ result.add(wf);
+ }
+ return result;
+ case WORKFLOW_NODE_STATUS:
+ List<WorkflowNodeStatus> wfNodeStatusList = experimentRegistry.getWFNodeStatusList(fieldName, value);
+ for (WorkflowNodeStatus wfs : wfNodeStatusList) {
+ result.add(wfs);
+ }
+ return result;
+ case TASK_DETAIL:
+ List<TaskDetails> taskDetails = experimentRegistry.getTaskDetails(fieldName, value);
+ for (TaskDetails task : taskDetails) {
+ result.add(task);
+ }
+ return result;
+ case JOB_DETAIL:
+ List<JobDetails> jobDetails = experimentRegistry.getJobDetails(fieldName, value);
+ for (JobDetails job : jobDetails) {
+ result.add(job);
+ }
+ return result;
+ case DATA_TRANSFER_DETAIL:
+ List<DataTransferDetails> dataTransferDetails = experimentRegistry.getDataTransferDetails(fieldName, value);
+ for (DataTransferDetails transferDetails : dataTransferDetails) {
+ result.add(transferDetails);
+ }
+ return result;
+ case ERROR_DETAIL:
+ List<ErrorDetails> errorDetails = experimentRegistry.getErrorDetails(fieldName, value);
+ for (ErrorDetails error : errorDetails) {
+ result.add(error);
+ }
+ return result;
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while retrieving the resource " + dataType.toString(), e);
+ }
+
+ }
+
+ /**
+ * This method is to retrieve list of objects according to a given criteria with pagination and ordering
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param fieldName FieldName is the field that filtering should be done. For example, if we want to retrieve all
+ * the experiments for a given user, filterBy will be "userName"
+ * @param value value for the filtering field. In the experiment case, value for "userName" can be "admin"
+ * @param limit Size of the results to be returned
+ * @param offset Start position of the results to be retrieved
+ * @param orderByIdentifier Named of the column in which the ordering is based
+ * @param resultOrderType Type of ordering i.e ASC or DESC
+ * @return
+ * @throws RegistryException
+ */
+ @Override
+ public List<Object> get(RegistryModelType dataType, String fieldName, Object value, int limit,
+ int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
+ try {
+ List<Object> result = new ArrayList<Object>();
+ switch (dataType) {
+ case PROJECT:
+ List<Project> projectList = projectRegistry
+ .getProjectList(fieldName, value, limit, offset, orderByIdentifier, resultOrderType);
+ for (Project project : projectList ){
+ result.add(project);
+ }
+ return result;
+ case EXPERIMENT:
+ List<Experiment> experimentList = experimentRegistry.getExperimentList(fieldName, value,
+ limit, offset, orderByIdentifier, resultOrderType);
+ for (Experiment experiment : experimentList) {
+ result.add(experiment);
+ }
+ return result;
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while retrieving the resource " + dataType.toString(), e);
+ }
+ }
+
+ /**
+ * This method is to retrieve list of objects according to a given criteria
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param filters filters is a map of field name and value that you need to use for search filtration
+ * @return List of objects according to the given criteria
+ */
+ @Override
+ public List<Object> search(RegistryModelType dataType, Map<String, String> filters) throws RegistryException {
+ return search(dataType, filters, -1, -1, null, null);
+ }
+
+ /**
+ * This method is to retrieve list of objects with pagination according to a given criteria sorted
+ * according by the specified identified and specified ordering (i.e either ASC or DESC)
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param filters filters is a map of field name and value that you need to use for search filtration
+ * @param limit amount of the results to be returned
+ * @param offset offset of the results from the sorted list to be fetched from
+ * @param orderByIdentifier identifier (i.e the column) which will be used as the basis to sort the results
+ * @param resultOrderType The type of ordering (i.e ASC or DESC) that has to be used when retrieving the results
+ * @return List of objects according to the given criteria
+ */
+ @Override
+ public List<Object> search(RegistryModelType dataType, Map<String, String> filters, int limit,
+ int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
+ try {
+ List<Object> result = new ArrayList<Object>();
+ switch (dataType) {
+ case PROJECT:
+ List<Project> projectList
+ = projectRegistry.searchProjects(filters, limit, offset,
+ orderByIdentifier, resultOrderType);
+ for (Project project : projectList ){
+ result.add(project);
+ }
+ return result;
+ case EXPERIMENT:
+ List<ExperimentSummary> experimentSummaries = experimentRegistry
+ .searchExperiments(filters, limit, offset, orderByIdentifier,
+ resultOrderType);
+ for (ExperimentSummary ex : experimentSummaries){
+ result.add(ex);
+ }
+ return result;
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while retrieving the resource " + dataType.toString(), e);
+ }
+ }
+
+ /**
+ * This method is to retrieve a specific value for a given field.
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
+ * identifier will be generated experimentID
+ * @param field field that filtering should be done. For example, if we want to execution user for a given
+ * experiment, field will be "userName"
+ * @return return the value for the specific field where data model is identified by the unique identifier that has
+ * given
+ */
+ @Override
+ public Object getValue(RegistryModelType dataType, Object identifier, String field) throws RegistryException {
+ try {
+ switch (dataType) {
+ case EXPERIMENT:
+ return experimentRegistry.getExperiment((String) identifier, field);
+ case EXPERIMENT_CONFIGURATION_DATA:
+ return experimentRegistry.getConfigData((String) identifier, field);
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while retrieving the resource " + dataType.toString(), e);
+ }
+
+ }
+
+ /**
+ * This method is to retrieve all the identifiers according to given filtering criteria. For an example, if you want
+ * to get all the experiment ids for a given gateway, your field name will be "gateway" and the value will be the
+ * name of the gateway ("default"). Similar manner you can retrieve all the experiment ids for a given user.
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param fieldName FieldName is the field that filtering should be done. For example, if we want to retrieve all
+ * the experiments for a given user, filterBy will be "userName"
+ * @param value value for the filtering field. In the experiment case, value for "userName" can be "admin"
+ * @return id list according to the filtering criteria
+ */
+ @Override
+ public List<String> getIds(RegistryModelType dataType, String fieldName, Object value) throws RegistryException {
+ try {
+ switch (dataType) {
+ case PROJECT:
+ return projectRegistry.getProjectIDs(fieldName, value);
+ case EXPERIMENT:
+ return experimentRegistry.getExperimentIDs(fieldName, value);
+ case EXPERIMENT_CONFIGURATION_DATA:
+ return experimentRegistry.getExperimentIDs(fieldName, value);
+ case WORKFLOW_NODE_DETAIL:
+ return experimentRegistry.getWorkflowNodeIds(fieldName, value);
+ case TASK_DETAIL:
+ return experimentRegistry.getTaskDetailIds(fieldName, value);
+ case JOB_DETAIL:
+ return experimentRegistry.getJobDetailIds(fieldName, value);
+ case DATA_TRANSFER_DETAIL:
+ return experimentRegistry.getTransferDetailIds(fieldName, value);
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while retrieving the ids for" + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while retrieving the ids for " + dataType.toString(), e);
+ }
+
+ }
+
+ /**
+ * This method is to remove a item from the registry
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
+ * identifier will be generated experimentID
+ */
+ @Override
+ public void remove(RegistryModelType dataType, Object identifier) throws RegistryException {
+ try {
+ switch (dataType) {
+ case PROJECT:
+ projectRegistry.removeProject((String)identifier);
+ break;
+ case GATEWAY:
+ gatewayRegistry.removeGateway((String)identifier);
+ break;
+ case EXPERIMENT:
+ experimentRegistry.removeExperiment((String) identifier);
+ break;
+ case EXPERIMENT_CONFIGURATION_DATA:
+ experimentRegistry.removeExperimentConfigData((String) identifier);
+ break;
+ case WORKFLOW_NODE_DETAIL:
+ experimentRegistry.removeWorkflowNode((String) identifier);
+ break;
+ case TASK_DETAIL:
+ experimentRegistry.removeTaskDetails((String) identifier);
+ break;
+ case JOB_DETAIL:
+ experimentRegistry.removeJobDetails((CompositeIdentifier) identifier);
+ break;
+ case DATA_TRANSFER_DETAIL:
+ experimentRegistry.removeDataTransferDetails((String) identifier);
+ break;
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ experimentRegistry.removeComputationalScheduling(dataType, (String) identifier);
+ break;
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ experimentRegistry.removeOutputDataHandling(dataType, (String) identifier);
+ break;
+ case ADVANCE_INPUT_DATA_HANDLING:
+ experimentRegistry.removeInputDataHandling(dataType, (String) identifier);
+ break;
+ case QOS_PARAM:
+ experimentRegistry.removeQOSParams(dataType, (String) identifier);
+ break;
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while removing the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while removing the resource " + dataType.toString(), e);
+ }
+
+ }
+
+ /**
+ * This method will check whether a given data type which can be identified with the identifier exists or not
+ *
+ * @param dataType Data type is a predefined type which the programmer should choose according to the object he
+ * is going to save in to registry
+ * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
+ * identifier will be generated experimentID
+ * @return whether the given data type exists or not
+ */
+ @Override
+ public boolean isExist(RegistryModelType dataType, Object identifier) throws RegistryException {
+ try {
+ switch (dataType) {
+ case PROJECT:
+ return projectRegistry.isProjectExist((String)identifier);
+ case GATEWAY:
+ return gatewayRegistry.isGatewayExist((String)identifier);
+ case EXPERIMENT:
+ return experimentRegistry.isExperimentExist((String) identifier);
+ case EXPERIMENT_CONFIGURATION_DATA:
+ return experimentRegistry.isExperimentConfigDataExist((String) identifier);
+ case WORKFLOW_NODE_DETAIL:
+ return experimentRegistry.isWFNodeExist((String) identifier);
+ case TASK_DETAIL:
+ return experimentRegistry.isTaskDetailExist((String) identifier);
+ case JOB_DETAIL:
+ return experimentRegistry.isJobDetailExist((CompositeIdentifier) identifier);
+ case DATA_TRANSFER_DETAIL:
+ return experimentRegistry.isTransferDetailExist((String) identifier);
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ return experimentRegistry.isComputationalSchedulingExist(dataType, (String) identifier);
+ case ADVANCE_INPUT_DATA_HANDLING:
+ return experimentRegistry.isInputDataHandlingExist(dataType, (String) identifier);
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ return experimentRegistry.isOutputDataHandlingExist(dataType, (String) identifier);
+ case QOS_PARAM:
+ return experimentRegistry.isQOSParamsExist(dataType, (String) identifier);
+ default:
+ logger.error("Unsupported data type...", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ } catch (Exception e) {
+ logger.error("Error while checking existence of the resource " + dataType.toString(), new RegistryException(e));
+ throw new RegistryException("Error while checking existence of the resource " + dataType.toString(), e);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/UserReg.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/UserReg.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/UserReg.java
new file mode 100644
index 0000000..67166e2
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/UserReg.java
@@ -0,0 +1,41 @@
+/*
+ *
+ * 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.experiment.catalog.impl;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.resources.WorkerResource;
+import org.apache.airavata.registry.cpi.RegistryException;
+
+public class UserReg {
+ public WorkerResource getSystemUser() throws ApplicationSettingsException, RegistryException {
+ return (WorkerResource)ResourceUtils.getWorker(ServerSettings.getDefaultUserGateway(), ServerSettings.getDefaultUser());
+ }
+
+ public WorkerResource getExistingUser (String gatewayName, String userName) throws RegistryException {
+ return (WorkerResource)ResourceUtils.getWorker(gatewayName, userName);
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/AdvancedInputDataHandling.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/AdvancedInputDataHandling.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/AdvancedInputDataHandling.java
new file mode 100644
index 0000000..87fb256
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/AdvancedInputDataHandling.java
@@ -0,0 +1,113 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name = "ADVANCE_INPUT_DATA_HANDLING")
+public class AdvancedInputDataHandling implements Serializable {
+ @Id
+ @GeneratedValue
+ @Column(name = "INPUT_DATA_HANDLING_ID")
+ private int dataHandlingId;
+ @Column(name = "EXPERIMENT_ID")
+ private String expId;
+ @Column(name = "TASK_ID")
+ private String taskId;
+ @Column(name = "WORKING_DIR_PARENT")
+ private String parentWorkingDir;
+ @Column(name = "UNIQUE_WORKING_DIR")
+ private String workingDir;
+ @Column(name = "STAGE_INPUT_FILES_TO_WORKING_DIR")
+ private boolean stageInputsToWorkingDir;
+ @Column(name = "CLEAN_AFTER_JOB")
+ private boolean cleanAfterJob;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "EXPERIMENT_ID")
+ private Experiment experiment;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "TASK_ID")
+ private TaskDetail task;
+
+ public int getDataHandlingId() {
+ return dataHandlingId;
+ }
+
+ public void setDataHandlingId(int dataHandlingId) {
+ this.dataHandlingId = dataHandlingId;
+ }
+
+ public String getExpId() {
+ return expId;
+ }
+
+ public void setExpId(String expId) {
+ this.expId = expId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getParentWorkingDir() {
+ return parentWorkingDir;
+ }
+
+ public void setParentWorkingDir(String parentWorkingDir) {
+ this.parentWorkingDir = parentWorkingDir;
+ }
+
+ public String getWorkingDir() {
+ return workingDir;
+ }
+
+ public void setWorkingDir(String workingDir) {
+ this.workingDir = workingDir;
+ }
+
+ public boolean isStageInputsToWorkingDir() {
+ return stageInputsToWorkingDir;
+ }
+
+ public void setStageInputsToWorkingDir(boolean stageInputsToWorkingDir) {
+ this.stageInputsToWorkingDir = stageInputsToWorkingDir;
+ }
+
+ public boolean isCleanAfterJob() {
+ return cleanAfterJob;
+ }
+
+ public void setCleanAfterJob(boolean cleanAfterJob) {
+ this.cleanAfterJob = cleanAfterJob;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/AdvancedOutputDataHandling.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/AdvancedOutputDataHandling.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/AdvancedOutputDataHandling.java
new file mode 100644
index 0000000..e3a35b4
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/AdvancedOutputDataHandling.java
@@ -0,0 +1,104 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name = "ADVANCE_OUTPUT_DATA_HANDLING")
+public class AdvancedOutputDataHandling implements Serializable {
+ @Id
+ @GeneratedValue
+ @Column(name = "OUTPUT_DATA_HANDLING_ID")
+ private int outputDataHandlingId;
+ @Column(name = "EXPERIMENT_ID")
+ private String expId;
+ @Column(name = "TASK_ID")
+ private String taskId;
+ @Column(name = "OUTPUT_DATA_DIR")
+ private String outputDataDir;
+ @Column(name = "DATA_REG_URL")
+ private String dataRegUrl;
+ @Column(name = "PERSIST_OUTPUT_DATA")
+ private boolean persistOutputData;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "EXPERIMENT_ID")
+ private Experiment experiment;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "TASK_ID")
+ private TaskDetail task;
+
+ public int getOutputDataHandlingId() {
+ return outputDataHandlingId;
+ }
+
+ public void setOutputDataHandlingId(int outputDataHandlingId) {
+ this.outputDataHandlingId = outputDataHandlingId;
+ }
+
+ public String getExpId() {
+ return expId;
+ }
+
+ public void setExpId(String expId) {
+ this.expId = expId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getOutputDataDir() {
+ return outputDataDir;
+ }
+
+ public void setOutputDataDir(String outputDataDir) {
+ this.outputDataDir = outputDataDir;
+ }
+
+ public String getDataRegUrl() {
+ return dataRegUrl;
+ }
+
+ public void setDataRegUrl(String dataRegUrl) {
+ this.dataRegUrl = dataRegUrl;
+ }
+
+ public boolean isPersistOutputData() {
+ return persistOutputData;
+ }
+
+ public void setPersistOutputData(boolean persistOutputData) {
+ this.persistOutputData = persistOutputData;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationInput.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationInput.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationInput.java
new file mode 100644
index 0000000..89cdf76
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationInput.java
@@ -0,0 +1,165 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name = "APPLICATION_INPUT")
+@IdClass(ApplicationInput_PK.class)
+public class ApplicationInput implements Serializable {
+ @Id
+ @Column(name = "TASK_ID")
+ private String taskId;
+ @Id
+ @Column(name = "INPUT_KEY")
+ private String inputKey;
+ @Column(name = "DATA_TYPE")
+ private String dataType;
+ @Column(name = "METADATA")
+ private String metadata;
+ @Lob
+ @Column(name = "VALUE")
+ private char[] value;
+ @Column(name = "APP_ARGUMENT")
+ private String appArgument;
+
+ @Column(name = "INPUT_ORDER")
+ private int inputOrder;
+
+ @Column(name = "STANDARD_INPUT")
+ private boolean standardInput;
+
+ @Column(name = "USER_FRIENDLY_DESC")
+ private String userFriendlyDesc;
+
+ @Column(name="IS_REQUIRED")
+ private boolean isRequired;
+ @Column(name="REQUIRED_TO_COMMANDLINE")
+ private boolean requiredToCMD;
+ @Column(name = "DATA_STAGED")
+ private boolean dataStaged;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "TASK_ID")
+ private TaskDetail task;
+
+ public int getInputOrder() {
+ return inputOrder;
+ }
+
+ public void setInputOrder(int inputOrder) {
+ this.inputOrder = inputOrder;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getInputKey() {
+ return inputKey;
+ }
+
+ public void setInputKey(String inputKey) {
+ this.inputKey = inputKey;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(String metadata) {
+ this.metadata = metadata;
+ }
+
+ public char[] getValue() {
+ return value;
+ }
+
+ public void setValue(char[] value) {
+ this.value = value;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+
+ public boolean isStandardInput() {
+ return standardInput;
+ }
+
+ public void setStandardInput(boolean standardInput) {
+ this.standardInput = standardInput;
+ }
+
+ public String getUserFriendlyDesc() {
+ return userFriendlyDesc;
+ }
+
+ public void setUserFriendlyDesc(String userFriendlyDesc) {
+ this.userFriendlyDesc = userFriendlyDesc;
+ }
+
+ public boolean isRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean isRequired) {
+ this.isRequired = isRequired;
+ }
+
+ public boolean isRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean isDataStaged() {
+ return dataStaged;
+ }
+
+ public void setDataStaged(boolean dataStaged) {
+ this.dataStaged = dataStaged;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationInput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationInput_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationInput_PK.java
new file mode 100644
index 0000000..84979b4
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationInput_PK.java
@@ -0,0 +1,65 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import java.io.Serializable;
+
+public class ApplicationInput_PK implements Serializable {
+ private String taskId;
+ private String inputKey;
+
+ public ApplicationInput_PK(String inputKey, String taskId) {
+ this.inputKey = inputKey;
+ this.taskId = taskId;
+ }
+
+ public ApplicationInput_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getInputKey() {
+ return inputKey;
+ }
+
+ public void setInputKey(String inputKey) {
+ this.inputKey = inputKey;
+ }
+}
[11/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/ExperimentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/ExperimentRegistry.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/ExperimentRegistry.java
new file mode 100644
index 0000000..bd00a1e
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/impl/ExperimentRegistry.java
@@ -0,0 +1,2983 @@
+/*
+ *
+ * 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.experiment.catalog.impl;
+
+import org.apache.airavata.common.logger.AiravataLogger;
+import org.apache.airavata.common.logger.AiravataLoggerFactory;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
+import org.apache.airavata.model.workspace.experiment.*;
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.resources.*;
+import org.apache.airavata.experiment.catalog.utils.ThriftDataModelConversion;
+import org.apache.airavata.registry.cpi.CompositeIdentifier;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.apache.airavata.registry.cpi.RegistryModelType;
+import org.apache.airavata.registry.cpi.ResultOrderType;
+import org.apache.airavata.registry.cpi.utils.Constants;
+import org.apache.airavata.registry.cpi.utils.StatusType;
+
+import java.sql.Timestamp;
+import java.util.*;
+
+public class ExperimentRegistry {
+ private GatewayResource gatewayResource;
+ private WorkerResource workerResource;
+ private final static AiravataLogger logger = AiravataLoggerFactory.getLogger(ExperimentRegistry.class);
+
+ public ExperimentRegistry(GatewayResource gateway, UserResource user) throws RegistryException {
+ gatewayResource = gateway;
+ if (!gatewayResource.isExists(ResourceType.GATEWAY_WORKER, user.getUserName())) {
+ workerResource = ResourceUtils.addGatewayWorker(gateway, user);
+ } else {
+ workerResource = (WorkerResource) ResourceUtils.getWorker(gateway.getGatewayId(), user.getUserName());
+ }
+
+ }
+
+ public String addExperiment(Experiment experiment, String gatewayId) throws RegistryException {
+ String experimentID;
+ try {
+ if (!ResourceUtils.isUserExist(experiment.getUserName())) {
+ ResourceUtils.addUser(experiment.getUserName(), null);
+ }
+
+ experimentID = getExperimentID(experiment.getName());
+ experiment.setExperimentID(experimentID);
+ ExperimentResource experimentResource = new ExperimentResource();
+ experimentResource.setExpID(experimentID);
+ experimentResource.setExpName(experiment.getName());
+ experimentResource.setExecutionUser(experiment.getUserName());
+ experimentResource.setGatewayId(gatewayId);
+ experimentResource.setGatewayExecutionId(experiment.getGatewayExecutionId());
+ experimentResource.setEnableEmailNotifications(experiment.isEnableEmailNotification());
+ if (!workerResource.isProjectExists(experiment.getProjectID())) {
+ logger.error("Project does not exist in the system..");
+ throw new Exception("Project does not exist in the system, Please create the project first...");
+ }
+ experimentResource.setProjectId(experiment.getProjectID());
+ experimentResource.setCreationTime(AiravataUtils.getTime(experiment.getCreationTime()));
+ experimentResource.setDescription(experiment.getDescription());
+ experimentResource.setApplicationId(experiment.getApplicationId());
+ experimentResource.setApplicationVersion(experiment.getApplicationVersion());
+ experimentResource.setWorkflowTemplateId(experiment.getWorkflowTemplateId());
+ experimentResource.setWorkflowTemplateVersion(experiment.getWorkflowTemplateVersion());
+ experimentResource.setWorkflowExecutionId(experiment.getWorkflowExecutionInstanceId());
+ experimentResource.save();
+
+ List<String> emailAddresses = experiment.getEmailAddresses();
+ if (emailAddresses != null && !emailAddresses.isEmpty()){
+ for (String email : emailAddresses){
+ NotificationEmailResource emailResource = new NotificationEmailResource();
+ emailResource.setExperimentId(experimentID);
+ emailResource.setEmailAddress(email);
+ emailResource.save();
+ }
+ }
+
+ List<InputDataObjectType> experimentInputs = experiment.getExperimentInputs();
+ if (experimentInputs != null) {
+ addExpInputs(experimentInputs, experimentResource);
+ }
+
+ UserConfigurationData userConfigurationData = experiment.getUserConfigurationData();
+ if (userConfigurationData != null) {
+ addUserConfigData(userConfigurationData, experimentID);
+ }
+
+ List<OutputDataObjectType> experimentOutputs = experiment.getExperimentOutputs();
+ if (experimentOutputs != null && !experimentOutputs.isEmpty()) {
+ //TODO: short change.
+// for (DataObjectType output : experimentOutputs){
+// output.setValue("");
+// }
+ addExpOutputs(experimentOutputs, experimentID);
+ }
+
+// ExperimentStatus experimentStatus = experiment.getExperimentStatus();
+// if (experimentStatus != null){
+// updateExperimentStatus(experimentStatus, experimentID);
+// }else {
+ ExperimentStatus experimentStatus = new ExperimentStatus();
+ experimentStatus.setExperimentState(ExperimentState.CREATED);
+ updateExperimentStatus(experimentStatus, experimentID);
+// }
+
+ List<WorkflowNodeDetails> workflowNodeDetailsList = experiment.getWorkflowNodeDetailsList();
+ if (workflowNodeDetailsList != null && !workflowNodeDetailsList.isEmpty()) {
+ for (WorkflowNodeDetails wf : workflowNodeDetailsList) {
+ addWorkflowNodeDetails(wf, experimentID);
+ }
+ }
+ List<ErrorDetails> errors = experiment.getErrors();
+ if (errors != null && !errors.isEmpty()) {
+ for (ErrorDetails errror : errors) {
+ addErrorDetails(errror, experimentID);
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error while saving experiment to registry", e);
+ throw new RegistryException(e);
+ }
+ return experimentID;
+ }
+
+ public String addUserConfigData(UserConfigurationData configurationData, String experimentID) throws RegistryException {
+ try {
+ ExperimentResource experiment = gatewayResource.getExperiment(experimentID);
+ ConfigDataResource configData = (ConfigDataResource) experiment.create(ResourceType.CONFIG_DATA);
+ configData.setExperimentId(experimentID);
+ configData.setAiravataAutoSchedule(configurationData.isAiravataAutoSchedule());
+ configData.setOverrideManualParams(configurationData.isOverrideManualScheduledParams());
+ configData.setShareExp(configurationData.isShareExperimentPublicly());
+ configData.setUserDn(configurationData.getUserDN());
+ configData.setGenerateCert(configurationData.isGenerateCert());
+ configData.save();
+ ComputationalResourceScheduling resourceScheduling = configurationData.getComputationalResourceScheduling();
+ if (resourceScheduling != null) {
+ addComputationScheduling(resourceScheduling, experiment);
+ }
+ AdvancedInputDataHandling inputDataHandling = configurationData.getAdvanceInputDataHandling();
+ if (inputDataHandling != null) {
+ addInputDataHandling(inputDataHandling, experiment);
+ }
+
+ AdvancedOutputDataHandling outputDataHandling = configurationData.getAdvanceOutputDataHandling();
+ if (outputDataHandling != null) {
+ addOutputDataHandling(outputDataHandling, experiment);
+ }
+
+ QualityOfServiceParams qosParams = configurationData.getQosParams();
+ if (qosParams != null) {
+ addQosParams(qosParams, experiment);
+ }
+ } catch (Exception e) {
+ logger.error("Unable to save user config data", e);
+ throw new RegistryException(e);
+ }
+ return experimentID;
+ }
+
+ public void addQosParams(QualityOfServiceParams qosParams, Resource resource) throws RegistryException {
+ try {
+ QosParamResource qosr = new QosParamResource();
+ if (resource instanceof ExperimentResource) {
+ ExperimentResource experiment = (ExperimentResource) resource;
+ qosr.setExperimentId(experiment.getExpID());
+ }
+ if (resource instanceof TaskDetailResource) {
+ TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
+ qosr.setTaskId(taskDetailResource.getTaskId());
+ String nodeId = taskDetailResource.getNodeId();
+ ExperimentResource experimentResource = new ExperimentResource();
+ WorkflowNodeDetailResource workflowNode = experimentResource.getWorkflowNode(nodeId);
+ qosr.setExperimentId(workflowNode.getExperimentId());
+ }
+ qosr.setStartExecutionAt(qosParams.getStartExecutionAt());
+ qosr.setExecuteBefore(qosParams.getExecuteBefore());
+ qosr.setNoOfRetries(qosParams.getNumberofRetries());
+ qosr.save();
+ } catch (Exception e) {
+ logger.error("Unable to save QOS params", e);
+ throw new RegistryException(e);
+ }
+
+ }
+
+ public void addOutputDataHandling(AdvancedOutputDataHandling outputDataHandling, Resource resource) throws RegistryException {
+ AdvancedOutputDataHandlingResource adodh = new AdvancedOutputDataHandlingResource();
+ try {
+ if (resource instanceof ExperimentResource) {
+ ExperimentResource experiment = (ExperimentResource) resource;
+ adodh.setExperimentId(experiment.getExpID());
+ }
+ if (resource instanceof TaskDetailResource) {
+ TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
+ String nodeId = taskDetailResource.getNodeId();
+ ExperimentResource experimentResource = new ExperimentResource();
+ WorkflowNodeDetailResource workflowNode = experimentResource.getWorkflowNode(nodeId);
+ adodh.setExperimentId(workflowNode.getExperimentId());
+ adodh.setTaskId(taskDetailResource.getTaskId());
+ }
+ adodh.setOutputDataDir(outputDataHandling.getOutputDataDir());
+ adodh.setDataRegUrl(outputDataHandling.getDataRegistryURL());
+ adodh.setPersistOutputData(outputDataHandling.isPersistOutputData());
+ adodh.save();
+ } catch (Exception e) {
+ logger.error("Unable to save output data handling data", e);
+ throw new RegistryException(e);
+ }
+
+ }
+
+ public void addInputDataHandling(AdvancedInputDataHandling inputDataHandling, Resource resource) throws RegistryException {
+ AdvanceInputDataHandlingResource adidh = new AdvanceInputDataHandlingResource();
+ try {
+ if (resource instanceof ExperimentResource) {
+ ExperimentResource experiment = (ExperimentResource) resource;
+ adidh.setExperimentId(experiment.getExpID());
+ }
+ if (resource instanceof TaskDetailResource) {
+ TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
+ String nodeId = taskDetailResource.getNodeId();
+ ExperimentResource experimentResource = new ExperimentResource();
+ WorkflowNodeDetailResource workflowNode = experimentResource.getWorkflowNode(nodeId);
+ adidh.setExperimentId(workflowNode.getExperimentId());
+ adidh.setTaskId(taskDetailResource.getTaskId());
+ }
+ adidh.setWorkingDir(inputDataHandling.getUniqueWorkingDirectory());
+ adidh.setWorkingDirParent(inputDataHandling.getParentWorkingDirectory());
+ adidh.setStageInputFiles(inputDataHandling.isSetStageInputFilesToWorkingDir());
+ adidh.setCleanAfterJob(inputDataHandling.isCleanUpWorkingDirAfterJob());
+ adidh.save();
+ } catch (Exception e) {
+ logger.error("Unable to save input data handling data", e);
+ throw new RegistryException(e);
+ }
+
+ }
+
+ public void addComputationScheduling(ComputationalResourceScheduling resourceScheduling, Resource resource) throws RegistryException {
+ ComputationSchedulingResource cmsr = new ComputationSchedulingResource();
+ try {
+ if (resource instanceof ExperimentResource) {
+ ExperimentResource experiment = (ExperimentResource) resource;
+ cmsr.setExperimentId(experiment.getExpID());
+ }
+ if (resource instanceof TaskDetailResource) {
+ TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
+ String nodeId = taskDetailResource.getNodeId();
+ ExperimentResource experimentResource = new ExperimentResource();
+ WorkflowNodeDetailResource workflowNode = experimentResource.getWorkflowNode(nodeId);
+ cmsr.setExperimentId(workflowNode.getExperimentId());
+ cmsr.setTaskId(taskDetailResource.getTaskId());
+ }
+ cmsr.setResourceHostId(resourceScheduling.getResourceHostId());
+ cmsr.setCpuCount(resourceScheduling.getTotalCPUCount());
+ cmsr.setNodeCount(resourceScheduling.getNodeCount());
+ cmsr.setNumberOfThreads(resourceScheduling.getNumberOfThreads());
+ cmsr.setQueueName(resourceScheduling.getQueueName());
+ cmsr.setWalltimeLimit(resourceScheduling.getWallTimeLimit());
+ cmsr.setJobStartTime(AiravataUtils.getTime(resourceScheduling.getJobStartTime()));
+ cmsr.setPhysicalMemory(resourceScheduling.getTotalPhysicalMemory());
+ cmsr.setProjectName(resourceScheduling.getComputationalProjectAccount());
+ cmsr.save();
+ } catch (Exception e) {
+ logger.error("Unable to save computational scheduling data", e);
+ throw new RegistryException(e);
+ }
+
+ }
+
+ public void addExpInputs(List<InputDataObjectType> exInputs, ExperimentResource experimentResource) throws RegistryException {
+ try {
+ for (InputDataObjectType input : exInputs) {
+ ExperimentInputResource resource = (ExperimentInputResource) experimentResource.create(ResourceType.EXPERIMENT_INPUT);
+ resource.setExperimentId(experimentResource.getExpID());
+ resource.setExperimentKey(input.getName());
+ resource.setValue(input.getValue());
+ if (input.getType() != null) {
+ resource.setDataType(input.getType().toString());
+ }
+ resource.setMetadata(input.getMetaData());
+ resource.setAppArgument(input.getApplicationArgument());
+ resource.setInputOrder(input.getInputOrder());
+ resource.setRequired(input.isIsRequired());
+ resource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
+ resource.save();
+ }
+ } catch (Exception e) {
+ logger.error("Unable to save experiment inputs", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public void updateExpInputs(List<InputDataObjectType> exInputs, ExperimentResource experimentResource) throws RegistryException {
+ try {
+ List<ExperimentInputResource> experimentInputs = experimentResource.getExperimentInputs();
+ for (InputDataObjectType input : exInputs) {
+ for (ExperimentInputResource exinput : experimentInputs) {
+ if (exinput.getExperimentKey().equals(input.getName())) {
+ exinput.setValue(input.getValue());
+ if (input.getType() != null) {
+ exinput.setDataType(input.getType().toString());
+ }
+ exinput.setMetadata(input.getMetaData());
+ exinput.setAppArgument(input.getApplicationArgument());
+ exinput.setInputOrder(input.getInputOrder());
+ exinput.setRequired(input.isIsRequired());
+ exinput.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
+ exinput.save();
+ }
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Unable to update experiment inputs", e);
+ throw new RegistryException(e);
+ }
+
+ }
+
+ public String addExpOutputs(List<OutputDataObjectType> exOutput, String expId) throws RegistryException {
+ try {
+ ExperimentResource experiment = gatewayResource.getExperiment(expId);
+ for (OutputDataObjectType output : exOutput) {
+ ExperimentOutputResource resource = (ExperimentOutputResource) experiment.create(ResourceType.EXPERIMENT_OUTPUT);
+ resource.setExperimentId(expId);
+ resource.setExperimentKey(output.getName());
+ resource.setValue(output.getValue());
+ if (output.getType() != null) {
+ resource.setDataType(output.getType().toString());
+ }
+ resource.setRequired(output.isIsRequired());
+ resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
+ resource.setDataMovement(output.isDataMovement());
+ resource.setDataNameLocation(output.getLocation());
+ resource.setAppArgument(output.getApplicationArgument());
+ resource.setSearchQuery(output.getSearchQuery());
+// resource.setMetadata(output.get());
+ resource.save();
+ }
+ } catch (Exception e) {
+ logger.error("Error while adding experiment outputs...", e);
+ throw new RegistryException(e);
+ }
+ return expId;
+ }
+
+ public void updateExpOutputs(List<OutputDataObjectType> exOutput, String expId) throws RegistryException {
+ try {
+ ExperimentResource experiment = gatewayResource.getExperiment(expId);
+ List<ExperimentOutputResource> existingExpOutputs = experiment.getExperimentOutputs();
+ for (OutputDataObjectType output : exOutput) {
+ for (ExperimentOutputResource resource : existingExpOutputs) {
+ if (resource.getExperimentKey().equals(output.getName())) {
+ resource.setExperimentId(expId);
+ resource.setExperimentKey(output.getName());
+ resource.setValue(output.getValue());
+ if (output.getType() != null) {
+ resource.setDataType(output.getType().toString());
+ }
+ resource.setRequired(output.isIsRequired());
+ resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
+ resource.setDataMovement(output.isDataMovement());
+ resource.setDataNameLocation(output.getLocation());
+ resource.setAppArgument(output.getApplicationArgument());
+ resource.setSearchQuery(output.getSearchQuery());
+// resource.setMetadata(output.getMetaData());
+ resource.save();
+ }
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error while updating experiment outputs", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public String addNodeOutputs(List<OutputDataObjectType> wfOutputs, CompositeIdentifier ids) throws RegistryException {
+ try {
+ ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
+ WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String) ids.getSecondLevelIdentifier());
+ for (OutputDataObjectType output : wfOutputs) {
+ NodeOutputResource resource = (NodeOutputResource) workflowNode.create(ResourceType.NODE_OUTPUT);
+ resource.setNodeId(workflowNode.getNodeInstanceId());
+ resource.setOutputKey(output.getName());
+ resource.setValue(output.getValue());
+ if (output.getType() != null) {
+ resource.setDataType(output.getType().toString());
+ }
+ resource.setRequired(output.isIsRequired());
+ resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
+ resource.setDataMovement(output.isDataMovement());
+ resource.setDataNameLocation(output.getLocation());
+ resource.setAppArgument(output.getApplicationArgument());
+ resource.setSearchQuery(output.getSearchQuery());
+// resource.setMetadata(output.getMetaData());
+ resource.save();
+ }
+ } catch (Exception e) {
+ logger.error("Error while adding node outputs...", e);
+ throw new RegistryException(e);
+ }
+ return (String) ids.getSecondLevelIdentifier();
+ }
+
+ public void updateNodeOutputs(List<OutputDataObjectType> wfOutputs, String nodeId) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode(nodeId);
+ List<NodeOutputResource> nodeOutputs = workflowNode.getNodeOutputs();
+ for (OutputDataObjectType output : wfOutputs) {
+ for (NodeOutputResource resource : nodeOutputs) {
+ resource.setNodeId(workflowNode.getNodeInstanceId());
+ resource.setOutputKey(output.getName());
+ resource.setValue(output.getValue());
+ if (output.getType() != null) {
+ resource.setDataType(output.getType().toString());
+ }
+ resource.setRequired(output.isIsRequired());
+ resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
+ resource.setDataMovement(output.isDataMovement());
+ resource.setDataNameLocation(output.getLocation());
+ resource.setAppArgument(output.getApplicationArgument());
+ resource.setSearchQuery(output.getSearchQuery());
+// resource.setMetadata(output.getMetaData());
+ resource.save();
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error while updating node outputs...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public String addApplicationOutputs(List<OutputDataObjectType> appOutputs, CompositeIdentifier ids) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String) ids.getTopLevelIdentifier());
+ TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getSecondLevelIdentifier());
+ for (OutputDataObjectType output : appOutputs) {
+ ApplicationOutputResource resource = (ApplicationOutputResource) taskDetail.create(ResourceType.APPLICATION_OUTPUT);
+ resource.setTaskId(taskDetail.getTaskId());
+ resource.setOutputKey(output.getName());
+ resource.setValue(output.getValue());
+ if (output.getType() != null) {
+ resource.setDataType(output.getType().toString());
+ }
+ resource.setRequired(output.isIsRequired());
+ resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
+ resource.setDataMovement(output.isDataMovement());
+ resource.setDataNameLocation(output.getLocation());
+ resource.setAppArgument(output.getApplicationArgument());
+ resource.setSearchQuery(output.getSearchQuery());
+// resource.setMetadata(output.getMetaData());
+ resource.save();
+ }
+ } catch (Exception e) {
+ logger.error("Error while adding application outputs...", e);
+ throw new RegistryException(e);
+ }
+ return (String) ids.getSecondLevelIdentifier();
+ }
+
+ public String updateExperimentStatus(ExperimentStatus experimentStatus, String expId) throws RegistryException {
+ try {
+ ExperimentResource experiment = gatewayResource.getExperiment(expId);
+ StatusResource status = experiment.getExperimentStatus();
+ if (status == null) {
+ status = (StatusResource) experiment.create(ResourceType.STATUS);
+ }
+ status.setExperimentId(expId);
+ status.setStatusUpdateTime(AiravataUtils.getTime(experimentStatus.getTimeOfStateChange()));
+ if (status.getState() == null) {
+ status.setState(ExperimentState.UNKNOWN.name());
+ }
+ if (isValidStatusTransition(ExperimentState.valueOf(status.getState()), experimentStatus.getExperimentState())) {
+ status.setState(experimentStatus.getExperimentState().toString());
+ status.setStatusType(StatusType.EXPERIMENT.toString());
+ status.save();
+ logger.debugId(expId, "Updated experiment {} status to {}.", expId, experimentStatus.toString());
+ }
+ } catch (Exception e) {
+ logger.errorId(expId, "Error while updating experiment status...", e);
+ throw new RegistryException(e);
+ }
+ return expId;
+ }
+
+ public String addWorkflowNodeStatus(WorkflowNodeStatus status, CompositeIdentifier ids) throws RegistryException {
+ try {
+ ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
+ WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String) ids.getSecondLevelIdentifier());
+ StatusResource statusResource = (StatusResource) experiment.create(ResourceType.STATUS);
+ statusResource.setExperimentId(experiment.getExpID());
+ statusResource.setNodeId(workflowNode.getNodeInstanceId());
+ statusResource.setStatusType(StatusType.WORKFLOW_NODE.toString());
+ statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
+ if (status.getWorkflowNodeState() == null) {
+ statusResource.setState(WorkflowNodeState.UNKNOWN.toString());
+ } else {
+ statusResource.setState(status.getWorkflowNodeState().toString());
+ }
+ statusResource.save();
+ return String.valueOf(statusResource.getStatusId());
+ } catch (Exception e) {
+ logger.error("Error while adding workflow node status...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public String updateWorkflowNodeStatus(WorkflowNodeStatus status, String nodeId) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode(nodeId);
+ StatusResource statusResource = workflowNode.getWorkflowNodeStatus();
+ if (statusResource == null) {
+ statusResource = (StatusResource) workflowNode.create(ResourceType.STATUS);
+ }
+ statusResource.setExperimentId(workflowNode.getExperimentId());
+ statusResource.setNodeId(nodeId);
+ statusResource.setStatusType(StatusType.WORKFLOW_NODE.toString());
+ statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
+ statusResource.setState(status.getWorkflowNodeState().toString());
+ statusResource.save();
+ logger.debugId(nodeId, "Updated workflow node {} status to {}.", nodeId, status.toString());
+ return String.valueOf(statusResource.getStatusId());
+ } catch (Exception e) {
+ logger.errorId(nodeId, "Error while updating workflow node status to " + status.toString() + "...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public String addTaskStatus(TaskStatus status, CompositeIdentifier ids) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String) ids.getTopLevelIdentifier());
+ TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getSecondLevelIdentifier());
+ StatusResource statusResource = (StatusResource) workflowNode.create(ResourceType.STATUS);
+ statusResource.setExperimentId(workflowNode.getExperimentId());
+ statusResource.setNodeId(workflowNode.getNodeInstanceId());
+ statusResource.setTaskId(taskDetail.getTaskId());
+ statusResource.setStatusType(StatusType.TASK.toString());
+ statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
+ if (status.getExecutionState() == null) {
+ statusResource.setState(TaskState.UNKNOWN.toString());
+ } else {
+ statusResource.setState(status.getExecutionState().toString());
+ }
+ statusResource.save();
+ return String.valueOf(statusResource.getStatusId());
+ } catch (Exception e) {
+ logger.error("Error while adding task status...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public void updateTaskStatus(TaskStatus status, String taskId) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
+ StatusResource statusResource;
+ if (taskDetail.isTaskStatusExist(taskId)) {
+ workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
+ statusResource = workflowNode.getTaskStatus(taskId);
+ } else {
+ statusResource = (StatusResource) taskDetail.create(ResourceType.STATUS);
+ }
+ statusResource.setExperimentId(workflowNode.getExperimentId());
+ statusResource.setNodeId(workflowNode.getNodeInstanceId());
+ statusResource.setTaskId(taskId);
+ statusResource.setStatusType(StatusType.TASK.toString());
+ statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
+ statusResource.setState(status.getExecutionState().toString());
+ statusResource.save();
+ logger.infoId(taskId, "Updated task {} status to {}.", taskId, status.toString());
+ } catch (Exception e) {
+ logger.errorId(taskId, "Error while updating task status to " + status.toString() + "...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ /**
+ * @param status job status
+ * @param ids composite id will contain taskid and jobid
+ * @return status id
+ */
+ public String addJobStatus(JobStatus status, CompositeIdentifier ids) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
+ workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
+ JobDetailResource jobDetail = taskDetail.getJobDetail((String) ids.getSecondLevelIdentifier());
+ StatusResource statusResource = (StatusResource) jobDetail.create(ResourceType.STATUS);
+ statusResource.setExperimentId(workflowNode.getExperimentId());
+ statusResource.setNodeId(workflowNode.getNodeInstanceId());
+ statusResource.setTaskId(taskDetail.getTaskId());
+ statusResource.setStatusType(StatusType.JOB.toString());
+ statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
+ if (status.getJobState() == null) {
+ statusResource.setState(JobState.UNKNOWN.toString());
+ } else {
+ statusResource.setState(status.getJobState().toString());
+ }
+ statusResource.save();
+ return String.valueOf(statusResource.getStatusId());
+ } catch (Exception e) {
+ logger.error("Error while adding job status...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public String updateJobStatus(JobStatus status, CompositeIdentifier ids) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
+ JobDetailResource jobDetail = taskDetail.getJobDetail((String) ids.getSecondLevelIdentifier());
+ StatusResource statusResource = jobDetail.getJobStatus();
+ workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
+ statusResource.setExperimentId(workflowNode.getExperimentId());
+ statusResource.setNodeId(workflowNode.getNodeInstanceId());
+ statusResource.setTaskId(taskDetail.getTaskId());
+ statusResource.setStatusType(StatusType.JOB.toString());
+ statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
+ statusResource.setState(status.getJobState().toString());
+ statusResource.save();
+ logger.infoId(ids.toString(), "Updated job status to {}", status.toString());
+ return String.valueOf(statusResource.getStatusId());
+ } catch (Exception e) {
+ logger.errorId(ids.toString(), "Error while updating job status to " + status.toString() + " ...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ /**
+ * @param status application status
+ * @param ids composite id will contain taskid and jobid
+ * @return status id
+ */
+ public String addApplicationStatus(ApplicationStatus status, CompositeIdentifier ids) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
+ JobDetailResource jobDetail = taskDetail.getJobDetail((String) ids.getSecondLevelIdentifier());
+ StatusResource statusResource = (StatusResource) jobDetail.create(ResourceType.STATUS);
+ workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
+ statusResource.setExperimentId(workflowNode.getExperimentId());
+ statusResource.setNodeId(workflowNode.getNodeInstanceId());
+ statusResource.setTaskId(taskDetail.getTaskId());
+ statusResource.setStatusType(StatusType.APPLICATION.toString());
+ statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
+ if (status.getApplicationState() == null) {
+ statusResource.setState("UNKNOWN");
+ } else {
+ statusResource.setState(status.getApplicationState());
+ }
+ statusResource.save();
+ return String.valueOf(statusResource.getStatusId());
+ } catch (Exception e) {
+ logger.error("Unable to read airavata-server properties", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public void updateApplicationStatus(ApplicationStatus status, String jobId) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
+ JobDetailResource jobDetail = taskDetail.getJobDetail(jobId);
+ StatusResource statusResource = jobDetail.getApplicationStatus();
+ workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
+ statusResource.setExperimentId(workflowNode.getExperimentId());
+ statusResource.setNodeId(workflowNode.getNodeInstanceId());
+ statusResource.setTaskId(taskDetail.getTaskId());
+ statusResource.setStatusType(StatusType.APPLICATION.toString());
+ statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
+ statusResource.setState(status.getApplicationState());
+ statusResource.save();
+ } catch (Exception e) {
+ logger.error("Error while updating application status...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+
+ /**
+ * @param status data transfer status
+ * @param ids contains taskId and transfer id
+ * @return status id
+ */
+ public String addTransferStatus(TransferStatus status, CompositeIdentifier ids) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
+ DataTransferDetailResource dataTransferDetail = taskDetail.getDataTransferDetail((String) ids.getSecondLevelIdentifier());
+ StatusResource statusResource = (StatusResource) dataTransferDetail.create(ResourceType.STATUS);
+ workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
+ statusResource.setExperimentId(workflowNode.getExperimentId());
+ statusResource.setNodeId(workflowNode.getNodeInstanceId());
+ statusResource.setTaskId(taskDetail.getTaskId());
+ statusResource.setTransferId(dataTransferDetail.getTransferId());
+ statusResource.setStatusType(StatusType.DATA_TRANSFER.toString());
+ statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
+ if (status.getTransferState() == null) {
+ statusResource.setState(TransferState.UNKNOWN.toString());
+ } else {
+ statusResource.setState(status.getTransferState().toString());
+ }
+ statusResource.save();
+ return String.valueOf(statusResource.getStatusId());
+ } catch (Exception e) {
+ logger.error("Error while adding transfer status...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public void updateTransferStatus(TransferStatus status, String transferId) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
+ DataTransferDetailResource dataTransferDetail = taskDetail.getDataTransferDetail(transferId);
+ StatusResource statusResource = dataTransferDetail.getDataTransferStatus();
+
+ String taskId = dataTransferDetail.getTaskId();
+ taskDetail = workflowNode.getTaskDetail(taskId);
+ workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
+ if (workflowNode != null) {
+ statusResource.setExperimentId(workflowNode.getExperimentId());
+ statusResource.setNodeId(workflowNode.getNodeInstanceId());
+ }
+ statusResource.setTaskId(taskId);
+ statusResource.setTransferId(transferId);
+ statusResource.setStatusType(StatusType.DATA_TRANSFER.toString());
+ statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
+ statusResource.setState(status.getTransferState().toString());
+ statusResource.save();
+ } catch (Exception e) {
+ logger.error("Error while updating transfer status...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public String addWorkflowNodeDetails(WorkflowNodeDetails nodeDetails, String expId) throws RegistryException {
+ try {
+ ExperimentResource experiment = gatewayResource.getExperiment(expId);
+ WorkflowNodeDetailResource resource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ resource.setExperimentId(expId);
+ resource.setNodeName(nodeDetails.getNodeName());
+ resource.setExecutionUnit(nodeDetails.getExecutionUnit().toString());
+ resource.setExecutionUnitData(nodeDetails.getExecutionUnitData());
+ resource.setCreationTime(AiravataUtils.getTime(nodeDetails.getCreationTime()));
+ resource.setNodeInstanceId(getNodeInstanceID(nodeDetails.getNodeName()));
+ resource.save();
+ String nodeId = resource.getNodeInstanceId();
+ List<InputDataObjectType> nodeInputs = nodeDetails.getNodeInputs();
+ if (nodeInputs != null) {
+ addWorkflowInputs(nodeDetails.getNodeInputs(), resource);
+ }
+ List<OutputDataObjectType> nodeOutputs = nodeDetails.getNodeOutputs();
+ if (nodeOutputs != null && !nodeOutputs.isEmpty()) {
+ CompositeIdentifier ids = new CompositeIdentifier(expId, nodeId);
+ addNodeOutputs(nodeOutputs, ids);
+ }
+ WorkflowNodeStatus workflowNodeStatus = nodeDetails.getWorkflowNodeStatus();
+ CompositeIdentifier ids = new CompositeIdentifier(expId, nodeId);
+ if (workflowNodeStatus == null) {
+ workflowNodeStatus = new WorkflowNodeStatus();
+ }
+// if (workflowNodeStatus.getWorkflowNodeState() != null){
+// WorkflowNodeStatus status = getWorkflowNodeStatus(nodeId);
+// if (status != null){
+// updateWorkflowNodeStatus(workflowNodeStatus, nodeId);
+// }else {
+// addWorkflowNodeStatus(workflowNodeStatus,ids);
+// }
+// }else {
+// workflowNodeStatus.setWorkflowNodeState(WorkflowNodeState.UNKNOWN);
+// addWorkflowNodeStatus(workflowNodeStatus, ids);
+// }
+ workflowNodeStatus.setWorkflowNodeState(WorkflowNodeState.UNKNOWN);
+ addWorkflowNodeStatus(workflowNodeStatus, ids);
+ List<TaskDetails> taskDetails = nodeDetails.getTaskDetailsList();
+ if (taskDetails != null && !taskDetails.isEmpty()) {
+ for (TaskDetails task : taskDetails) {
+ addTaskDetails(task, nodeId);
+ }
+ }
+ List<ErrorDetails> errors = nodeDetails.getErrors();
+ if (errors != null && !errors.isEmpty()) {
+ for (ErrorDetails error : errors) {
+ addErrorDetails(error, nodeId);
+ }
+ }
+ return nodeId;
+ } catch (Exception e) {
+ logger.error("Error while adding workflow node details...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public void updateWorkflowNodeDetails(WorkflowNodeDetails nodeDetails, String nodeId) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode(nodeId);
+ workflowNode.setNodeName(nodeDetails.getNodeName());
+ workflowNode.setExecutionUnit(nodeDetails.getExecutionUnit().toString());
+ workflowNode.setExecutionUnitData(nodeDetails.getExecutionUnitData());
+ workflowNode.setCreationTime(AiravataUtils.getTime(nodeDetails.getCreationTime()));
+ workflowNode.setNodeInstanceId(nodeId);
+ workflowNode.save();
+ String expID = workflowNode.getExperimentId();
+ List<InputDataObjectType> nodeInputs = nodeDetails.getNodeInputs();
+ if (nodeInputs != null) {
+ updateWorkflowInputs(nodeDetails.getNodeInputs(), workflowNode);
+ }
+ List<OutputDataObjectType> nodeOutputs = nodeDetails.getNodeOutputs();
+ if (nodeOutputs != null && !nodeOutputs.isEmpty()) {
+ updateNodeOutputs(nodeOutputs, nodeId);
+ }
+ WorkflowNodeStatus workflowNodeStatus = nodeDetails.getWorkflowNodeStatus();
+ if (workflowNodeStatus != null) {
+ if (isWFNodeExist(nodeId)) {
+ updateWorkflowNodeStatus(workflowNodeStatus, nodeId);
+ } else {
+ CompositeIdentifier ids = new CompositeIdentifier(expID, nodeId);
+ addWorkflowNodeStatus(workflowNodeStatus, ids);
+ }
+ }
+ List<TaskDetails> taskDetails = nodeDetails.getTaskDetailsList();
+ if (taskDetails != null && !taskDetails.isEmpty()) {
+ for (TaskDetails task : taskDetails) {
+ String taskID = task.getTaskID();
+ if (isTaskDetailExist(taskID)) {
+ updateTaskDetails(task, taskID);
+ } else {
+ addTaskDetails(task, nodeId);
+ }
+ }
+ }
+ List<ErrorDetails> errors = nodeDetails.getErrors();
+ if (errors != null && !errors.isEmpty()) {
+ for (ErrorDetails error : errors) {
+ addErrorDetails(error, nodeId);
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error while updating workflow node details...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+
+ public void addWorkflowInputs(List<InputDataObjectType> wfInputs, WorkflowNodeDetailResource nodeDetailResource) throws RegistryException {
+ try {
+ for (InputDataObjectType input : wfInputs) {
+ NodeInputResource resource = (NodeInputResource) nodeDetailResource.create(ResourceType.NODE_INPUT);
+ resource.setNodeId(nodeDetailResource.getNodeInstanceId());
+ resource.setInputKey(input.getName());
+ resource.setValue(input.getValue());
+ if (input.getType() != null) {
+ resource.setDataType(input.getType().toString());
+ }
+ resource.setMetadata(input.getMetaData());
+ resource.setAppArgument(input.getApplicationArgument());
+ resource.setInputOrder(input.getInputOrder());
+ resource.setRequired(input.isIsRequired());
+ resource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
+ resource.save();
+ }
+ } catch (Exception e) {
+ logger.error("Error while adding workflow inputs...", e);
+ throw new RegistryException(e);
+ }
+
+ }
+
+ public void updateWorkflowInputs(List<InputDataObjectType> wfInputs, WorkflowNodeDetailResource nodeDetailResource) throws RegistryException {
+ try {
+ List<NodeInputResource> nodeInputs = nodeDetailResource.getNodeInputs();
+ for (InputDataObjectType input : wfInputs) {
+ for (NodeInputResource resource : nodeInputs) {
+ resource.setNodeId(nodeDetailResource.getNodeInstanceId());
+ resource.setInputKey(input.getName());
+ resource.setValue(input.getValue());
+ if (input.getType() != null) {
+ resource.setDataType(input.getType().toString());
+ }
+ resource.setMetadata(input.getMetaData());
+ resource.setAppArgument(input.getApplicationArgument());
+ resource.setInputOrder(input.getInputOrder());
+ resource.setRequired(input.isIsRequired());
+ resource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
+ resource.save();
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error while updating workflow inputs...", e);
+ throw new RegistryException(e);
+ }
+
+ }
+
+ public String addTaskDetails(TaskDetails taskDetails, String nodeId) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode(nodeId);
+ TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
+ taskDetail.setNodeId(nodeId);
+ taskDetail.setTaskId(getTaskID(workflowNode.getNodeName()));
+ taskDetail.setApplicationId(taskDetails.getApplicationId());
+ taskDetail.setApplicationVersion(taskDetails.getApplicationVersion());
+ taskDetail.setCreationTime(AiravataUtils.getTime(taskDetails.getCreationTime()));
+ taskDetail.setEnableEmailNotifications(taskDetails.isEnableEmailNotification());
+ taskDetail.save();
+
+ List<String> emailAddresses = taskDetails.getEmailAddresses();
+ if (emailAddresses != null && !emailAddresses.isEmpty()){
+ for (String email : emailAddresses){
+ NotificationEmailResource emailResource = new NotificationEmailResource();
+ emailResource.setExperimentId(workflowNode.getExperimentId());
+ emailResource.setTaskId(taskDetail.getTaskId());
+ emailResource.setEmailAddress(email);
+ emailResource.save();
+ }
+ }
+
+ List<InputDataObjectType> applicationInputs = taskDetails.getApplicationInputs();
+ if (applicationInputs != null) {
+ addAppInputs(applicationInputs, taskDetail);
+ }
+ List<OutputDataObjectType> applicationOutput = taskDetails.getApplicationOutputs();
+ if (applicationOutput != null) {
+ addAppOutputs(applicationOutput, taskDetail);
+ }
+ ComputationalResourceScheduling taskScheduling = taskDetails.getTaskScheduling();
+ if (taskScheduling != null) {
+ addComputationScheduling(taskScheduling, taskDetail);
+ }
+ AdvancedInputDataHandling inputDataHandling = taskDetails.getAdvancedInputDataHandling();
+ if (inputDataHandling != null) {
+ addInputDataHandling(inputDataHandling, taskDetail);
+ }
+ AdvancedOutputDataHandling outputDataHandling = taskDetails.getAdvancedOutputDataHandling();
+ if (outputDataHandling != null) {
+ addOutputDataHandling(outputDataHandling, taskDetail);
+ }
+
+ List<JobDetails> jobDetailsList = taskDetails.getJobDetailsList();
+ if (jobDetailsList != null && !jobDetailsList.isEmpty()) {
+ for (JobDetails job : jobDetailsList) {
+ CompositeIdentifier ids = new CompositeIdentifier(taskDetail.getTaskId(), job.getJobID());
+ addJobDetails(job, ids);
+ }
+ }
+
+ List<DataTransferDetails> dataTransferDetailsList = taskDetails.getDataTransferDetailsList();
+ if (dataTransferDetailsList != null && !dataTransferDetailsList.isEmpty()) {
+ for (DataTransferDetails transferDetails : dataTransferDetailsList) {
+ addDataTransferDetails(transferDetails, taskDetail.getTaskId());
+ }
+ }
+
+ List<ErrorDetails> errors = taskDetails.getErrors();
+ if (errors != null && !errors.isEmpty()) {
+ for (ErrorDetails error : errors) {
+ addErrorDetails(error, taskDetail.getTaskId());
+ }
+ }
+
+ TaskStatus taskStatus = taskDetails.getTaskStatus();
+ CompositeIdentifier ids = new CompositeIdentifier(nodeId, taskDetail.getTaskId());
+ if (taskStatus != null) {
+ if (taskStatus.getExecutionState() != null) {
+ addTaskStatus(taskStatus, ids);
+ } else {
+ taskStatus.setExecutionState(TaskState.UNKNOWN);
+ addTaskStatus(taskStatus, ids);
+ }
+ } else {
+ TaskStatus status = new TaskStatus();
+ status.setExecutionState(TaskState.UNKNOWN);
+ addTaskStatus(status, ids);
+ }
+ return taskDetail.getTaskId();
+ } catch (Exception e) {
+ logger.error("Error while adding task details...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public String updateTaskDetails(TaskDetails taskDetails, String taskId) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
+// taskDetail.setWorkflowNodeDetailResource(workflowNode);
+ taskDetail.setApplicationId(taskDetails.getApplicationId());
+ taskDetail.setApplicationVersion(taskDetails.getApplicationVersion());
+ taskDetail.setCreationTime(AiravataUtils.getTime(taskDetails.getCreationTime()));
+ taskDetail.setApplicationDeploymentId(taskDetails.getApplicationDeploymentId());
+ taskDetail.setEnableEmailNotifications(taskDetails.isEnableEmailNotification());
+ taskDetail.save();
+
+ workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
+
+ List<String> emailAddresses = taskDetails.getEmailAddresses();
+ // remove existing emails
+ taskDetail.remove(ResourceType.NOTIFICATION_EMAIL, taskId);
+ if (emailAddresses != null && !emailAddresses.isEmpty()){
+ for (String email : emailAddresses){
+ NotificationEmailResource emailResource = new NotificationEmailResource();
+ emailResource.setExperimentId(workflowNode.getExperimentId());
+ emailResource.setTaskId(taskId);
+ emailResource.setEmailAddress(email);
+ emailResource.save();
+ }
+ }
+ List<InputDataObjectType> applicationInputs = taskDetails.getApplicationInputs();
+ if (applicationInputs != null) {
+ updateAppInputs(applicationInputs, taskDetail);
+ }
+ ComputationalResourceScheduling taskScheduling = taskDetails.getTaskScheduling();
+ if (taskScheduling != null) {
+ updateSchedulingData(taskScheduling, taskDetail);
+ }
+ AdvancedInputDataHandling inputDataHandling = taskDetails.getAdvancedInputDataHandling();
+ if (inputDataHandling != null) {
+ updateInputDataHandling(inputDataHandling, taskDetail);
+ }
+ AdvancedOutputDataHandling outputDataHandling = taskDetails.getAdvancedOutputDataHandling();
+ if (outputDataHandling != null) {
+ updateOutputDataHandling(outputDataHandling, taskDetail);
+ }
+ List<JobDetails> jobDetailsList = taskDetails.getJobDetailsList();
+ if (jobDetailsList != null && !jobDetailsList.isEmpty()) {
+ for (JobDetails job : jobDetailsList) {
+ CompositeIdentifier ids = new CompositeIdentifier(taskId, job.getJobID());
+ updateJobDetails(job, ids);
+ }
+ }
+
+ List<DataTransferDetails> dataTransferDetailsList = taskDetails.getDataTransferDetailsList();
+ if (dataTransferDetailsList != null && !dataTransferDetailsList.isEmpty()) {
+ for (DataTransferDetails transferDetails : dataTransferDetailsList) {
+ updateDataTransferDetails(transferDetails, transferDetails.getTransferID());
+ }
+ }
+
+ List<ErrorDetails> errors = taskDetails.getErrors();
+ if (errors != null && !errors.isEmpty()) {
+ for (ErrorDetails error : errors) {
+ addErrorDetails(error, taskDetail.getTaskId());
+ }
+ }
+
+ TaskStatus taskStatus = taskDetails.getTaskStatus();
+ if (taskStatus != null) {
+ updateTaskStatus(taskStatus, taskId);
+ }
+ return taskDetail.getTaskId();
+ } catch (Exception e) {
+ logger.error("Error while updating task details...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public void addAppInputs(List<InputDataObjectType> appInputs, TaskDetailResource taskDetailResource) throws RegistryException {
+ try {
+ for (InputDataObjectType input : appInputs) {
+ ApplicationInputResource resource = (ApplicationInputResource) taskDetailResource.create(ResourceType.APPLICATION_INPUT);
+ resource.setTaskId(taskDetailResource.getTaskId());
+ resource.setInputKey(input.getName());
+ resource.setValue(input.getValue());
+ if (input.getType() != null) {
+ resource.setDataType(input.getType().toString());
+ }
+ resource.setMetadata(input.getMetaData());
+ resource.setAppArgument(input.getApplicationArgument());
+ resource.setInputOrder(input.getInputOrder());
+ resource.setRequired(input.isIsRequired());
+ resource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
+ resource.save();
+ }
+ } catch (Exception e) {
+ logger.error("Error while adding application inputs...", e);
+ throw new RegistryException(e);
+ }
+
+ }
+
+ public void addAppOutputs(List<OutputDataObjectType> appOytputs, TaskDetailResource taskDetailResource) throws RegistryException {
+ try {
+ for (OutputDataObjectType output : appOytputs) {
+ ApplicationOutputResource resource = (ApplicationOutputResource) taskDetailResource.create(ResourceType.APPLICATION_OUTPUT);
+ resource.setTaskId(taskDetailResource.getTaskId());
+ resource.setOutputKey(output.getName());
+ resource.setValue(output.getValue());
+ if (output.getType() != null) {
+ resource.setDataType(output.getType().toString());
+ }
+ resource.setRequired(output.isIsRequired());
+ resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
+ resource.setDataMovement(output.isDataMovement());
+ resource.setDataNameLocation(output.getLocation());
+ resource.setAppArgument(output.getApplicationArgument());
+ resource.setSearchQuery(output.getSearchQuery());
+ resource.save();
+ }
+ } catch (Exception e) {
+ logger.error("Error while adding application outputs...", e);
+ throw new RegistryException(e);
+ }
+
+ }
+
+ public void updateAppOutputs(List<OutputDataObjectType> appOutputs, String taskId) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
+ List<ApplicationOutputResource> outputs = taskDetail.getApplicationOutputs();
+ for (OutputDataObjectType output : appOutputs) {
+ for (ApplicationOutputResource resource : outputs) {
+ resource.setTaskId(taskId);
+ resource.setOutputKey(output.getName());
+ resource.setValue(output.getValue());
+ if (output.getType() != null) {
+ resource.setDataType(output.getType().toString());
+ }
+ resource.setRequired(output.isIsRequired());
+ resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
+ resource.setDataMovement(output.isDataMovement());
+ resource.setDataNameLocation(output.getLocation());
+ resource.setAppArgument(output.getApplicationArgument());
+ resource.setSearchQuery(output.getSearchQuery());
+// resource.setMetadata(output.getMetaData());
+ resource.save();
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error while updating application outputs...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public void updateAppInputs(List<InputDataObjectType> appInputs, TaskDetailResource taskDetailResource) throws RegistryException {
+ try {
+ List<ApplicationInputResource> inputs = taskDetailResource.getApplicationInputs();
+ for (InputDataObjectType input : appInputs) {
+ for (ApplicationInputResource resource : inputs) {
+ resource.setTaskId(taskDetailResource.getTaskId());
+ resource.setInputKey(input.getName());
+ resource.setValue(input.getValue());
+ if (input.getType() != null) {
+ resource.setDataType(input.getType().toString());
+ }
+ resource.setMetadata(input.getMetaData());
+ resource.setAppArgument(input.getApplicationArgument());
+ resource.setInputOrder(input.getInputOrder());
+ resource.setRequired(input.isIsRequired());
+ resource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
+ resource.save();
+ }
+
+ }
+ } catch (Exception e) {
+ logger.error("Error while updating application inputs...", e);
+ throw new RegistryException(e);
+ }
+
+ }
+
+ public String addJobDetails(JobDetails jobDetails, CompositeIdentifier ids) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
+ JobDetailResource jobDetail = taskDetail.createJobDetail((String) ids.getSecondLevelIdentifier());
+ jobDetail.setTaskId(taskDetail.getTaskId());
+ jobDetail.setJobDescription(jobDetails.getJobDescription());
+ jobDetail.setCreationTime(AiravataUtils.getTime(jobDetails.getCreationTime()));
+ jobDetail.setComputeResourceConsumed(jobDetails.getComputeResourceConsumed());
+ jobDetail.setWorkingDir(jobDetails.getWorkingDir());
+ jobDetail.setJobName(jobDetails.getJobName());
+ jobDetail.save();
+ JobStatus jobStatus = jobDetails.getJobStatus();
+ if (jobStatus != null) {
+ JobStatus status = getJobStatus(ids);
+ if (status != null) {
+ updateJobStatus(jobStatus, ids);
+ } else {
+ addJobStatus(jobStatus, ids);
+ }
+ }
+ ApplicationStatus applicationStatus = jobDetails.getApplicationStatus();
+ if (applicationStatus != null) {
+ ApplicationStatus appStatus = getApplicationStatus(ids);
+ if (appStatus != null) {
+ updateApplicationStatus(applicationStatus, (String) ids.getSecondLevelIdentifier());
+ } else {
+ addApplicationStatus(applicationStatus, ids);
+ }
+ }
+ List<ErrorDetails> errors = jobDetails.getErrors();
+ if (errors != null && !errors.isEmpty()) {
+ for (ErrorDetails error : errors) {
+ addErrorDetails(error, ids.getSecondLevelIdentifier());
+ }
+ }
+ return jobDetail.getJobId();
+ } catch (Exception e) {
+ logger.error("Error while adding job details...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ // ids - taskId + jobid
+ public void updateJobDetails(JobDetails jobDetails, CompositeIdentifier ids) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ String taskId = (String) ids.getTopLevelIdentifier();
+ TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
+ String jobId = (String) ids.getSecondLevelIdentifier();
+ JobDetailResource jobDetail = taskDetail.getJobDetail(jobId);
+ jobDetail.setTaskId(taskDetail.getTaskId());
+ jobDetail.setJobDescription(jobDetails.getJobDescription());
+ jobDetail.setCreationTime(AiravataUtils.getTime(jobDetails.getCreationTime()));
+ jobDetail.setComputeResourceConsumed(jobDetails.getComputeResourceConsumed());
+ jobDetail.setJobName(jobDetails.getJobName());
+ jobDetail.setWorkingDir(jobDetails.getWorkingDir());
+ jobDetail.save();
+ JobStatus jobStatus = jobDetails.getJobStatus();
+ if (jobStatus != null) {
+ JobStatus status = getJobStatus(ids);
+ if (status != null) {
+ updateJobStatus(jobStatus, ids);
+ } else {
+ addJobStatus(jobStatus, ids);
+ }
+ }
+ ApplicationStatus applicationStatus = jobDetails.getApplicationStatus();
+ if (applicationStatus != null) {
+ ApplicationStatus appStatus = getApplicationStatus(ids);
+ if (appStatus != null) {
+ updateApplicationStatus(applicationStatus, jobId);
+ } else {
+ addApplicationStatus(applicationStatus, ids);
+ }
+ }
+ List<ErrorDetails> errors = jobDetails.getErrors();
+ if (errors != null && !errors.isEmpty()) {
+ for (ErrorDetails error : errors) {
+ addErrorDetails(error, jobId);
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error while updating job details...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public String addDataTransferDetails(DataTransferDetails transferDetails, String taskId) throws RegistryException {
+ try {
+ if (transferDetails.getTransferDescription() == null){
+ throw new RegistryException("Data transfer description cannot be empty");
+ }
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
+ DataTransferDetailResource resource = (DataTransferDetailResource) taskDetail.create(ResourceType.DATA_TRANSFER_DETAIL);
+ resource.setTaskId(taskId);
+ resource.setTransferId(getDataTransferID(taskId));
+
+ resource.setTransferDescription(transferDetails.getTransferDescription());
+ resource.setCreationTime(AiravataUtils.getTime(transferDetails.getCreationTime()));
+ resource.save();
+ String transferId = resource.getTransferId();
+ TransferStatus transferStatus = transferDetails.getTransferStatus();
+ if (transferStatus != null) {
+ TransferStatus status = getDataTransferStatus(transferId);
+ if (status != null) {
+ updateTransferStatus(transferStatus, transferId);
+ } else {
+ CompositeIdentifier ids = new CompositeIdentifier(taskId, transferId);
+ addTransferStatus(transferStatus, ids);
+ }
+ }
+ return resource.getTransferId();
+ } catch (Exception e) {
+ logger.error("Error while adding transfer details...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public String updateDataTransferDetails(DataTransferDetails transferDetails, String transferId) throws RegistryException {
+ try {
+ ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
+ DataTransferDetailResource resource = taskDetail.getDataTransferDetail(transferId);
+// resource.setTaskDetailResource(taskDetail);
+ resource.setTransferDescription(transferDetails.getTransferDescription());
+ resource.setCreationTime(AiravataUtils.getTime(transferDetails.getCreationTime()));
+ resource.save();
+ String taskId = resource.getTaskId();
+ TransferStatus transferStatus = transferDetails.getTransferStatus();
+ if (transferStatus != null) {
+ TransferStatus status = getDataTransferStatus(transferId);
+ if (status != null) {
+ updateTransferStatus(transferStatus, transferId);
+ } else {
+ CompositeIdentifier ids = new CompositeIdentifier(taskId, transferId);
+ addTransferStatus(transferStatus, ids);
+ }
+ }
+ return resource.getTransferId();
+ } catch (Exception e) {
+ logger.error("Error while updating transfer details...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ /**
+ * @param scheduling computational resource object
+ * @param ids contains expId and taskId, if it is an experiment, task id can be null
+ * @return scheduling id
+ */
+ public String addComputationalResourceScheduling(ComputationalResourceScheduling scheduling, CompositeIdentifier ids) throws RegistryException {
+ try {
+ ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
+ ComputationSchedulingResource schedulingResource = (ComputationSchedulingResource) experiment.create(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING);
+ if (ids.getSecondLevelIdentifier() != null) {
+ WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ TaskDetailResource taskDetail = nodeDetailResource.getTaskDetail((String) ids.getSecondLevelIdentifier());
+ schedulingResource.setTaskId(taskDetail.getTaskId());
+ }
+ schedulingResource.setExperimentId(experiment.getExpID());
+ schedulingResource.setResourceHostId(scheduling.getResourceHostId());
+ schedulingResource.setCpuCount(scheduling.getTotalCPUCount());
+ schedulingResource.setNodeCount(scheduling.getNodeCount());
+ schedulingResource.setNumberOfThreads(scheduling.getNumberOfThreads());
+ schedulingResource.setQueueName(scheduling.getQueueName());
+ schedulingResource.setWalltimeLimit(scheduling.getWallTimeLimit());
+ schedulingResource.setJobStartTime(AiravataUtils.getTime(scheduling.getJobStartTime()));
+ schedulingResource.setPhysicalMemory(scheduling.getTotalPhysicalMemory());
+ schedulingResource.setProjectName(scheduling.getComputationalProjectAccount());
+ schedulingResource.save();
+ return String.valueOf(schedulingResource.getSchedulingId());
+ } catch (Exception e) {
+ logger.error("Error while adding scheduling parameters...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ /**
+ * @param dataHandling advanced input data handling object
+ * @param ids contains expId and taskId
+ * @return data handling id
+ */
+ public String addInputDataHandling(AdvancedInputDataHandling dataHandling, CompositeIdentifier ids) throws RegistryException {
+ try {
+ ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
+ AdvanceInputDataHandlingResource dataHandlingResource = (AdvanceInputDataHandlingResource) experiment.create(ResourceType.ADVANCE_INPUT_DATA_HANDLING);
+ if (ids.getSecondLevelIdentifier() != null) {
+ WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ TaskDetailResource taskDetail = nodeDetailResource.getTaskDetail((String) ids.getSecondLevelIdentifier());
+ dataHandlingResource.setTaskId(taskDetail.getTaskId());
+ }
+ dataHandlingResource.setExperimentId(experiment.getExpID());
+ dataHandlingResource.setWorkingDir(dataHandling.getUniqueWorkingDirectory());
+ dataHandlingResource.setWorkingDirParent(dataHandling.getParentWorkingDirectory());
+ dataHandlingResource.setStageInputFiles(dataHandling.isStageInputFilesToWorkingDir());
+ dataHandlingResource.setCleanAfterJob(dataHandling.isCleanUpWorkingDirAfterJob());
+ dataHandlingResource.save();
+ return String.valueOf(dataHandlingResource.getDataHandlingId());
+ } catch (Exception e) {
+ logger.error("Error while adding input data handling...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ /**
+ * @param dataHandling advanced output data handling object
+ * @param ids contains expId and taskId
+ * @return data handling id
+ */
+ public String addOutputDataHandling(AdvancedOutputDataHandling dataHandling, CompositeIdentifier ids) throws RegistryException {
+ try {
+ ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
+ AdvancedOutputDataHandlingResource dataHandlingResource = (AdvancedOutputDataHandlingResource) experiment.create(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING);
+ if (ids.getSecondLevelIdentifier() != null) {
+ WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ TaskDetailResource taskDetail = nodeDetailResource.getTaskDetail((String) ids.getSecondLevelIdentifier());
+ dataHandlingResource.setTaskId(taskDetail.getTaskId());
+ }
+ dataHandlingResource.setExperimentId(experiment.getExpID());
+ dataHandlingResource.setOutputDataDir(dataHandling.getOutputDataDir());
+ dataHandlingResource.setDataRegUrl(dataHandling.getDataRegistryURL());
+ dataHandlingResource.setPersistOutputData(dataHandling.isPersistOutputData());
+ dataHandlingResource.save();
+ return String.valueOf(dataHandlingResource.getOutputDataHandlingId());
+ } catch (Exception e) {
+ logger.error("Error while adding output data handling...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public String addQosParams(QualityOfServiceParams qosParams, CompositeIdentifier ids) throws RegistryException {
+ try {
+ ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
+ QosParamResource qosParamResource = (QosParamResource) experiment.create(ResourceType.QOS_PARAM);
+ if (ids.getSecondLevelIdentifier() != null) {
+ WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ TaskDetailResource taskDetail = nodeDetailResource.getTaskDetail((String) ids.getSecondLevelIdentifier());
+ qosParamResource.setTaskId(taskDetail.getTaskId());
+ }
+ qosParamResource.setExperimentId(experiment.getExpID());
+ qosParamResource.setStartExecutionAt(qosParams.getStartExecutionAt());
+ qosParamResource.setExecuteBefore(qosParams.getExecuteBefore());
+ qosParamResource.setNoOfRetries(qosParams.getNumberofRetries());
+ qosParamResource.save();
+ return String.valueOf(qosParamResource.getQosId());
+ } catch (Exception e) {
+ logger.error("Error while adding QOS params...", e);
+ throw new RegistryException(e);
+ }
+ }
+
+ public String addErrorDetails(ErrorDetails error, Object id) throws RegistryException {
+ try {
+
+ ErrorDetailResource errorResource = null;
+ ExperimentResource experiment;
+ TaskDetailResource taskDetail;
+ WorkflowNodeDetailResource workflowNode;
+ // figure out the id is an experiment, node task or job
+ if (id instanceof String) {
+ // FIXME : for .12 we only save task related errors
+// if (isExperimentExist((String) id)) {
+// experiment = gatewayResource.getExperiment((String) id);
+// errorResource = (ErrorDetailResource) experiment.create(ResourceType.ERROR_DETAIL);
+// } else if (isWFNodeExist((String) id)) {
+// experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+// workflowNode = experiment.getWorkflowNode((String) id);
+// errorResource = (ErrorDetailResource) workflowNode.create(ResourceType.ERROR_DETAIL);
+// errorResource.setExperimentResource(workflowNode.getExperimentResource());
+// } else
+ if (isTaskDetailExist((String) id)) {
+ experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ taskDetail = workflowNode.getTaskDetail((String) id);
+ errorResource = (ErrorDetailResource) taskDetail.create(ResourceType.ERROR_DETAIL);
+ if (error.getErrorID() != null && !error.getErrorID().equals(experimentModelConstants.DEFAULT_ID)) {
+ List<ErrorDetailResource> errorDetailList = taskDetail.getErrorDetailList();
+ if (errorDetailList != null && !errorDetailList.isEmpty()) {
+ for (ErrorDetailResource errorDetailResource : errorDetailList) {
+ if (errorDetailResource.getErrorId() == Integer.parseInt(error.getErrorID())) {
+ errorResource = errorDetailResource;
+ }
+ }
+ }
+ }
+ errorResource.setTaskId(taskDetail.getTaskId());
+ errorResource.setNodeId(taskDetail.getNodeId());
+ workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
+ errorResource.setExperimentId(workflowNode.getExperimentId());
+ } else {
+// logger.error("The id provided is not an experiment id or a workflow id or a task id..");
+ }
+ } else if (id instanceof CompositeIdentifier) {
+ CompositeIdentifier cid = (CompositeIdentifier) id;
+ if (isJobDetailExist(cid)) {
+ experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+ workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
+ taskDetail = workflowNode.getTaskDetail((String) cid.getTopLevelIdentifier());
+ JobDetailResource jobDetail = taskDetail.getJobDetail((String) cid.getSecondLevelIdentifier());
+ errorResource = (ErrorDetailResource) jobDetail.create(ResourceType.ERROR_DETAIL);
+ if (error.getErrorID() != null && !error.getErrorID().equals(experimentModelConstants.DEFAULT_ID)) {
+ List<ErrorDetailResource> errorDetailList = taskDetail.getErrorDetailList();
+ if (errorDetailList != null && !errorDetailList.isEmpty()) {
+ for (ErrorDetailResource errorDetailResource : errorDetailList) {
+ if (errorDetailResource.getErrorId() == Integer.parseInt(error.getErrorID())) {
+ errorResource = errorDetailResource;
+ }
+ }
+ }
+ }
+ errorResource.setTaskId(taskDetail.getTaskId());
+ errorResource.setNodeId(taskDetail.getNodeId());
+ workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
+ errorResource.setExperimentId(workflowNode.getExperimentId());
+ } else {
+ logger.error("The id provided is not a job in the system..");
+ }
+ } else {
+// logger.error("The id provided is not an experiment id or a workflow id or a task id or a composite " +
+// "identifier for job..");
+ }
+ if (errorResource != null) {
+ errorResource.setCreationTime(AiravataUtils.getTime(error.getCreationTime()));
+ errorResource.setActualErrorMsg(error.getActualErrorMessage());
+ errorResource.setUserFriendlyErrorMsg(error.getUserFriendlyMessage());
+ if (error.getErrorCategory() != null) {
+ errorResource.setErrorCategory(error.getErrorCategory().toString());
+ }
+ errorResource.setTransientPersistent(error.isTransientOrPersistent());
+ if (error.getCorrectiveAction() != null) {
+ errorResource.setCorrectiveAction(error.getCorrectiveAction().toString());
+ } else {
+ errorResource.setCorrectiveAction(CorrectiveAction.CONTACT_SUPPORT.toString());
+ }
+ if (error.getActionableGroup() != null) {
+ errorResource.setActionableGroup(error.getActionableGroup().toString());
+ } else {
+ errorResource.setActionableGroup(ActionableGroup.GATEWAYS_ADMINS.toString());
+ }
+ errorResource.save();
+ return String.valueOf(errorResource.getErrorId());
+ }
+ } catch (Exception e) {
+ logger.error("Unable to add error details...", e);
+ throw new RegistryException(e);
+ }
+ return null;
+ }
+
+ public String getNodeInstanceID(String nodeName) {
+ String node = nodeName.replaceAll("\\s", "");
+ return node + "_" + UUID.randomUUID();
+ }
+
+ public String getExperimentID(String experimentName) {
+ String exp = experimentName.replaceAll("\\s", "");
+ return exp + "_" + UUID.randomUUID();
+ }
+
+ public String getTaskID(String nodeName) {
<TRUNCATED>
[09/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationOutput.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationOutput.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationOutput.java
new file mode 100644
index 0000000..d82ca87
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationOutput.java
@@ -0,0 +1,142 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name = "APPLICATION_OUTPUT")
+@IdClass(ApplicationOutput_PK.class)
+public class ApplicationOutput implements Serializable {
+ @Id
+ @Column(name = "TASK_ID")
+ private String taskId;
+ @Id
+ @Column(name = "OUTPUT_KEY")
+ private String outputKey;
+ @Column(name = "DATA_TYPE")
+ private String dataType;
+ @Lob
+ @Column(name = "VALUE")
+ private char[] value;
+
+ @Column(name = "IS_REQUIRED")
+ private boolean isRequired;
+ @Column(name="REQUIRED_TO_COMMANDLINE")
+ private boolean addedToCmd;
+ @Column(name = "DATA_MOVEMENT")
+ private boolean dataMovement;
+ @Column(name = "DATA_NAME_LOCATION")
+ private String dataNameLocation;
+ @Column(name = "SEARCH_QUERY")
+ private String searchQuery;
+ @Column(name = "APP_ARGUMENT")
+ private String applicationArgument;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "TASK_ID")
+ private TaskDetail task;
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public char[] getValue() {
+ return value;
+ }
+
+ public void setValue(char[] value) {
+ this.value = value;
+ }
+
+ public String getOutputKey() {
+ return outputKey;
+ }
+
+ public void setOutputKey(String outputKey) {
+ this.outputKey = outputKey;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public boolean isRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean isRequired) {
+ this.isRequired = isRequired;
+ }
+
+ public boolean isAddedToCmd() {
+ return addedToCmd;
+ }
+
+ public void setAddedToCmd(boolean addedToCmd) {
+ this.addedToCmd = addedToCmd;
+ }
+
+ public boolean isDataMovement() {
+ return dataMovement;
+ }
+
+ public void setDataMovement(boolean dataMovement) {
+ this.dataMovement = dataMovement;
+ }
+
+ public String getDataNameLocation() {
+ return dataNameLocation;
+ }
+
+ public void setDataNameLocation(String dataNameLocation) {
+ this.dataNameLocation = dataNameLocation;
+ }
+
+ public String getSearchQuery() {
+ return searchQuery;
+ }
+
+ public void setSearchQuery(String searchQuery) {
+ this.searchQuery = searchQuery;
+ }
+
+ public String getApplicationArgument() {
+ return applicationArgument;
+ }
+
+ public void setApplicationArgument(String applicationArgument) {
+ this.applicationArgument = applicationArgument;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationOutput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationOutput_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationOutput_PK.java
new file mode 100644
index 0000000..3ebc57a
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ApplicationOutput_PK.java
@@ -0,0 +1,64 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import java.io.Serializable;
+
+public class ApplicationOutput_PK implements Serializable {
+ private String taskId;
+ private String outputKey;
+
+ public ApplicationOutput_PK(String outputKey, String taskId) {
+ this.outputKey = outputKey;
+ this.taskId = taskId;
+ }
+
+ public ApplicationOutput_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getOutputKey() {
+ return outputKey;
+ }
+
+ public void setOutputKey(String outputKey) {
+ this.outputKey = outputKey;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Computational_Resource_Scheduling.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Computational_Resource_Scheduling.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Computational_Resource_Scheduling.java
new file mode 100644
index 0000000..a177722
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Computational_Resource_Scheduling.java
@@ -0,0 +1,174 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+@DataCache
+@Entity
+@Table(name = "COMPUTATIONAL_RESOURCE_SCHEDULING")
+public class Computational_Resource_Scheduling implements Serializable {
+ @Id
+ @GeneratedValue
+ @Column(name = "RESOURCE_SCHEDULING_ID")
+ private int schedulingId;
+ @Column(name = "EXPERIMENT_ID")
+ private String expId;
+ @Column(name = "TASK_ID")
+ private String taskId;
+ @Column(name = "RESOURCE_HOST_ID")
+ private String resourceHostId;
+ @Column(name = "CPU_COUNT")
+ private int cpuCount;
+ @Column(name = "NODE_COUNT")
+ private int nodeCount;
+ @Column(name = "NO_OF_THREADS")
+ private int numberOfThreads;
+ @Column(name = "QUEUE_NAME")
+ private String queueName;
+ @Column(name = "WALLTIME_LIMIT")
+ private int wallTimeLimit;
+ @Column(name = "JOB_START_TIME")
+ private Timestamp jobStartTime;
+ @Column(name = "TOTAL_PHYSICAL_MEMORY")
+ private int totalPhysicalmemory;
+ @Column(name = "COMPUTATIONAL_PROJECT_ACCOUNT")
+ private String projectName;
+ @Column(name = "CHESSIS_NAME")
+ private String chessisName;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "EXPERIMENT_ID")
+ private Experiment experiment;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "TASK_ID")
+ private TaskDetail task;
+
+ public String getChessisName() {
+ return chessisName;
+ }
+
+ public void setChessisName(String chessisName) {
+ this.chessisName = chessisName;
+ }
+
+ public int getSchedulingId() {
+ return schedulingId;
+ }
+
+ public void setSchedulingId(int schedulingId) {
+ this.schedulingId = schedulingId;
+ }
+
+ public String getExpId() {
+ return expId;
+ }
+
+ public void setExpId(String expId) {
+ this.expId = expId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getResourceHostId() {
+ return resourceHostId;
+ }
+
+ public void setResourceHostId(String resourceHostId) {
+ this.resourceHostId = resourceHostId;
+ }
+
+ public int getCpuCount() {
+ return cpuCount;
+ }
+
+ public void setCpuCount(int cpuCount) {
+ this.cpuCount = cpuCount;
+ }
+
+ public int getNodeCount() {
+ return nodeCount;
+ }
+
+ public void setNodeCount(int nodeCount) {
+ this.nodeCount = nodeCount;
+ }
+
+ public int getNumberOfThreads() {
+ return numberOfThreads;
+ }
+
+ public void setNumberOfThreads(int numberOfThreads) {
+ this.numberOfThreads = numberOfThreads;
+ }
+
+ public String getQueueName() {
+ return queueName;
+ }
+
+ public void setQueueName(String queueName) {
+ this.queueName = queueName;
+ }
+
+ public int getWallTimeLimit() {
+ return wallTimeLimit;
+ }
+
+ public void setWallTimeLimit(int wallTimeLimit) {
+ this.wallTimeLimit = wallTimeLimit;
+ }
+
+ public Timestamp getJobStartTime() {
+ return jobStartTime;
+ }
+
+ public void setJobStartTime(Timestamp jobStartTime) {
+ this.jobStartTime = jobStartTime;
+ }
+
+ public int getTotalPhysicalmemory() {
+ return totalPhysicalmemory;
+ }
+
+ public void setTotalPhysicalmemory(int totalPhysicalmemory) {
+ this.totalPhysicalmemory = totalPhysicalmemory;
+ }
+
+ public String getProjectName() {
+ return projectName;
+ }
+
+ public void setProjectName(String projectName) {
+ this.projectName = projectName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Configuration.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Configuration.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Configuration.java
new file mode 100644
index 0000000..f3c72be
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Configuration.java
@@ -0,0 +1,80 @@
+/*
+*
+* 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+@DataCache
+@Entity
+@Table(name ="CONFIGURATION")
+@IdClass(Configuration_PK.class)
+public class Configuration implements Serializable {
+ @Id
+ @Column(name = "CONFIG_KEY")
+ private String config_key;
+
+ @Id
+ @Column(name = "CONFIG_VAL")
+ private String config_val;
+
+ @Id
+ @Column(name = "CATEGORY_ID")
+ private String category_id;
+
+ @Column(name = "EXPIRE_DATE")
+ private Timestamp expire_date;
+
+ public String getConfig_key() {
+ return config_key;
+ }
+
+ public String getConfig_val() {
+ return config_val;
+ }
+
+ public Timestamp getExpire_date() {
+ return expire_date;
+ }
+
+ public void setConfig_key(String config_key) {
+ this.config_key = config_key;
+ }
+
+ public void setConfig_val(String config_val) {
+ this.config_val = config_val;
+ }
+
+ public void setExpire_date(Timestamp expire_date) {
+ this.expire_date = expire_date;
+ }
+
+ public String getCategory_id() {
+ return category_id;
+ }
+
+ public void setCategory_id(String category_id) {
+ this.category_id = category_id;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Configuration_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Configuration_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Configuration_PK.java
new file mode 100644
index 0000000..2f950dd
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Configuration_PK.java
@@ -0,0 +1,74 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import java.io.Serializable;
+
+public class Configuration_PK implements Serializable {
+ private String config_key;
+ private String config_val;
+ private String category_id;
+
+ public Configuration_PK(String config_key, String config_val, String category_id) {
+ this.config_key = config_key;
+ this.config_val = config_val;
+ this.category_id = category_id;
+ }
+
+ public Configuration_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getConfig_key() {
+ return config_key;
+ }
+
+ public void setConfig_key(String config_key) {
+ this.config_key = config_key;
+ }
+
+ public void setConfig_val(String config_val) {
+ this.config_val = config_val;
+ }
+
+ public String getConfig_val() {
+ return config_val;
+ }
+
+ public String getCategory_id() {
+ return category_id;
+ }
+
+ public void setCategory_id(String category_id) {
+ this.category_id = category_id;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/DataTransferDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/DataTransferDetail.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/DataTransferDetail.java
new file mode 100644
index 0000000..ad41126
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/DataTransferDetail.java
@@ -0,0 +1,91 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+@DataCache
+@Entity
+@Table(name = "DATA_TRANSFER_DETAIL")
+public class DataTransferDetail implements Serializable {
+ @Id
+ @Column(name = "TRANSFER_ID")
+ private String transferId;
+ @Column(name = "TASK_ID")
+ private String taskId;
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+ @Lob
+ @Column(name = "TRANSFER_DESC")
+ private char[] transferDesc;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "TASK_ID")
+ private TaskDetail task;
+
+ @OneToOne (fetch = FetchType.LAZY, mappedBy = "transferDetail")
+ private Status dataTransferStatus;
+
+ public String getTransferId() {
+ return transferId;
+ }
+
+ public void setTransferId(String transferId) {
+ this.transferId = transferId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public char[] getTransferDesc() {
+ return transferDesc;
+ }
+
+ public void setTransferDesc(char[] transferDesc) {
+ this.transferDesc = transferDesc;
+ }
+
+ public Status getDataTransferStatus() {
+ return dataTransferStatus;
+ }
+
+ public void setDataTransferStatus(Status dataTransferStatus) {
+ this.dataTransferStatus = dataTransferStatus;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ErrorDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ErrorDetail.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ErrorDetail.java
new file mode 100644
index 0000000..46af8a5
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ErrorDetail.java
@@ -0,0 +1,176 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+@DataCache
+@Entity
+@Table(name = "ERROR_DETAIL")
+public class ErrorDetail implements Serializable {
+ @Id
+ @GeneratedValue
+ @Column(name = "ERROR_ID")
+ private int errorID;
+ @Column(name = "EXPERIMENT_ID")
+ private String expId;
+ @Column(name = "TASK_ID")
+ private String taskId;
+ @Column(name = "NODE_INSTANCE_ID")
+ private String nodeId;
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+ @Lob
+ @Column(name = "ACTUAL_ERROR_MESSAGE")
+ private char[] actualErrorMsg;
+
+ @Column(name = "USER_FRIEDNLY_ERROR_MSG")
+ private String userFriendlyErrorMsg;
+ @Column(name = "TRANSIENT_OR_PERSISTENT")
+ private boolean transientPersistent;
+ @Column(name = "ERROR_CATEGORY")
+ private String errorCategory;
+ @Column(name = "CORRECTIVE_ACTION")
+ private String correctiveAction;
+ @Column(name = "ACTIONABLE_GROUP")
+ private String actionableGroup;
+ @Column(name = "JOB_ID")
+ private String jobId;
+
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
+ @JoinColumn(name = "EXPERIMENT_ID")
+ private Experiment experiment;
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
+ @JoinColumn(name = "TASK_ID")
+ private TaskDetail task;
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
+ @JoinColumn(name = "NODE_INSTANCE_ID")
+ private WorkflowNodeDetail nodeDetail;
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
+ @JoinColumn(name = "JOB_ID")
+ private JobDetail jobDetail;
+
+ public int getErrorID() {
+ return errorID;
+ }
+
+ public void setErrorID(int errorID) {
+ this.errorID = errorID;
+ }
+
+ public String getExpId() {
+ return expId;
+ }
+
+ public void setExpId(String expId) {
+ this.expId = expId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public char[] getActualErrorMsg() {
+ return actualErrorMsg;
+ }
+
+ public void setActualErrorMsg(char[] actualErrorMsg) {
+ this.actualErrorMsg = actualErrorMsg;
+ }
+
+ public String getUserFriendlyErrorMsg() {
+ return userFriendlyErrorMsg;
+ }
+
+ public void setUserFriendlyErrorMsg(String userFriendlyErrorMsg) {
+ this.userFriendlyErrorMsg = userFriendlyErrorMsg;
+ }
+
+ public boolean isTransientPersistent() {
+ return transientPersistent;
+ }
+
+ public void setTransientPersistent(boolean transientPersistent) {
+ this.transientPersistent = transientPersistent;
+ }
+
+ public String getErrorCategory() {
+ return errorCategory;
+ }
+
+ public void setErrorCategory(String errorCategory) {
+ this.errorCategory = errorCategory;
+ }
+
+ public String getActionableGroup() {
+ return actionableGroup;
+ }
+
+ public void setActionableGroup(String actionableGroup) {
+ this.actionableGroup = actionableGroup;
+ }
+
+ public String getCorrectiveAction() {
+ return correctiveAction;
+ }
+
+ public void setCorrectiveAction(String correctiveAction) {
+ this.correctiveAction = correctiveAction;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment.java
new file mode 100644
index 0000000..6a7b13a
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment.java
@@ -0,0 +1,299 @@
+/*
+*
+* 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.List;
+
+@Entity
+@Table(name = "EXPERIMENT")
+@DataCache
+public class Experiment implements Serializable {
+ @Id
+ @Column(name = "EXPERIMENT_ID")
+ private String expId;
+ @Column(name = "GATEWAY_ID")
+ private String gatewayId;
+ @Column(name = "EXECUTION_USER")
+ private String executionUser;
+ @Column(name = "PROJECT_ID")
+ private String projectID;
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+ @Column(name = "EXPERIMENT_NAME")
+ private String expName;
+ @Column(name = "EXPERIMENT_DESCRIPTION")
+ private String expDesc;
+ @Column(name = "APPLICATION_ID")
+ private String applicationId;
+ @Column(name = "APPLICATION_VERSION")
+ private String appVersion;
+ @Column(name = "WORKFLOW_TEMPLATE_ID")
+ private String workflowTemplateId;
+ @Column(name = "WORKFLOW_TEMPLATE_VERSION")
+ private String workflowTemplateVersion;
+ @Column(name = "WORKFLOW_EXECUTION_ID")
+ private String workflowExecutionId;
+ @Column(name = "ALLOW_NOTIFICATION")
+ private boolean allowNotification;
+ @Column(name = "GATEWAY_EXECUTION_ID")
+ private String gatewayExecutionId;
+
+ @ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.MERGE)
+ @JoinColumn(name = "GATEWAY_ID")
+ private Gateway gateway;
+
+ @ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.MERGE)
+ @JoinColumn(name = "PROJECT_ID")
+ private Project project;
+
+ @ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.MERGE)
+ @JoinColumn(name = "EXECUTION_USER", referencedColumnName = "USER_NAME")
+ private Users user;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
+ private List<Experiment_Output> experimentOutputs;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
+ private List<Experiment_Input> experimentInputs;
+
+ @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
+ private Computational_Resource_Scheduling resourceScheduling;
+
+ @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
+ private ExperimentConfigData userConfigurationData;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
+ private List<WorkflowNodeDetail> workflowNodeDetails;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
+ private List<Status> stateChangeList;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
+ private List<ErrorDetail> errorDetails;
+
+ @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
+ private Status experimentStatus;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
+ private List<Notification_Email> notificationEmails;
+
+ @OneToMany(fetch=FetchType.LAZY, mappedBy = "experiment")
+ private Collection<Status> statuses;
+
+ public String getExpId() {
+ return expId;
+ }
+
+ public void setExpId(String expId) {
+ this.expId = expId;
+ }
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ public String getExecutionUser() {
+ return executionUser;
+ }
+
+ public void setExecutionUser(String executionUser) {
+ this.executionUser = executionUser;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getExpName() {
+ return expName;
+ }
+
+ public void setExpName(String expName) {
+ this.expName = expName;
+ }
+
+ public String getExpDesc() {
+ return expDesc;
+ }
+
+ public void setExpDesc(String expDesc) {
+ this.expDesc = expDesc;
+ }
+
+ public String getApplicationId() {
+ return applicationId;
+ }
+
+ public void setApplicationId(String applicationId) {
+ this.applicationId = applicationId;
+ }
+
+ public String getAppVersion() {
+ return appVersion;
+ }
+
+ public void setAppVersion(String appVersion) {
+ this.appVersion = appVersion;
+ }
+
+ public String getWorkflowTemplateId() {
+ return workflowTemplateId;
+ }
+
+ public void setWorkflowTemplateId(String workflowTemplateId) {
+ this.workflowTemplateId = workflowTemplateId;
+ }
+
+ public String getWorkflowTemplateVersion() {
+ return workflowTemplateVersion;
+ }
+
+ public void setWorkflowTemplateVersion(String workflowTemplateVersion) {
+ this.workflowTemplateVersion = workflowTemplateVersion;
+ }
+
+ public String getWorkflowExecutionId() {
+ return workflowExecutionId;
+ }
+
+ public void setWorkflowExecutionId(String workflowExecutionId) {
+ this.workflowExecutionId = workflowExecutionId;
+ }
+
+ public boolean isAllowNotification() {
+ return allowNotification;
+ }
+
+ public void setAllowNotification(boolean allowNotification) {
+ this.allowNotification = allowNotification;
+ }
+
+ public String getGatewayExecutionId() {
+ return gatewayExecutionId;
+ }
+
+ public String getProjectID() {
+ return projectID;
+ }
+
+ public void setProjectID(String projectID) {
+ this.projectID = projectID;
+ }
+
+ public List<Experiment_Output> getExperimentOutputs() {
+ return experimentOutputs;
+ }
+
+ public void setExperimentOutputs(List<Experiment_Output> experimentOutputs) {
+ this.experimentOutputs = experimentOutputs;
+ }
+
+ public List<Experiment_Input> getExperimentInputs() {
+ return experimentInputs;
+ }
+
+ public void setExperimentInputs(List<Experiment_Input> experimentInputs) {
+ this.experimentInputs = experimentInputs;
+ }
+
+ public Computational_Resource_Scheduling getResourceScheduling() {
+ return resourceScheduling;
+ }
+
+ public void setResourceScheduling(Computational_Resource_Scheduling resourceScheduling) {
+ this.resourceScheduling = resourceScheduling;
+ }
+
+ public List<ErrorDetail> getErrorDetails() {
+ return errorDetails;
+ }
+
+ public ExperimentConfigData getUserConfigurationData() {
+ return userConfigurationData;
+ }
+
+ public void setUserConfigurationData(ExperimentConfigData userConfigurationData) {
+ this.userConfigurationData = userConfigurationData;
+ }
+
+ public List<WorkflowNodeDetail> getWorkflowNodeDetails() {
+ return workflowNodeDetails;
+ }
+
+ public void setWorkflowNodeDetails(List<WorkflowNodeDetail> workflowNodeDetails) {
+ this.workflowNodeDetails = workflowNodeDetails;
+ }
+
+ public List<Status> getStateChangeList() {
+ return stateChangeList;
+ }
+
+ public void setStateChangeList(List<Status> stateChangeList) {
+ this.stateChangeList = stateChangeList;
+ }
+
+ public void setErrorDetails(List<ErrorDetail> errorDetails) {
+ this.errorDetails = errorDetails;
+ }
+
+ public Status getExperimentStatus() {
+ return experimentStatus;
+ }
+
+ public void setExperimentStatus(Status experimentStatus) {
+ this.experimentStatus = experimentStatus;
+ }
+
+ public List<Notification_Email> getNotificationEmails() {
+ return notificationEmails;
+ }
+
+ public void setNotificationEmails(List<Notification_Email> notificationEmails) {
+ this.notificationEmails = notificationEmails;
+ }
+
+ public void setGatewayExecutionId(String gatewayExecutionId) {
+ this.gatewayExecutionId = gatewayExecutionId;
+ }
+
+ public Collection<Status> getStatuses() {
+ return statuses;
+ }
+
+ public void setStatuses(Collection<Status> statuses) {
+ this.statuses = statuses;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ExperimentConfigData.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ExperimentConfigData.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ExperimentConfigData.java
new file mode 100644
index 0000000..4510996
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ExperimentConfigData.java
@@ -0,0 +1,142 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name = "CONFIG_DATA")
+public class ExperimentConfigData implements Serializable {
+ @Id
+ @Column(name = "EXPERIMENT_ID")
+ private String expId;
+ @Column(name = "AIRAVATA_AUTO_SCHEDULE")
+ private boolean airavataAutoSchedule;
+ @Column(name = "OVERRIDE_MANUAL_SCHEDULE_PARAMS")
+ private boolean overrideManualParams;
+ @Column(name = "SHARE_EXPERIMENT")
+ private boolean shareExp;
+ @Column(name = "USER_DN")
+ private String userDn;
+ @Column(name = "GENERATE_CERT")
+ private boolean generateCert;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "EXPERIMENT_ID")
+ private Experiment experiment;
+
+ @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
+ private Computational_Resource_Scheduling resourceScheduling;
+
+ @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
+ private AdvancedInputDataHandling inputDataHandling;
+
+ @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
+ private AdvancedOutputDataHandling outputDataHandling;
+
+ @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
+ private QosParam qosParam;
+
+ public String getExpId() {
+ return expId;
+ }
+
+ public void setExpId(String expId) {
+ this.expId = expId;
+ }
+
+ public boolean isAiravataAutoSchedule() {
+ return airavataAutoSchedule;
+ }
+
+ public void setAiravataAutoSchedule(boolean airavataAutoSchedule) {
+ this.airavataAutoSchedule = airavataAutoSchedule;
+ }
+
+ public boolean isOverrideManualParams() {
+ return overrideManualParams;
+ }
+
+ public void setOverrideManualParams(boolean overrideManualParams) {
+ this.overrideManualParams = overrideManualParams;
+ }
+
+ public boolean isShareExp() {
+ return shareExp;
+ }
+
+ public void setShareExp(boolean shareExp) {
+ this.shareExp = shareExp;
+ }
+
+ public String getUserDn() {
+ return userDn;
+ }
+
+ public void setUserDn(String userDn) {
+ this.userDn = userDn;
+ }
+
+ public boolean isGenerateCert() {
+ return generateCert;
+ }
+
+ public void setGenerateCert(boolean generateCert) {
+ this.generateCert = generateCert;
+ }
+
+ public AdvancedInputDataHandling getInputDataHandling() {
+ return inputDataHandling;
+ }
+
+ public void setInputDataHandling(AdvancedInputDataHandling inputDataHandling) {
+ this.inputDataHandling = inputDataHandling;
+ }
+
+ public AdvancedOutputDataHandling getOutputDataHandling() {
+ return outputDataHandling;
+ }
+
+ public void setOutputDataHandling(AdvancedOutputDataHandling outputDataHandling) {
+ this.outputDataHandling = outputDataHandling;
+ }
+
+ public QosParam getQosParam() {
+ return qosParam;
+ }
+
+ public void setQosParam(QosParam qosParam) {
+ this.qosParam = qosParam;
+ }
+
+ public Computational_Resource_Scheduling getResourceScheduling() {
+ return resourceScheduling;
+ }
+
+ public void setResourceScheduling(Computational_Resource_Scheduling resourceScheduling) {
+ this.resourceScheduling = resourceScheduling;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Input.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Input.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Input.java
new file mode 100644
index 0000000..c074889
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Input.java
@@ -0,0 +1,170 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name ="EXPERIMENT_INPUT")
+@IdClass(Experiment_Input_PK.class)
+public class Experiment_Input implements Serializable {
+ @Id
+ @Column(name = "EXPERIMENT_ID")
+ private String experiment_id;
+
+ @Id
+ @Column(name = "INPUT_KEY")
+ private String ex_key;
+
+ @Lob
+ @Column(name = "VALUE")
+ private char[] value;
+
+ @Column(name = "DATA_TYPE")
+ private String dataType;
+
+ @Column(name = "APP_ARGUMENT")
+ private String appArgument;
+
+ @Column(name = "STANDARD_INPUT")
+ private boolean standardInput;
+
+ @Column(name = "USER_FRIENDLY_DESC")
+ private String userFriendlyDesc;
+
+ @Column(name = "METADATA")
+ private String metadata;
+
+ @Column(name = "INPUT_ORDER")
+ private int inputOrder;
+
+ @Column(name="IS_REQUIRED")
+ private boolean isRequired;
+ @Column(name="REQUIRED_TO_COMMANDLINE")
+ private boolean requiredToCMD;
+ @Column(name = "DATA_STAGED")
+ private boolean dataStaged;
+
+ @ManyToOne
+ @JoinColumn(name = "EXPERIMENT_ID")
+ private Experiment experiment;
+
+ public int getInputOrder() {
+ return inputOrder;
+ }
+
+ public void setInputOrder(int inputOrder) {
+ this.inputOrder = inputOrder;
+ }
+
+ public String getExperiment_id() {
+ return experiment_id;
+ }
+
+ public void setExperiment_id(String experiment_id) {
+ this.experiment_id = experiment_id;
+ }
+
+ public String getEx_key() {
+ return ex_key;
+ }
+
+ public void setEx_key(String ex_key) {
+ this.ex_key = ex_key;
+ }
+
+ public char[] getValue() {
+ return value;
+ }
+
+ public void setValue(char[] value) {
+ this.value = value;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(String metadata) {
+ this.metadata = metadata;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+
+ public boolean isStandardInput() {
+ return standardInput;
+ }
+
+ public void setStandardInput(boolean standardInput) {
+ this.standardInput = standardInput;
+ }
+
+ public String getUserFriendlyDesc() {
+ return userFriendlyDesc;
+ }
+
+ public void setUserFriendlyDesc(String userFriendlyDesc) {
+ this.userFriendlyDesc = userFriendlyDesc;
+ }
+
+ public boolean isRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean isRequired) {
+ this.isRequired = isRequired;
+ }
+
+ public boolean isRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean isDataStaged() {
+ return dataStaged;
+ }
+
+ public void setDataStaged(boolean dataStaged) {
+ this.dataStaged = dataStaged;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Input_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Input_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Input_PK.java
new file mode 100644
index 0000000..4a9886f
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Input_PK.java
@@ -0,0 +1,64 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import java.io.Serializable;
+
+public class Experiment_Input_PK implements Serializable {
+ private String experiment_id;
+ private String ex_key;
+
+ public Experiment_Input_PK(String experiment_id, String ex_key) {
+ this.experiment_id = experiment_id;
+ this.ex_key = ex_key;
+ }
+
+ public Experiment_Input_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getExperiment_id() {
+ return experiment_id;
+ }
+
+ public void setExperiment_id(String experiment_id) {
+ this.experiment_id = experiment_id;
+ }
+
+ public String getEx_key() {
+ return ex_key;
+ }
+
+ public void setEx_key(String ex_key) {
+ this.ex_key = ex_key;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Output.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Output.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Output.java
new file mode 100644
index 0000000..d9d728f
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Output.java
@@ -0,0 +1,143 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name ="EXPERIMENT_OUTPUT")
+@IdClass(Experiment_Output_PK.class)
+public class Experiment_Output implements Serializable {
+ @Id
+ @Column(name = "EXPERIMENT_ID")
+ private String experiment_id;
+
+ @Id
+ @Column(name = "OUTPUT_KEY")
+ private String ex_key;
+ @Lob
+ @Column(name = "VALUE")
+ private char[] value;
+ @Column(name = "DATA_TYPE")
+ private String dataType;
+
+ @Column(name = "IS_REQUIRED")
+ private boolean isRequired;
+ @Column(name="REQUIRED_TO_COMMANDLINE")
+ private boolean requiredToCMD;
+ @Column(name = "DATA_MOVEMENT")
+ private boolean dataMovement;
+ @Column(name = "DATA_NAME_LOCATION")
+ private String dataNameLocation;
+ @Column(name = "SEARCH_QUERY")
+ private String searchQuery;
+ @Column(name = "APP_ARGUMENT")
+ private String applicationArgument;
+
+ @ManyToOne
+ @JoinColumn(name = "EXPERIMENT_ID")
+ private Experiment experiment;
+
+ public String getExperiment_id() {
+ return experiment_id;
+ }
+
+ public void setExperiment_id(String experiment_id) {
+ this.experiment_id = experiment_id;
+ }
+
+ public String getEx_key() {
+ return ex_key;
+ }
+
+ public void setEx_key(String ex_key) {
+ this.ex_key = ex_key;
+ }
+
+ public char[] getValue() {
+ return value;
+ }
+
+ public void setValue(char[] value) {
+ this.value = value;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public boolean isRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean isRequired) {
+ this.isRequired = isRequired;
+ }
+
+ public boolean isRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean isDataMovement() {
+ return dataMovement;
+ }
+
+ public void setDataMovement(boolean dataMovement) {
+ this.dataMovement = dataMovement;
+ }
+
+ public String getDataNameLocation() {
+ return dataNameLocation;
+ }
+
+ public void setDataNameLocation(String dataNameLocation) {
+ this.dataNameLocation = dataNameLocation;
+ }
+
+ public String getSearchQuery() {
+ return searchQuery;
+ }
+
+ public void setSearchQuery(String searchQuery) {
+ this.searchQuery = searchQuery;
+ }
+
+ public String getApplicationArgument() {
+ return applicationArgument;
+ }
+
+ public void setApplicationArgument(String applicationArgument) {
+ this.applicationArgument = applicationArgument;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Output_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Output_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Output_PK.java
new file mode 100644
index 0000000..822021a
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Experiment_Output_PK.java
@@ -0,0 +1,64 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import java.io.Serializable;
+
+public class Experiment_Output_PK implements Serializable {
+ private String experiment_id;
+ private String ex_key;
+
+ public Experiment_Output_PK(String experiment_id, String ex_key) {
+ this.experiment_id = experiment_id;
+ this.ex_key = ex_key;
+ }
+
+ public Experiment_Output_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getExperiment_id() {
+ return experiment_id;
+ }
+
+ public void setExperiment_id(String experiment_id) {
+ this.experiment_id = experiment_id;
+ }
+
+ public String getEx_key() {
+ return ex_key;
+ }
+
+ public void setEx_key(String ex_key) {
+ this.ex_key = ex_key;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway.java
new file mode 100644
index 0000000..f3e693c
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway.java
@@ -0,0 +1,76 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name ="GATEWAY")
+public class Gateway implements Serializable {
+ @Id
+ @Column(name = "GATEWAY_ID")
+ private String gateway_id;
+ @Column(name = "GATEWAY_NAME")
+ private String gateway_name;
+ @Column(name = "DOMAIN")
+ private String domain;
+ @Column(name = "EMAIL_ADDRESS")
+ private String emailAddress;
+
+ public String getGateway_name() {
+ return gateway_name;
+ }
+
+ public void setGateway_name(String gateway_name) {
+ this.gateway_name = gateway_name;
+ }
+
+ public String getDomain() {
+ return domain;
+ }
+
+ public void setDomain(String domain) {
+ this.domain = domain;
+ }
+
+ public String getGateway_id() {
+ return gateway_id;
+ }
+
+ public void setGateway_id(String gateway_id) {
+ this.gateway_id = gateway_id;
+ }
+
+ public String getEmailAddress() {
+ return emailAddress;
+ }
+
+ public void setEmailAddress(String emailAddress) {
+ this.emailAddress = emailAddress;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway_Worker.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway_Worker.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway_Worker.java
new file mode 100644
index 0000000..d4ef9b9
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway_Worker.java
@@ -0,0 +1,82 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name ="GATEWAY_WORKER")
+@IdClass(Gateway_Worker_PK.class)
+public class Gateway_Worker implements Serializable {
+ @Id
+ @Column(name = "GATEWAY_ID")
+ private String gateway_id;
+
+ @Id
+ @Column(name = "USER_NAME")
+ private String user_name;
+
+ @ManyToOne(cascade=CascadeType.MERGE)
+ @JoinColumn(name = "GATEWAY_ID")
+ private Gateway gateway;
+
+
+ @ManyToOne(cascade=CascadeType.MERGE)
+ @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 void setGateway(Gateway gateway) {
+ this.gateway = gateway;
+ }
+
+ public Gateway getGateway() {
+ return gateway;
+ }
+
+ public Users getUser() {
+ return user;
+ }
+
+ public void setUser(Users user) {
+ this.user = user;
+ }
+
+ public String getGateway_id() {
+ return gateway_id;
+ }
+
+ public void setGateway_id(String gateway_id) {
+ this.gateway_id = gateway_id;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway_Worker_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway_Worker_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway_Worker_PK.java
new file mode 100644
index 0000000..49ca862
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Gateway_Worker_PK.java
@@ -0,0 +1,64 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import java.io.Serializable;
+
+public class Gateway_Worker_PK implements Serializable {
+ private String gateway_id;
+ private String user_name;
+
+ public Gateway_Worker_PK(String gateway_id, String user_name) {
+ this.gateway_id = gateway_id;
+ this.user_name = user_name;
+ }
+
+ public Gateway_Worker_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getUser_name() {
+ return user_name;
+ }
+
+ public void setUser_name(String user_name) {
+ this.user_name = user_name;
+ }
+
+ public String getGateway_id() {
+ return gateway_id;
+ }
+
+ public void setGateway_id(String gateway_id) {
+ this.gateway_id = gateway_id;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/JobDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/JobDetail.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/JobDetail.java
new file mode 100644
index 0000000..7142313
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/JobDetail.java
@@ -0,0 +1,135 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.util.List;
+
+@DataCache
+@Entity
+@Table(name = "JOB_DETAIL")
+@IdClass(JobDetails_PK.class)
+public class JobDetail implements Serializable {
+ @Id
+ @Column(name = "JOB_ID")
+ private String jobId;
+ @Id
+ @Column(name = "TASK_ID")
+ private String taskId;
+ @Column(name = "JOB_DESCRIPTION")
+ @Lob
+ private char[] jobDescription;
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+ @Column(name = "COMPUTE_RESOURCE_CONSUMED")
+ private String computeResourceConsumed;
+ @Column(name = "JOBNAME")
+ private String jobName;
+ @Column(name = "WORKING_DIR")
+ private String workingDir;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "TASK_ID")
+ private TaskDetail task;
+
+ @OneToOne (fetch = FetchType.LAZY, mappedBy = "jobDetail")
+ private Status jobStatus;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "jobDetail")
+ private List<ErrorDetail> errorDetails;
+
+ public List<ErrorDetail> getErrorDetails() {
+ return errorDetails;
+ }
+
+ public void setErrorDetails(List<ErrorDetail> errorDetails) {
+ this.errorDetails = errorDetails;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public char[] getJobDescription() {
+ return jobDescription;
+ }
+
+ public void setJobDescription(char[] jobDescription) {
+ this.jobDescription = jobDescription;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getComputeResourceConsumed() {
+ return computeResourceConsumed;
+ }
+
+ public void setComputeResourceConsumed(String computeResourceConsumed) {
+ this.computeResourceConsumed = computeResourceConsumed;
+ }
+
+ public String getJobName() {
+ return jobName;
+ }
+
+ public void setJobName(String jobName) {
+ this.jobName = jobName;
+ }
+
+ public String getWorkingDir() {
+ return workingDir;
+ }
+
+ public void setWorkingDir(String workingDir) {
+ this.workingDir = workingDir;
+ }
+
+ public Status getJobStatus() {
+ return jobStatus;
+ }
+
+ public void setJobStatus(Status jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/JobDetails_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/JobDetails_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/JobDetails_PK.java
new file mode 100644
index 0000000..a68a1a0
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/JobDetails_PK.java
@@ -0,0 +1,64 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import java.io.Serializable;
+
+public class JobDetails_PK implements Serializable {
+ private String jobId;
+ private String taskId;
+
+ public JobDetails_PK(String jobId, String taskId) {
+ this.jobId = jobId;
+ this.taskId = taskId;
+ }
+
+ public JobDetails_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeInput.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeInput.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeInput.java
new file mode 100644
index 0000000..1109774
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeInput.java
@@ -0,0 +1,163 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name = "NODE_INPUT")
+@IdClass(NodeInput_PK.class)
+public class NodeInput implements Serializable {
+ @Id
+ @Column(name = "NODE_INSTANCE_ID")
+ private String nodeId;
+ @Id
+ @Column(name = "INPUT_KEY")
+ private String inputKey;
+ @Column(name = "DATA_TYPE")
+ private String dataType;
+ @Column(name = "METADATA")
+ private String metadata;
+ @Column(name = "VALUE")
+ private String value;
+ @Column(name = "APP_ARGUMENT")
+ private String appArgument;
+ @Column(name = "INPUT_ORDER")
+ private int inputOrder;
+
+ @Column(name = "STANDARD_INPUT")
+ private boolean standardInput;
+
+ @Column(name = "USER_FRIENDLY_DESC")
+ private String userFriendlyDesc;
+
+ @Column(name="IS_REQUIRED")
+ private boolean isRequired;
+ @Column(name="REQUIRED_TO_COMMANDLINE")
+ private boolean requiredToCMD;
+ @Column(name = "DATA_STAGED")
+ private boolean dataStaged;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "NODE_INSTANCE_ID")
+ private WorkflowNodeDetail nodeDetail;
+
+ public String getInputKey() {
+ return inputKey;
+ }
+
+ public void setInputKey(String inputKey) {
+ this.inputKey = inputKey;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(String metadata) {
+ this.metadata = metadata;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+
+ public boolean isStandardInput() {
+ return standardInput;
+ }
+
+ public void setStandardInput(boolean standardInput) {
+ this.standardInput = standardInput;
+ }
+
+ public String getUserFriendlyDesc() {
+ return userFriendlyDesc;
+ }
+
+ public void setUserFriendlyDesc(String userFriendlyDesc) {
+ this.userFriendlyDesc = userFriendlyDesc;
+ }
+
+ public int getInputOrder() {
+ return inputOrder;
+ }
+
+ public void setInputOrder(int inputOrder) {
+ this.inputOrder = inputOrder;
+ }
+
+ public boolean getIsRequired() {
+ return isRequired;
+ }
+
+ public void setIsRequired(boolean isRequired) {
+ this.isRequired = isRequired;
+ }
+
+ public boolean getRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean isDataStaged() {
+ return dataStaged;
+ }
+
+ public void setDataStaged(boolean dataStaged) {
+ this.dataStaged = dataStaged;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeInput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeInput_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeInput_PK.java
new file mode 100644
index 0000000..3aeb980
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeInput_PK.java
@@ -0,0 +1,64 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import java.io.Serializable;
+
+public class NodeInput_PK implements Serializable {
+ private String nodeId;
+ private String inputKey;
+
+ public NodeInput_PK(String nodeId, String inputKey) {
+ this.nodeId = nodeId;
+ this.inputKey = inputKey;
+ }
+
+ public NodeInput_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public String getInputKey() {
+ return inputKey;
+ }
+
+ public void setInputKey(String inputKey) {
+ this.inputKey = inputKey;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeOutput.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeOutput.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeOutput.java
new file mode 100644
index 0000000..9831805
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeOutput.java
@@ -0,0 +1,140 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name = "NODE_OUTPUT")
+@IdClass(NodeOutput_PK.class)
+public class NodeOutput implements Serializable {
+ @Id
+ @Column(name = "NODE_INSTANCE_ID")
+ private String nodeId;
+ @Id
+ @Column(name = "OUTPUT_KEY")
+ private String outputKey;
+ @Column(name = "DATA_TYPE")
+ private String dataType;
+ @Column(name = "VALUE")
+ private String value;
+ @Column(name = "IS_REQUIRED")
+ private boolean isRequired;
+ @Column(name="REQUIRED_TO_COMMANDLINE")
+ private boolean requiredToCMD;
+ @Column(name = "DATA_MOVEMENT")
+ private boolean dataMovement;
+ @Column(name = "DATA_NAME_LOCATION")
+ private String dataNameLocation;
+ @Column(name = "SEARCH_QUERY")
+ private String searchQuery;
+ @Column(name = "APP_ARGUMENT")
+ private String applicationArgument;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "NODE_INSTANCE_ID")
+ private WorkflowNodeDetail nodeDetail;
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getOutputKey() {
+ return outputKey;
+ }
+
+ public void setOutputKey(String outputKey) {
+ this.outputKey = outputKey;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public boolean isRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean isRequired) {
+ this.isRequired = isRequired;
+ }
+
+ public boolean isRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean isDataMovement() {
+ return dataMovement;
+ }
+
+ public void setDataMovement(boolean dataMovement) {
+ this.dataMovement = dataMovement;
+ }
+
+ public String getDataNameLocation() {
+ return dataNameLocation;
+ }
+
+ public void setDataNameLocation(String dataNameLocation) {
+ this.dataNameLocation = dataNameLocation;
+ }
+
+ public String getSearchQuery() {
+ return searchQuery;
+ }
+
+ public void setSearchQuery(String searchQuery) {
+ this.searchQuery = searchQuery;
+ }
+
+ public String getApplicationArgument() {
+ return applicationArgument;
+ }
+
+ public void setApplicationArgument(String applicationArgument) {
+ this.applicationArgument = applicationArgument;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeOutput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeOutput_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeOutput_PK.java
new file mode 100644
index 0000000..fcbd4cf
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/NodeOutput_PK.java
@@ -0,0 +1,64 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import java.io.Serializable;
+
+public class NodeOutput_PK implements Serializable {
+ private String nodeId;
+ private String outputKey;
+
+ public NodeOutput_PK(String nodeId, String outputKey) {
+ this.nodeId = nodeId;
+ this.outputKey = outputKey;
+ }
+
+ public NodeOutput_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public String getOutputKey() {
+ return outputKey;
+ }
+
+ public void setOutputKey(String outputKey) {
+ this.outputKey = outputKey;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Notification_Email.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Notification_Email.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Notification_Email.java
new file mode 100644
index 0000000..8c8606e
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Notification_Email.java
@@ -0,0 +1,81 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name ="NOTIFICATION_EMAIL")
+public class Notification_Email implements Serializable {
+ @Id
+ @GeneratedValue
+ private int emailId;
+ @Column(name = "EXPERIMENT_ID")
+ private String experiment_id;
+ @Column(name = "TASK_ID")
+ private String taskId;
+ @Column(name = "EMAIL_ADDRESS")
+ private String emailAddress;
+
+ @ManyToOne
+ @JoinColumn(name = "EXPERIMENT_ID")
+ private Experiment experiment;
+ @ManyToOne
+ @JoinColumn(name = "TASK_ID")
+ private TaskDetail task;
+
+ public String getExperiment_id() {
+ return experiment_id;
+ }
+
+ public void setExperiment_id(String experiment_id) {
+ this.experiment_id = experiment_id;
+ }
+
+ public String getEmailAddress() {
+ return emailAddress;
+ }
+
+ public void setEmailAddress(String emailAddress) {
+ this.emailAddress = emailAddress;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public int getEmailId() {
+ return emailId;
+ }
+
+ public void setEmailId(int emailId) {
+ this.emailId = emailId;
+ }
+}
[04/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/UserResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/UserResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/UserResource.java
new file mode 100644
index 0000000..5fc7f71
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/UserResource.java
@@ -0,0 +1,186 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.SecurityUtil;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.Users;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import java.security.NoSuchAlgorithmException;
+import java.util.List;
+
+public class UserResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(UserResource.class);
+ private String userName;
+ private String password;
+ /**
+ *
+ */
+ public UserResource() {
+ }
+
+ /**
+ *
+ * @param userName user name
+ */
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ /**
+ *
+ * @return user name
+ */
+ public String getUserName() {
+ return userName;
+ }
+
+
+ /**
+ * User is a hypothical data structure.
+ * @param type child resource type
+ * @return child resource
+ */
+ public Resource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for user resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ *
+ * @param type child resource type
+ * @param name child resource name
+ */
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for user resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ *
+ * @param type child resource type
+ * @param name child resource name
+ * @return UnsupportedOperationException
+ */
+ public Resource get(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for user resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ *
+ * @param type child resource type
+ * @return UnsupportedOperationException
+ */
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for user resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * save user to the database
+ */
+ public void save() throws RegistryException {
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ Users existingUser = em.find(Users.class, userName);
+ em.close();
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Users user = new Users();
+ user.setUser_name(userName);
+ if (password != null && !password.equals("")) {
+ try {
+ user.setPassword(SecurityUtil.digestString(password,
+ ServerSettings.getSetting("default.registry.password.hash.method")));
+ } catch (NoSuchAlgorithmException e) {
+ throw new RuntimeException("Error hashing default admin password. Invalid hash algorithm.", e);
+ } catch (ApplicationSettingsException e) {
+ throw new RuntimeException("Error reading hash algorithm from configurations", e);
+ }
+ }
+ if (existingUser != null) {
+ if (password != null && !password.equals("")) {
+ try {
+ existingUser.setPassword(SecurityUtil.digestString(password,
+ ServerSettings.getSetting("default.registry.password.hash.method")));
+ } catch (NoSuchAlgorithmException e) {
+ throw new RuntimeException("Error hashing default admin password. Invalid hash algorithm.", e);
+ } catch (ApplicationSettingsException e) {
+ throw new RuntimeException("Error reading hash algorithm from configurations", e);
+ }
+ }
+ user = em.merge(existingUser);
+ } else {
+ em.persist(user);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ /**
+ *
+ * @param type child resource type
+ * @param name child resource name
+ * @return UnsupportedOperationException
+ */
+ public boolean isExists(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for user resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ *
+ * @return password
+ */
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ *
+ * @param password password
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/Utils.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/Utils.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/Utils.java
new file mode 100644
index 0000000..451fc5c
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/Utils.java
@@ -0,0 +1,1011 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.experiment.catalog.JPAConstants;
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.model.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class Utils {
+ private final static Logger logger = LoggerFactory.getLogger(Utils.class);
+
+ public static String getJDBCFullURL(){
+ String jdbcUrl = getJDBCURL();
+ String jdbcUser = getJDBCUser();
+ String jdbcPassword = getJDBCPassword();
+ jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+ return jdbcUrl;
+ }
+
+ public static String getJDBCURL(){
+ try {
+ return ServerSettings.getSetting(JPAConstants.KEY_JDBC_URL);
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ return null;
+ }
+ }
+
+ public static String getHost(){
+ try{
+ String jdbcURL = getJDBCURL();
+ String cleanURI = jdbcURL.substring(5);
+ URI uri = URI.create(cleanURI);
+ return uri.getHost();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ return null;
+ }
+ }
+
+ public static int getPort(){
+ try{
+ String jdbcURL = getJDBCURL();
+ String cleanURI = jdbcURL.substring(5);
+ URI uri = URI.create(cleanURI);
+ return uri.getPort();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ return -1;
+ }
+ }
+
+ public static int getJPACacheSize (){
+ try {
+ String cache = ServerSettings.getSetting(JPAConstants.JPA_CACHE_SIZE, "5000");
+ return Integer.parseInt(cache);
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ return -1;
+ }
+ }
+
+ public static String isCachingEnabled (){
+ try {
+ return ServerSettings.getSetting(JPAConstants.ENABLE_CACHING, "true");
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ return "true";
+ }
+ }
+
+ public static String getDBType(){
+ try{
+ String jdbcURL = getJDBCURL();
+ String cleanURI = jdbcURL.substring(5);
+ URI uri = URI.create(cleanURI);
+ return uri.getScheme();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ return null;
+ }
+ }
+
+ public static boolean isDerbyStartEnabled(){
+ try {
+ String s = ServerSettings.getSetting(JPAConstants.KEY_DERBY_START_ENABLE);
+ if("true".equals(s)){
+ return true;
+ }
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ return false;
+ }
+ return false;
+ }
+
+ public static String getJDBCUser(){
+ try {
+ return ServerSettings.getSetting(JPAConstants.KEY_JDBC_USER);
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ return null;
+ }
+ }
+
+ public static String getValidationQuery(){
+ try {
+ return ServerSettings.getSetting(JPAConstants.VALIDATION_QUERY);
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ return null;
+ }
+ }
+
+ public static String getJDBCPassword(){
+ try {
+ return ServerSettings.getSetting(JPAConstants.KEY_JDBC_PASSWORD);
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ return null;
+ }
+
+ }
+
+ public static String getJDBCDriver(){
+ try {
+ return ServerSettings.getSetting(JPAConstants.KEY_JDBC_DRIVER);
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ return null;
+ }
+ }
+
+ /**
+ *
+ * @param type model type
+ * @param o model type instance
+ * @return corresponding resource object
+ */
+ public static Resource getResource(ResourceType type, Object o) {
+ switch (type){
+ case GATEWAY:
+ if (o instanceof Gateway) {
+ return createGateway((Gateway) o);
+ } else {
+ logger.error("Object should be a Gateway.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Gateway.");
+ }
+ case PROJECT:
+ if (o instanceof Project){
+ return createProject((Project) o);
+ } else {
+ logger.error("Object should be a Project.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Project.");
+ }
+ case PROJECT_USER:
+ if (o instanceof ProjectUser){
+ return createProjectUser((ProjectUser)o);
+ }else {
+ logger.error("Object should be a ProjectUser.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a ProjectUser.");
+ }
+ case CONFIGURATION:
+ if(o instanceof Configuration){
+ return createConfiguration((Configuration) o);
+ }else {
+ logger.error("Object should be a Configuration.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Configuration.");
+ }
+ case USER:
+ if(o instanceof Users) {
+ return createUser((Users) o);
+ }else {
+ logger.error("Object should be a User.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a User.");
+ }
+ case GATEWAY_WORKER:
+ if (o instanceof Gateway_Worker){
+ return createGatewayWorker((Gateway_Worker)o);
+ } else {
+ logger.error("Object should be a Gateway Worker.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Gateway Worker.");
+ }
+ case EXPERIMENT:
+ if (o instanceof Experiment){
+ return createExperiment((Experiment)o);
+ }else {
+ logger.error("Object should be a Experiment.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Experiment.");
+ }
+ case EXPERIMENT_SUMMARY:
+ if (o instanceof Experiment){
+ return createExperimentSummary((Experiment)o);
+ }else {
+ logger.error("Object should be a ExperimentSummary.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a ExperimentSummary.");
+ }
+ case NOTIFICATION_EMAIL:
+ if (o instanceof Notification_Email){
+ return createNotificationEmail((Notification_Email)o);
+ }else {
+ logger.error("Object should be a Experiment.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Experiment.");
+ }
+ case EXPERIMENT_INPUT:
+ if (o instanceof Experiment_Input){
+ return createExperimentInput((Experiment_Input)o);
+ }else {
+ logger.error("Object should be a Experiment input data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Experiment input data.");
+ }
+ case EXPERIMENT_OUTPUT:
+ if (o instanceof Experiment_Output){
+ return createExperimentOutput((Experiment_Output)o);
+ }else {
+ logger.error("Object should be a Experiment output data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Experiment output data.");
+ }
+ case WORKFLOW_NODE_DETAIL:
+ if (o instanceof WorkflowNodeDetail){
+ return createWorkflowNodeDetail((WorkflowNodeDetail)o);
+ }else {
+ logger.error("Object should be a Workflow node data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a Workflow node data.");
+ }
+ case TASK_DETAIL:
+ if (o instanceof TaskDetail){
+ return createTaskDetail((TaskDetail)o);
+ }else {
+ logger.error("Object should be a task detail data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a task detail data.");
+ }
+ case ERROR_DETAIL:
+ if (o instanceof ErrorDetail){
+ return createErrorDetail((ErrorDetail)o);
+ }else {
+ logger.error("Object should be a error detail data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a error detail data.");
+ }
+ case APPLICATION_INPUT:
+ if (o instanceof ApplicationInput){
+ return createApplicationInput((ApplicationInput)o);
+ }else {
+ logger.error("Object should be a application input data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a application input data.");
+ }
+ case APPLICATION_OUTPUT:
+ if (o instanceof ApplicationOutput){
+ return createApplicationOutput((ApplicationOutput)o);
+ }else {
+ logger.error("Object should be a application output data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a application output data.");
+ }
+ case NODE_INPUT:
+ if (o instanceof NodeInput){
+ return createNodeInput((NodeInput)o);
+ }else {
+ logger.error("Object should be a node input data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a node input data.");
+ }
+ case NODE_OUTPUT:
+ if (o instanceof NodeOutput){
+ return createNodeOutput((NodeOutput)o);
+ }else {
+ logger.error("Object should be a node output data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a node output data.");
+ }
+ case JOB_DETAIL:
+ if (o instanceof JobDetail){
+ return createJobDetail((JobDetail)o);
+ }else {
+ logger.error("Object should be a job detail data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a job detail data.");
+ }
+ case DATA_TRANSFER_DETAIL:
+ if (o instanceof DataTransferDetail){
+ return createDataTransferResource((DataTransferDetail)o);
+ }else {
+ logger.error("Object should be a data transfer detail data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a data transfer detail data.");
+ }
+ case STATUS:
+ if (o instanceof Status){
+ return createStatusResource((Status)o);
+ }else {
+ logger.error("Object should be a status data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a status data.");
+ }
+ case CONFIG_DATA:
+ if (o instanceof ExperimentConfigData){
+ return createExConfigDataResource((ExperimentConfigData)o);
+ }else {
+ logger.error("Object should be a experiment config data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be experiment config data.");
+ }
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ if (o instanceof Computational_Resource_Scheduling){
+ return createComputationalScheduling((Computational_Resource_Scheduling)o);
+ }else {
+ logger.error("Object should be a scheduling resource data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be scheduling resource data.");
+ }
+ case ADVANCE_INPUT_DATA_HANDLING:
+ if (o instanceof AdvancedInputDataHandling){
+ return createAdvancedInputDataResource((AdvancedInputDataHandling)o);
+ }else {
+ logger.error("Object should be a advanced input data handling data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be advanced input data handling data.");
+ }
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ if (o instanceof AdvancedOutputDataHandling){
+ return createAdvancedOutputDataResource((AdvancedOutputDataHandling)o);
+ }else {
+ logger.error("Object should be a advanced output data handling data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be advanced output data handling data.");
+ }
+ case QOS_PARAM:
+ if (o instanceof QosParam){
+ return createQosParamResource((QosParam)o);
+ }else {
+ logger.error("Object should be a QOSparam data.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be QOSparam data.");
+ }
+ default:
+ logger.error("Illegal data type..", new IllegalArgumentException());
+ throw new IllegalArgumentException("Illegal data type..");
+ }
+ }
+
+ /**
+ *
+ * @param o Gateway model object
+ * @return GatewayResource object
+ */
+ private static Resource createGateway(Gateway o) {
+ GatewayResource gatewayResource = new GatewayResource();
+ gatewayResource.setGatewayName(o.getGateway_name());
+ gatewayResource.setGatewayId(o.getGateway_id());
+ gatewayResource.setDomain(o.getDomain());
+ gatewayResource.setEmailAddress(o.getEmailAddress());
+ return gatewayResource;
+ }
+
+ /**
+ *
+ * @param o Project model object
+ * @return ProjectResource object
+ */
+ private static Resource createProject(Project o) {
+ ProjectResource projectResource = new ProjectResource();
+ if (o != null){
+ projectResource.setId(o.getProject_id());
+ projectResource.setName(o.getProject_name());
+ projectResource.setGatewayId(o.getGateway_id());
+ Gateway_Worker gateway_worker = new Gateway_Worker();
+ gateway_worker.setGateway(o.getGateway());
+ gateway_worker.setUser(o.getUsers());
+ gateway_worker.setUser_name(o.getUsers().getUser_name());
+ WorkerResource workerResource = (WorkerResource) createGatewayWorker(gateway_worker);
+ projectResource.setWorker(workerResource);
+ projectResource.setDescription(o.getDescription());
+ projectResource.setCreationTime(o.getCreationTime());
+ }
+
+ return projectResource;
+ }
+
+ private static Resource createProjectUser(ProjectUser o) {
+ ProjectUserResource projectUserResource = new ProjectUserResource();
+ if (o != null){
+ projectUserResource.setUserName(o.getUser().getUser_name());
+ projectUserResource.setProjectId(o.getProjectID());
+ }
+ return projectUserResource;
+ }
+
+ /**
+ *
+ * @param o configuration model object
+ * @return configuration resource object
+ */
+ private static Resource createConfiguration (Configuration o){
+ ConfigurationResource configurationResource = new ConfigurationResource();
+ if (o != null){
+ configurationResource.setConfigKey(o.getConfig_key());
+ configurationResource.setConfigVal(o.getConfig_val());
+ configurationResource.setExpireDate(o.getExpire_date());
+ configurationResource.setCategoryID(o.getCategory_id());
+ }
+
+ return configurationResource;
+ }
+
+ /**
+ *
+ * @param o Gateway_Worker model object
+ * @return Gateway_Worker resource object
+ */
+ private static Resource createGatewayWorker(Gateway_Worker o) {
+ if (o != null){
+ WorkerResource workerResource = new WorkerResource();
+ workerResource.setGatewayId(o.getGateway_id());
+ workerResource.setUser(o.getUser_name());
+ return workerResource;
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param o Users model object
+ * @return UserResource object
+ */
+ private static Resource createUser(Users o) {
+ UserResource userResource = new UserResource();
+ if (o != null){
+ userResource.setUserName(o.getUser_name());
+ userResource.setPassword(o.getPassword());
+ }
+
+ return userResource;
+ }
+
+ /**
+ * @param o Experiment model object
+ * @return Experiment resource object
+ */
+ private static Resource createExperiment(Experiment o) {
+ ExperimentResource experimentResource = new ExperimentResource();
+ if (o != null){
+ experimentResource.setGatewayId(o.getGatewayId());
+ experimentResource.setExecutionUser(o.getExecutionUser());
+ experimentResource.setProjectId(o.getProjectID());
+ experimentResource.setExpID(o.getExpId());
+ experimentResource.setExpName(o.getExpName());
+ experimentResource.setCreationTime(o.getCreationTime());
+ experimentResource.setDescription(o.getExpDesc());
+ experimentResource.setApplicationId(o.getApplicationId());
+ experimentResource.setApplicationVersion(o.getAppVersion());
+ experimentResource.setWorkflowTemplateId(o.getWorkflowTemplateId());
+ experimentResource.setWorkflowTemplateVersion(o.getWorkflowTemplateVersion());
+ experimentResource.setWorkflowExecutionId(o.getWorkflowExecutionId());
+ experimentResource.setEnableEmailNotifications(o.isAllowNotification());
+ experimentResource.setGatewayExecutionId(o.getGatewayExecutionId());
+ if (o.getExperimentInputs() != null && !o.getExperimentInputs().isEmpty()){
+ experimentResource.setExperimentInputResources(getExperimentInputs(o.getExperimentInputs()));
+ }
+ if (o.getExperimentOutputs() != null && !o.getExperimentOutputs().isEmpty()){
+ experimentResource.setExperimentOutputputResources(getExperimentOutputs(o.getExperimentOutputs()));
+ }
+ if (o.getResourceScheduling() != null){
+ experimentResource.setComputationSchedulingResource((ComputationSchedulingResource)createComputationalScheduling(o.getResourceScheduling()));
+ }
+ if (o.getUserConfigurationData() != null){
+ experimentResource.setUserConfigDataResource((ConfigDataResource)createExConfigDataResource(o.getUserConfigurationData()));
+ }
+
+ if (o.getWorkflowNodeDetails() != null && !o.getWorkflowNodeDetails().isEmpty()){
+ experimentResource.setWorkflowNodeDetailResourceList(getWorkflowNodeLit(o.getWorkflowNodeDetails()));
+ }
+
+ if (o.getStateChangeList() != null && !o.getStateChangeList().isEmpty()){
+ experimentResource.setStateChangeList(getStateChangeList(o.getStateChangeList()));
+ }
+
+ if (o.getErrorDetails() != null && !o.getErrorDetails().isEmpty()){
+ experimentResource.setErrorDetailList(getErrorList(o.getErrorDetails()));
+ }
+
+ if (o.getExperimentStatus() != null){
+ experimentResource.setExperimentStatus((StatusResource)createStatusResource(o.getExperimentStatus()));
+ }
+
+ if (o.getNotificationEmails() != null && !o.getNotificationEmails().isEmpty()){
+ experimentResource.setEmailResourceList(getEmailList(o.getNotificationEmails()));
+ }
+ }
+ return experimentResource;
+ }
+
+ /**
+ *
+ * @param o ExperimentSummary model object
+ * @return ExperimentSummary Resource object
+ */
+ private static Resource createExperimentSummary(Experiment o) {
+ ExperimentSummaryResource experimentSummaryResource = new ExperimentSummaryResource();
+ if (o != null){
+ experimentSummaryResource.setExecutionUser(o.getExecutionUser());
+ experimentSummaryResource.setExpID(o.getExpId());
+ experimentSummaryResource.setExpName(o.getExpName());
+ experimentSummaryResource.setProjectID(o.getProjectID());
+ experimentSummaryResource.setCreationTime(o.getCreationTime());
+ experimentSummaryResource.setDescription(o.getExpDesc());
+ experimentSummaryResource.setApplicationId(o.getApplicationId());
+
+ Status experimentStatus = o.getExperimentStatus();
+ if(experimentStatus != null) {
+ StatusResource statusResource = new StatusResource();
+ statusResource.setStatusId(experimentStatus.getStatusId());
+ statusResource.setJobId(experimentStatus.getJobId());
+ statusResource.setState(experimentStatus.getState());
+ statusResource.setStatusUpdateTime(experimentStatus.getStatusUpdateTime());
+ statusResource.setStatusType(experimentStatus.getStatusType());
+ experimentSummaryResource.setStatus(statusResource);
+ }
+ }
+
+ return experimentSummaryResource;
+ }
+
+ private static List<ExperimentInputResource> getExperimentInputs(List<Experiment_Input> inputs){
+ List<ExperimentInputResource> inputResources = new ArrayList<ExperimentInputResource>();
+ for (Experiment_Input input : inputs){
+ inputResources.add((ExperimentInputResource)createExperimentInput(input));
+ }
+ return inputResources;
+ }
+
+ private static List<ExperimentOutputResource> getExperimentOutputs(List<Experiment_Output> outputs){
+ List<ExperimentOutputResource> outputResources = new ArrayList<>();
+ for (Experiment_Output output : outputs){
+ outputResources.add((ExperimentOutputResource) createExperimentOutput(output));
+ }
+ return outputResources;
+ }
+
+ private static List<NodeInputResource> getNodeInputs(List<NodeInput> inputs){
+ List<NodeInputResource> inputResources = new ArrayList<NodeInputResource>();
+ for (NodeInput input : inputs){
+ inputResources.add((NodeInputResource)createNodeInput(input));
+ }
+ return inputResources;
+ }
+
+ private static List<NodeOutputResource> getNodeOutputs(List<NodeOutput> outputs){
+ List<NodeOutputResource> outputResources = new ArrayList<>();
+ for (NodeOutput output : outputs){
+ outputResources.add((NodeOutputResource) createNodeOutput(output));
+ }
+ return outputResources;
+ }
+
+ private static List<ApplicationInputResource> getApplicationInputs(List<ApplicationInput> inputs){
+ List<ApplicationInputResource> inputResources = new ArrayList<ApplicationInputResource>();
+ for (ApplicationInput input : inputs){
+ inputResources.add((ApplicationInputResource)createApplicationInput(input));
+ }
+ return inputResources;
+ }
+
+ private static List<ApplicationOutputResource> getApplicationOutputs(List<ApplicationOutput> outputs){
+ List<ApplicationOutputResource> outputResources = new ArrayList<>();
+ for (ApplicationOutput output : outputs){
+ outputResources.add((ApplicationOutputResource) createApplicationOutput(output));
+ }
+ return outputResources;
+ }
+
+ private static List<WorkflowNodeDetailResource> getWorkflowNodeLit(List<WorkflowNodeDetail> nodes){
+ List<WorkflowNodeDetailResource> nodeList = new ArrayList<>();
+ for (WorkflowNodeDetail node : nodes){
+ nodeList.add((WorkflowNodeDetailResource) createWorkflowNodeDetail(node));
+ }
+ return nodeList;
+ }
+
+ private static List<StatusResource> getStateChangeList(List<Status> statusList){
+ List<StatusResource> changeList = new ArrayList<>();
+ for (Status status : statusList){
+ changeList.add((StatusResource) createStatusResource(status));
+ }
+ return changeList;
+ }
+
+ private static List<ErrorDetailResource> getErrorList(List<ErrorDetail> errorDetails){
+ List<ErrorDetailResource> errors = new ArrayList<>();
+ for (ErrorDetail error : errorDetails){
+ errors.add((ErrorDetailResource) createErrorDetail(error));
+ }
+ return errors;
+ }
+
+ private static List<JobDetailResource> getJobDetails(List<JobDetail> jobDetails){
+ List<JobDetailResource> resources = new ArrayList<>();
+ for (JobDetail jobDetail : jobDetails){
+ resources.add((JobDetailResource) createJobDetail(jobDetail));
+ }
+ return resources;
+ }
+
+ private static List<DataTransferDetailResource> getDTDetails(List<DataTransferDetail> dataTransferDetails){
+ List<DataTransferDetailResource> resources = new ArrayList<>();
+ for (DataTransferDetail detail : dataTransferDetails){
+ resources.add((DataTransferDetailResource) createDataTransferResource(detail));
+ }
+ return resources;
+ }
+
+ private static List<NotificationEmailResource> getEmailList(List<Notification_Email> emails){
+ List<NotificationEmailResource> emailResources = new ArrayList<>();
+ for (Notification_Email email : emails){
+ emailResources.add((NotificationEmailResource) createNotificationEmail(email));
+ }
+ return emailResources;
+ }
+
+ private static Resource createNotificationEmail (Notification_Email o){
+ NotificationEmailResource emailResource = new NotificationEmailResource();
+ if (o != null){
+ emailResource.setExperimentId(o.getExperiment_id());
+ emailResource.setTaskId(o.getTaskId());
+ emailResource.setEmailAddress(o.getEmailAddress());
+ }
+ return emailResource;
+ }
+
+ private static Resource createExperimentInput (Experiment_Input o){
+ ExperimentInputResource eInputResource = new ExperimentInputResource();
+ if (o != null){
+ eInputResource.setExperimentId(o.getExperiment_id());
+ eInputResource.setDataType(o.getDataType());
+ eInputResource.setMetadata(o.getMetadata());
+ eInputResource.setExperimentKey(o.getEx_key());
+ eInputResource.setAppArgument(o.getAppArgument());
+ eInputResource.setInputOrder(o.getInputOrder());
+ eInputResource.setStandardInput(o.isStandardInput());
+ eInputResource.setUserFriendlyDesc(o.getUserFriendlyDesc());
+ eInputResource.setRequired(o.isRequired());
+ eInputResource.setRequiredToCMD(o.isRequiredToCMD());
+ eInputResource.setDataStaged(o.isDataStaged());
+ if (o.getValue() != null){
+ eInputResource.setValue(new String(o.getValue()));
+ }
+ }
+ return eInputResource;
+ }
+
+ private static Resource createExperimentOutput (Experiment_Output o){
+ ExperimentOutputResource eOutputResource = new ExperimentOutputResource();
+ if (o != null){
+ eOutputResource.setExperimentId(o.getExperiment_id());
+ eOutputResource.setExperimentKey(o.getEx_key());
+ if (o.getValue() != null){
+ eOutputResource.setValue(new String(o.getValue()));
+ }
+ eOutputResource.setDataType(o.getDataType());
+ eOutputResource.setRequired(o.isRequired());
+ eOutputResource.setRequiredToCMD(o.isRequiredToCMD());
+ eOutputResource.setDataMovement(o.isDataMovement());
+ eOutputResource.setDataNameLocation(o.getDataNameLocation());
+ eOutputResource.setSearchQuery(o.getSearchQuery());
+ eOutputResource.setAppArgument(o.getApplicationArgument());
+ }
+ return eOutputResource;
+ }
+
+ private static Resource createWorkflowNodeDetail (WorkflowNodeDetail o){
+ WorkflowNodeDetailResource nodeDetailResource = new WorkflowNodeDetailResource();
+ if (o != null){
+ nodeDetailResource.setExperimentId(o.getExpId());
+ nodeDetailResource.setCreationTime(o.getCreationTime());
+ nodeDetailResource.setNodeInstanceId(o.getNodeId());
+ nodeDetailResource.setNodeName(o.getNodeName());
+ nodeDetailResource.setExecutionUnit(o.getExecutionUnit());
+ nodeDetailResource.setExecutionUnitData(o.getExecutionUnitData());
+ if (o.getTaskDetails() != null && !o.getErrorDetails().isEmpty()){
+ nodeDetailResource.setTaskDetailResourceList(getTaskDetails(o.getTaskDetails()));
+ }
+
+ if (o.getNodeInputs() != null && !o.getNodeInputs().isEmpty()){
+ nodeDetailResource.setNodeInputs(getNodeInputs(o.getNodeInputs()));
+ }
+
+ if (o.getNodeOutputs() != null && !o.getNodeOutputs().isEmpty()){
+ nodeDetailResource.setNodeOutputs(getNodeOutputs(o.getNodeOutputs()));
+ }
+
+ if (o.getNodeStatus() != null){
+ nodeDetailResource.setNodeStatus((StatusResource) createStatusResource(o.getNodeStatus()));
+ }
+
+ if (o.getErrorDetails() != null && !o.getErrorDetails().isEmpty()){
+ nodeDetailResource.setErros(getErrorList(o.getErrorDetails()));
+ }
+ }
+ return nodeDetailResource;
+ }
+
+ private static List<TaskDetailResource> getTaskDetails (List<TaskDetail> taskDetails){
+ List<TaskDetailResource> tasks = new ArrayList<>();
+ for (TaskDetail detail : taskDetails){
+ tasks.add((TaskDetailResource) createTaskDetail(detail));
+ }
+ return tasks;
+ }
+
+ private static Resource createTaskDetail(TaskDetail o){
+ TaskDetailResource taskDetailResource = new TaskDetailResource();
+ if ( o != null){
+ taskDetailResource.setNodeId(o.getNodeId());
+ taskDetailResource.setCreationTime(o.getCreationTime());
+ taskDetailResource.setTaskId(o.getTaskId());
+ taskDetailResource.setApplicationId(o.getAppId());
+ taskDetailResource.setApplicationVersion(o.getAppVersion());
+ taskDetailResource.setApplicationDeploymentId(o.getApplicationDeploymentId());
+ taskDetailResource.setEnableEmailNotifications(o.isAllowNotification());
+ if (o.getApplicationInputs() != null && !o.getApplicationInputs().isEmpty()){
+ taskDetailResource.setApplicationInputs(getApplicationInputs(o.getApplicationInputs()));
+ }
+ if (o.getApplicationOutputs() != null && !o.getApplicationOutputs().isEmpty()){
+ taskDetailResource.setApplicationOutputs(getApplicationOutputs(o.getApplicationOutputs()));
+ }
+ if (o.getResourceScheduling() != null){
+ taskDetailResource.setSchedulingResource((ComputationSchedulingResource) createComputationalScheduling(o.getResourceScheduling()));
+
+ }
+ if (o.getInputDataHandling() != null){
+ taskDetailResource.setInputDataHandlingResource((AdvanceInputDataHandlingResource) createAdvancedInputDataResource(o.getInputDataHandling()));
+ }
+ if (o.getOutputDataHandling() != null){
+ taskDetailResource.setOutputDataHandlingResource((AdvancedOutputDataHandlingResource) createAdvancedOutputDataResource(o.getOutputDataHandling()));
+ }
+ if (o.getErrorDetails() != null && !o.getErrorDetails().isEmpty()){
+ taskDetailResource.setErrors(getErrorList(o.getErrorDetails()));
+ }
+ if (o.getTaskStatus() != null){
+ taskDetailResource.setTaskStatus((StatusResource) createStatusResource(o.getTaskStatus()));
+ }
+ if (o.getNotificationEmails() != null && !o.getNotificationEmails().isEmpty()){
+ taskDetailResource.setEmailResourceList(getEmailList(o.getNotificationEmails()));
+ }
+ if (o.getJobDetails() != null && !o.getJobDetails().isEmpty()){
+ taskDetailResource.setJobDetailResources(getJobDetails(o.getJobDetails()));
+ }
+ if (o.getDataTransferDetails() != null && !o.getDataTransferDetails().isEmpty()){
+ taskDetailResource.setTransferDetailResourceList(getDTDetails(o.getDataTransferDetails()));
+ }
+
+ }
+ return taskDetailResource;
+ }
+
+ private static Resource createErrorDetail (ErrorDetail o){
+ ErrorDetailResource errorDetailResource = new ErrorDetailResource();
+ if (o != null){
+ errorDetailResource.setExperimentId(o.getExpId());
+ errorDetailResource.setTaskId(o.getTaskId());
+ errorDetailResource.setNodeId(o.getNodeId());
+ errorDetailResource.setErrorId(o.getErrorID());
+ errorDetailResource.setJobId(o.getJobId());
+ errorDetailResource.setCreationTime(o.getCreationTime());
+ if (o.getActualErrorMsg() != null){
+ errorDetailResource.setActualErrorMsg(new String(o.getActualErrorMsg()));
+ }
+ errorDetailResource.setUserFriendlyErrorMsg(o.getUserFriendlyErrorMsg());
+ errorDetailResource.setTransientPersistent(o.isTransientPersistent());
+ errorDetailResource.setErrorCategory(o.getErrorCategory());
+ errorDetailResource.setCorrectiveAction(o.getCorrectiveAction());
+ errorDetailResource.setActionableGroup(o.getActionableGroup());
+ }
+
+ return errorDetailResource;
+ }
+
+ private static Resource createApplicationInput (ApplicationInput o){
+ ApplicationInputResource inputResource = new ApplicationInputResource();
+ if (o != null){
+ inputResource.setTaskId(o.getTaskId());
+ inputResource.setInputKey(o.getInputKey());
+ inputResource.setDataType(o.getDataType());
+ inputResource.setAppArgument(o.getAppArgument());
+ inputResource.setInputOrder(o.getInputOrder());
+ inputResource.setStandardInput(o.isStandardInput());
+ inputResource.setUserFriendlyDesc(o.getUserFriendlyDesc());
+ inputResource.setRequired(o.isRequired());
+ inputResource.setRequiredToCMD(o.isRequiredToCMD());
+ inputResource.setDataStaged(o.isDataStaged());
+ if (o.getValue() != null){
+ inputResource.setValue(new String(o.getValue()));
+ }
+ inputResource.setMetadata(o.getMetadata());
+ }
+ return inputResource;
+ }
+
+ private static Resource createApplicationOutput (ApplicationOutput o){
+ ApplicationOutputResource outputResource = new ApplicationOutputResource();
+ if (o != null){
+ outputResource.setTaskId(o.getTaskId());
+ outputResource.setDataType(o.getDataType());
+ outputResource.setOutputKey(o.getOutputKey());
+ if (o.getValue() != null){
+ outputResource.setValue(new String(o.getValue()));
+ }
+ outputResource.setRequired(o.isRequired());
+ outputResource.setRequiredToCMD(o.isAddedToCmd());
+ outputResource.setDataMovement(o.isDataMovement());
+ outputResource.setDataNameLocation(o.getDataNameLocation());
+ outputResource.setSearchQuery(o.getSearchQuery());
+ outputResource.setAppArgument(o.getApplicationArgument());
+ }
+ return outputResource;
+ }
+
+ private static Resource createNodeInput (NodeInput o){
+ NodeInputResource inputResource = new NodeInputResource();
+ if (o != null){
+ inputResource.setNodeId(o.getNodeId());
+ inputResource.setInputKey(o.getInputKey());
+ inputResource.setDataType(o.getDataType());
+ inputResource.setValue(o.getValue());
+ inputResource.setMetadata(o.getMetadata());
+ inputResource.setAppArgument(o.getAppArgument());
+ inputResource.setInputOrder(o.getInputOrder());
+ inputResource.setStandardInput(o.isStandardInput());
+ inputResource.setUserFriendlyDesc(o.getUserFriendlyDesc());
+ inputResource.setRequired(o.getIsRequired());
+ inputResource.setRequiredToCMD(o.getRequiredToCMD());
+ inputResource.setDataStaged(o.isDataStaged());
+ }
+ return inputResource;
+ }
+
+ private static Resource createNodeOutput (NodeOutput o){
+ NodeOutputResource outputResource = new NodeOutputResource();
+ if (o != null){
+ outputResource.setNodeId(o.getNodeId());
+ outputResource.setDataType(o.getDataType());
+ outputResource.setOutputKey(o.getOutputKey());
+ outputResource.setValue(o.getValue());
+ outputResource.setRequired(o.isRequired());
+ outputResource.setRequiredToCMD(o.isRequiredToCMD());
+ outputResource.setDataMovement(o.isDataMovement());
+ outputResource.setDataNameLocation(o.getDataNameLocation());
+ outputResource.setSearchQuery(o.getSearchQuery());
+ outputResource.setAppArgument(o.getApplicationArgument());
+ }
+
+ return outputResource;
+ }
+
+ private static Resource createJobDetail (JobDetail o){
+ JobDetailResource jobDetailResource = new JobDetailResource();
+ if (o != null){
+ jobDetailResource.setTaskId(o.getTaskId());
+ if (o.getJobDescription() != null){
+ jobDetailResource.setJobDescription(new String(o.getJobDescription()));
+ }
+ jobDetailResource.setJobId(o.getJobId());
+ jobDetailResource.setCreationTime(o.getCreationTime());
+ jobDetailResource.setComputeResourceConsumed(o.getComputeResourceConsumed());
+ jobDetailResource.setJobName(o.getJobName());
+ jobDetailResource.setWorkingDir(o.getWorkingDir());
+ jobDetailResource.setJobStatus((StatusResource)createStatusResource(o.getJobStatus()));
+ jobDetailResource.setErrors(getErrorList(o.getErrorDetails()));
+ }
+
+ return jobDetailResource;
+ }
+
+ private static Resource createDataTransferResource (DataTransferDetail o){
+ DataTransferDetailResource transferDetailResource = new DataTransferDetailResource();
+ if (o != null){
+ transferDetailResource.setTaskId(o.getTaskId());
+ transferDetailResource.setTransferId(o.getTransferId());
+ transferDetailResource.setCreationTime(o.getCreationTime());
+ if (o.getTransferDesc() != null){
+ transferDetailResource.setTransferDescription(new String(o.getTransferDesc()));
+ }
+ if (o.getDataTransferStatus() != null){
+ transferDetailResource.setDatatransferStatus((StatusResource)createStatusResource(o.getDataTransferStatus()));
+ }
+ }
+ return transferDetailResource;
+ }
+
+ private static Resource createStatusResource (Status o){
+ StatusResource statusResource = new StatusResource();
+ if (o != null){
+ statusResource.setExperimentId(o.getExpId());
+ statusResource.setTaskId(o.getTaskId());
+ statusResource.setNodeId(o.getNodeId());
+ statusResource.setTransferId(o.getTransferId());
+ statusResource.setStatusId(o.getStatusId());
+ statusResource.setJobId(o.getJobId());
+ statusResource.setState(o.getState());
+ statusResource.setStatusUpdateTime(o.getStatusUpdateTime());
+ statusResource.setStatusType(o.getStatusType());
+ }
+
+ return statusResource;
+ }
+
+ private static Resource createExConfigDataResource (ExperimentConfigData o){
+ ConfigDataResource configDataResource = new ConfigDataResource();
+ if (o != null){
+ configDataResource.setExperimentId(o.getExpId());
+ configDataResource.setAiravataAutoSchedule(o.isAiravataAutoSchedule());
+ configDataResource.setOverrideManualParams(o.isOverrideManualParams());
+ configDataResource.setShareExp(o.isShareExp());
+ configDataResource.setUserDn(o.getUserDn());
+ configDataResource.setGenerateCert(o.isGenerateCert());
+ if (o.getOutputDataHandling() != null){
+ configDataResource.setAdvancedOutputDataHandlingResource((AdvancedOutputDataHandlingResource) createAdvancedOutputDataResource(o.getOutputDataHandling()));
+ }
+ if (o.getInputDataHandling() != null){
+ configDataResource.setAdvanceInputDataHandlingResource((AdvanceInputDataHandlingResource) createAdvancedInputDataResource(o.getInputDataHandling()));
+ }
+ if (o.getResourceScheduling() != null){
+ configDataResource.setComputationSchedulingResource((ComputationSchedulingResource) createComputationalScheduling(o.getResourceScheduling()));
+ }
+ if (o.getQosParam() != null){
+ configDataResource.setQosParamResource((QosParamResource) createQosParamResource(o.getQosParam()));
+ }
+
+ }
+ return configDataResource;
+ }
+
+ private static Resource createComputationalScheduling (Computational_Resource_Scheduling o){
+ ComputationSchedulingResource schedulingResource = new ComputationSchedulingResource();
+ if (o != null){
+ schedulingResource.setExperimentId(o.getExpId());
+ schedulingResource.setTaskId(o.getTaskId());
+ schedulingResource.setSchedulingId(o.getSchedulingId());
+ schedulingResource.setResourceHostId(o.getResourceHostId());
+ schedulingResource.setCpuCount(o.getCpuCount());
+ schedulingResource.setNodeCount(o.getNodeCount());
+ schedulingResource.setNumberOfThreads(o.getNumberOfThreads());
+ schedulingResource.setQueueName(o.getQueueName());
+ schedulingResource.setWalltimeLimit(o.getWallTimeLimit());
+ schedulingResource.setJobStartTime(o.getJobStartTime());
+ schedulingResource.setPhysicalMemory(o.getTotalPhysicalmemory());
+ schedulingResource.setProjectName(o.getProjectName());
+ schedulingResource.setChessisName(o.getChessisName());
+ }
+
+ return schedulingResource;
+ }
+
+ private static Resource createAdvancedInputDataResource (AdvancedInputDataHandling o){
+ AdvanceInputDataHandlingResource dataHandlingResource = new AdvanceInputDataHandlingResource();
+ if (o != null){
+ dataHandlingResource.setExperimentId(o.getExpId());
+ dataHandlingResource.setTaskId(o.getTaskId());
+ dataHandlingResource.setDataHandlingId(o.getDataHandlingId());
+ dataHandlingResource.setWorkingDirParent(o.getParentWorkingDir());
+ dataHandlingResource.setWorkingDir(o.getWorkingDir());
+ dataHandlingResource.setStageInputFiles(o.isStageInputsToWorkingDir());
+ dataHandlingResource.setCleanAfterJob(o.isCleanAfterJob());
+ }
+
+ return dataHandlingResource;
+ }
+
+ private static Resource createAdvancedOutputDataResource (AdvancedOutputDataHandling o){
+ AdvancedOutputDataHandlingResource dataHandlingResource = new AdvancedOutputDataHandlingResource();
+ if (o != null){
+ dataHandlingResource.setExperimentId(o.getExpId());
+ dataHandlingResource.setTaskId(o.getTaskId());
+ dataHandlingResource.setOutputDataHandlingId(o.getOutputDataHandlingId());
+ dataHandlingResource.setOutputDataDir(o.getOutputDataDir());
+ dataHandlingResource.setDataRegUrl(o.getDataRegUrl());
+ dataHandlingResource.setPersistOutputData(o.isPersistOutputData());
+ }
+ return dataHandlingResource;
+ }
+
+ private static Resource createQosParamResource (QosParam o){
+ QosParamResource qosParamResource = new QosParamResource();
+ if (o != null){
+ qosParamResource.setExperimentId(o.getExpId());
+ qosParamResource.setTaskId(o.getTaskId());
+ qosParamResource.setQosId(o.getQosId());
+ qosParamResource.setExecuteBefore(o.getExecuteBefore());
+ qosParamResource.setStartExecutionAt(o.getStartExecutionAt());
+ qosParamResource.setNoOfRetries(o.getNoOfRetries());
+ }
+
+ return qosParamResource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/WorkerResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/WorkerResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/WorkerResource.java
new file mode 100644
index 0000000..51ba04f
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/WorkerResource.java
@@ -0,0 +1,727 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.model.workspace.experiment.ExperimentState;
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.*;
+import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.apache.airavata.registry.cpi.ResultOrderType;
+import org.apache.airavata.registry.cpi.utils.Constants;
+import org.apache.airavata.registry.cpi.utils.StatusType;
+import org.apache.openjpa.persistence.OpenJPAPersistence;
+import org.apache.openjpa.persistence.OpenJPAQuery;
+import org.apache.openjpa.persistence.jdbc.FetchMode;
+import org.apache.openjpa.persistence.jdbc.JDBCFetchPlan;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+public class WorkerResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(WorkerResource.class);
+ private String user;
+ private String gatewayId;
+
+ public WorkerResource() {
+ }
+
+ public WorkerResource(String user, String gatewayId) {
+ this.user = user;
+ this.gatewayId = gatewayId;
+ }
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ /**
+ * Gateway worker can create child data structures such as projects and user workflows
+ * @param type child resource type
+ * @return child resource
+ */
+ public Resource create(ResourceType type) throws RegistryException{
+ Resource result = null;
+ switch (type) {
+ case PROJECT:
+ ProjectResource projectResource = new ProjectResource();
+ projectResource.setWorker(this);
+ projectResource.setGatewayId(gatewayId);
+ result=projectResource;
+ break;
+ case EXPERIMENT:
+ ExperimentResource experimentResource = new ExperimentResource();
+ experimentResource.setExecutionUser(user);
+ experimentResource.setGatewayId(gatewayId);
+ result = experimentResource;
+ break;
+ default:
+ logger.error("Unsupported resource type for worker resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for worker resource.");
+
+ }
+ return result;
+ }
+
+ /**
+ *
+ * @param type child resource type
+ * @param name child resource name
+ */
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ switch (type) {
+ case PROJECT:
+ generator = new QueryGenerator(PROJECT);
+ generator.setParameter(ProjectConstants.PROJECT_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case EXPERIMENT:
+ generator = new QueryGenerator(EXPERIMENT);
+ generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ default:
+ logger.error("Unsupported resource type for worker resource.", new IllegalArgumentException());
+ break;
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e.getMessage());
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ /**
+ *
+ * @param type child resource type
+ * @param name child resource name
+ * @return child resource
+ */
+ public Resource get(ResourceType type, Object name) throws RegistryException{
+ Resource result = null;
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator;
+ Query q;
+ switch (type) {
+ case PROJECT:
+ generator = new QueryGenerator(PROJECT);
+ generator.setParameter(ProjectConstants.PROJECT_ID, name);
+ q = generator.selectQuery(em);
+ Project project = (Project) q.getSingleResult();
+ result = Utils.getResource(ResourceType.PROJECT, project);
+ break;
+ case EXPERIMENT:
+ generator = new QueryGenerator(EXPERIMENT);
+ generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
+ q = generator.selectQuery(em);
+ Experiment experiment = (Experiment) q.getSingleResult();
+ result = Utils.getResource(ResourceType.EXPERIMENT, experiment);
+ break;
+ default:
+ logger.error("Unsupported resource type for worker resource.", new IllegalArgumentException());
+ break;
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return result;
+ }
+
+// public List<GFacJobDataResource> getGFacJobs(String serviceDescriptionId, String hostDescriptionId, String applicationDescriptionId){
+// List<GFacJobDataResource> result = new ArrayList<GFacJobDataResource>();
+// EntityManager em = ResourceUtils.getEntityManager();
+// em.getTransaction().begin();
+// QueryGenerator generator;
+// Query q;
+// generator = new QueryGenerator(GFAC_JOB_DATA);
+// generator.setParameter(GFacJobDataConstants.SERVICE_DESC_ID, serviceDescriptionId);
+// generator.setParameter(GFacJobDataConstants.HOST_DESC_ID, hostDescriptionId);
+// generator.setParameter(GFacJobDataConstants.APP_DESC_ID, applicationDescriptionId);
+// q = generator.selectQuery(em);
+// for (Object o : q.getResultList()) {
+// GFac_Job_Data gFacJobData = (GFac_Job_Data)o;
+// result.add((GFacJobDataResource)Utils.getResource(ResourceType.GFAC_JOB_DATA, gFacJobData));
+// }
+// em.getTransaction().commit();
+// em.close();
+// return result;
+// }
+//
+// public List<GFacJobStatusResource> getGFacJobStatuses(String jobId){
+// List<GFacJobStatusResource> resourceList = new ArrayList<GFacJobStatusResource>();
+// EntityManager em = ResourceUtils.getEntityManager();
+// em.getTransaction().begin();
+// QueryGenerator generator;
+// Query q;
+// generator = new QueryGenerator(GFAC_JOB_STATUS);
+// generator.setParameter(GFacJobStatusConstants.LOCAL_JOB_ID, jobId);
+// q = generator.selectQuery(em);
+// for (Object result : q.getResultList()) {
+// GFac_Job_Status gFacJobStatus = (GFac_Job_Status) result;
+// GFacJobStatusResource gFacJobStatusResource =
+// (GFacJobStatusResource)Utils.getResource(ResourceType.GFAC_JOB_STATUS, gFacJobStatus);
+// resourceList.add(gFacJobStatusResource);
+// }
+// return resourceList;
+// }
+
+ /**
+ * Method get all results of the given child resource type
+ *
+ * @param type child resource type
+ * @return list of child resources
+ */
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ return get(type, -1, -1, null, null);
+ }
+
+ /**
+ * Method get all results of the given child resource type with paginaltion and ordering
+ *
+ * @param type child resource type
+ * @param limit
+ * @param offset
+ * @param orderByIdentifier
+ * @param resultOrderType
+ * @return list of child resources
+ * @throws RegistryException
+ */
+ public List<Resource> get(ResourceType type, int limit, int offset, Object orderByIdentifier,
+ ResultOrderType resultOrderType) throws RegistryException{
+ List<Resource> result = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator;
+ Query q;
+ switch (type) {
+ case PROJECT:
+ generator = new QueryGenerator(PROJECT);
+ Users users = em.find(Users.class, getUser());
+ Gateway gatewayModel = em.find(Gateway.class, gatewayId);
+ generator.setParameter("users", users);
+ if (gatewayModel != null){
+ generator.setParameter("gateway", gatewayModel);
+ }
+
+ //ordering - only supported only by CREATION_TIME
+ if(orderByIdentifier != null && resultOrderType != null
+ && orderByIdentifier.equals(Constants.FieldConstants.ProjectConstants.CREATION_TIME)) {
+ q = generator.selectQuery(em, ProjectConstants.CREATION_TIME, resultOrderType);
+ }else{
+ q = generator.selectQuery(em);
+ }
+
+ //pagination
+ if(limit>0 && offset>=0){
+ q.setFirstResult(offset);
+ q.setMaxResults(limit);
+ }
+
+ for (Object o : q.getResultList()) {
+ Project project = (Project) o;
+ ProjectResource projectResource = (ProjectResource) Utils.getResource(ResourceType.PROJECT, project);
+ result.add(projectResource);
+ }
+ break;
+ case EXPERIMENT:
+ generator = new QueryGenerator(EXPERIMENT);
+ generator.setParameter(ExperimentConstants.EXECUTION_USER, getUser());
+
+ //ordering - only supported only by CREATION_TIME
+ if(orderByIdentifier != null && resultOrderType != null
+ && orderByIdentifier.equals(Constants.FieldConstants.ProjectConstants.CREATION_TIME)) {
+ q = generator.selectQuery(em, ExperimentConstants.CREATION_TIME, resultOrderType);
+ }else{
+ q = generator.selectQuery(em);
+ }
+
+ //pagination
+ if(limit>0 && offset>=0){
+ q.setFirstResult(offset);
+ q.setMaxResults(limit);
+ }
+ for (Object o : q.getResultList()) {
+ Experiment experiment = (Experiment) o;
+ ExperimentResource experimentResource = (ExperimentResource) Utils.getResource(ResourceType.EXPERIMENT, experiment);
+ result.add(experimentResource);
+ }
+
+ break;
+ default:
+ logger.error("Unsupported resource type for worker resource.", new IllegalArgumentException());
+ break;
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return result;
+ }
+
+ /**
+ * save gateway worker to database
+ */
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ Gateway_Worker existingWorker = em.find(Gateway_Worker.class, new Gateway_Worker_PK(gatewayId, user));
+ em.close();
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Gateway_Worker gatewayWorker = new Gateway_Worker();
+ Users existingUser = em.find(Users.class, this.user);
+ gatewayWorker.setUser(existingUser);
+ gatewayWorker.setUser_name(existingUser.getUser_name());
+ gatewayWorker.setGateway_id(gatewayId);
+ if (existingWorker != null) {
+ existingWorker.setUser_name(existingUser.getUser_name());
+ existingWorker.setUser(existingUser);
+ existingWorker.setGateway_id(gatewayId);
+ gatewayWorker = em.merge(existingWorker);
+ } else {
+ em.persist(gatewayWorker);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ /**
+ *
+ * @return user name
+ */
+ public String getUser() {
+ return user;
+ }
+
+ /**
+ *
+ * @param user user name
+ */
+ public void setUser(String user) {
+ this.user = user;
+ }
+
+ /**
+ *
+ * @param id project id
+ * @return whether the project is available under the user
+ */
+ public boolean isProjectExists(String id) throws RegistryException{
+ return isExists(ResourceType.PROJECT, id);
+ }
+
+ /**
+ *
+ * @param projectId project id
+ * @return project resource for the user
+ */
+ public ProjectResource createProject(String projectId) throws RegistryException{
+ ProjectResource project=(ProjectResource)create(ResourceType.PROJECT);
+ project.setId(projectId);
+ return project;
+ }
+
+ public String getProjectID(String projectName) {
+ String pro = projectName.replaceAll("\\s", "");
+ return pro + "_" + UUID.randomUUID();
+ }
+
+ /**
+ *
+ * @param id project id
+ * @return project resource
+ */
+ public ProjectResource getProject(String id) throws RegistryException{
+ return (ProjectResource)get(ResourceType.PROJECT, id);
+ }
+
+ /**
+ *
+ * @param id project id
+ */
+ public void removeProject(String id) throws RegistryException{
+ remove(ResourceType.PROJECT, id);
+ }
+
+ /**
+ * Get projects list of user
+ * @return list of projects for the user
+ */
+ public List<ProjectResource> getProjects() throws RegistryException{
+ return getProjects(-1, -1, null, null);
+ }
+
+
+ /**
+ * Get projects list of user with pagination and ordering
+ *
+ * @return list of projects for the user
+ */
+ public List<ProjectResource> getProjects(int limit, int offset, Object orderByIdentifier,
+ ResultOrderType resultOrderType) throws RegistryException{
+ List<ProjectResource> result=new ArrayList<ProjectResource>();
+ List<Resource> list = get(ResourceType.PROJECT, limit, offset, orderByIdentifier, resultOrderType);
+ for (Resource resource : list) {
+ result.add((ProjectResource) resource);
+ }
+ return result;
+ }
+
+ /**
+ *
+ * @param name experiment name
+ * @return whether experiment is already exist for the given user
+ */
+ public boolean isExperimentExists(String name) throws RegistryException{
+ return isExists(ResourceType.EXPERIMENT, name);
+ }
+
+
+ /**
+ *
+ * @param name experiment name
+ * @return experiment resource
+ */
+ public ExperimentResource getExperiment(String name) throws RegistryException{
+ return (ExperimentResource)get(ResourceType.EXPERIMENT, name);
+ }
+//
+// public GFacJobDataResource getGFacJob(String jobId){
+// return (GFacJobDataResource)get(ResourceType.GFAC_JOB_DATA,jobId);
+// }
+
+ /**
+ * Method to get list of expeirments of user
+ * @return list of experiments for the user
+ */
+ public List<ExperimentResource> getExperiments() throws RegistryException{
+ return getExperiments(-1, -1, null, null);
+ }
+
+ /**
+ * Method to get list of experiments of user with pagination and ordering
+ * @param limit
+ * @param offset
+ * @param orderByIdentifier
+ * @param resultOrderType
+ * @return
+ * @throws RegistryException
+ */
+ public List<ExperimentResource> getExperiments(int limit, int offset, Object orderByIdentifier,
+ ResultOrderType resultOrderType) throws RegistryException{
+ List<ExperimentResource> result=new ArrayList<ExperimentResource>();
+ List<Resource> list = get(ResourceType.EXPERIMENT, limit, offset, orderByIdentifier, resultOrderType);
+ for (Resource resource : list) {
+ result.add((ExperimentResource) resource);
+ }
+ return result;
+ }
+
+ /**
+ *
+ * @param experimentId experiment name
+ */
+ public void removeExperiment(String experimentId) throws RegistryException{
+ remove(ResourceType.EXPERIMENT, experimentId);
+ }
+
+ /**
+ * To search the projects of user with the given filter criteria and retrieve the results with
+ * pagination support. Results can be ordered based on an identifier (i.e column) either ASC or
+ * DESC. But in the current implementation ordering is only supported based on the project
+ * creation time
+ *
+ * @param filters
+ * @param limit
+ * @param offset
+ * @param orderByIdentifier
+ * @param resultOrderType
+ * @return
+ * @throws RegistryException
+ */
+ public List<ProjectResource> searchProjects(Map<String, String> filters, int limit,
+ int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
+ List<ProjectResource> result = new ArrayList<ProjectResource>();
+ EntityManager em = null;
+ try {
+ String query = "SELECT p from Project p WHERE ";
+ if (filters != null && filters.size() != 0) {
+ for (String field : filters.keySet()) {
+ String filterVal = filters.get(field);
+ if (field.equals(ProjectConstants.USERNAME)) {
+ query += "p." + field + "= '" + filterVal + "' AND ";
+ }else if (field.equals(ProjectConstants.GATEWAY_ID)) {
+ query += "p." + field + "= '" + filterVal + "' AND ";
+ }else {
+ if (filterVal.contains("*")){
+ filterVal = filterVal.replaceAll("\\*", "");
+ }
+ query += "p." + field + " LIKE '%" + filterVal + "%' AND ";
+ }
+ }
+ }
+ query = query.substring(0, query.length() - 5);
+
+ //ordering
+ if( orderByIdentifier != null && resultOrderType != null
+ && orderByIdentifier.equals(Constants.FieldConstants.ProjectConstants.CREATION_TIME)){
+ String order = (resultOrderType == ResultOrderType.ASC) ? "ASC" : "DESC";
+ query += " ORDER BY p." + ProjectConstants.CREATION_TIME + " " + order;
+ }
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+
+ //pagination
+ if(offset>=0 && limit >=0){
+ q = em.createQuery(query).setFirstResult(offset).setMaxResults(limit);
+ }else{
+ q = em.createQuery(query);
+ }
+
+ List resultList = q.getResultList();
+ for (Object o : resultList) {
+ Project project = (Project) o;
+ ProjectResource projectResource =
+ (ProjectResource) Utils.getResource(ResourceType.PROJECT, project);
+ result.add(projectResource);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return result;
+ }
+
+ /**
+ * To search the experiments of user with the given time period and filter criteria and retrieve the results with
+ * pagination support. Results can be ordered based on an identifier (i.e column) either ASC or
+ * DESC. But in the current implementation ordering is only supported based on creationTime. Also if
+ * time period values i.e fromTime and toTime are null they will be ignored.
+ *
+ * @param fromTime
+ * @param toTime
+ * @param filters
+ * @param limit
+ * @param offset
+ * @param orderByIdentifier
+ * @param resultOrderType
+ * @return
+ * @throws RegistryException
+ */
+ public List<ExperimentSummaryResource> searchExperiments(Timestamp fromTime, Timestamp toTime, Map<String, String> filters, int limit,
+ int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
+ List<ExperimentSummaryResource> result = new ArrayList();
+ EntityManager em = null;
+ try {
+ String query;
+ if(filters.get(StatusConstants.STATE) != null) {
+ query = "SELECT DISTINCT (e) FROM Experiment e " +
+ "JOIN e.statuses s LEFT JOIN FETCH e.statuses WHERE " +
+ "s.statusType='" + StatusType.EXPERIMENT + "' AND ";
+ String experimentState = ExperimentState.valueOf(filters.get(StatusConstants.STATE)).toString();
+ query += "s.state='" + experimentState + "' AND ";
+ }else{
+ query = "SELECT e FROM Experiment e " +
+ "LEFT JOIN FETCH e.statuses WHERE ";
+ }
+
+ if(toTime != null && fromTime != null && toTime.after(fromTime)){
+ query += "e.creationTime > '" + fromTime + "' " + "AND e.creationTime <'" + toTime + "' AND ";
+ }
+
+ filters.remove(StatusConstants.STATE);
+ if (filters != null && filters.size() != 0) {
+ for (String field : filters.keySet()) {
+ String filterVal = filters.get(field);
+ if (field.equals(ExperimentConstants.EXECUTION_USER)) {
+ query += "e." + field + "= '" + filterVal + "' AND ";
+ }else if (field.equals(ExperimentConstants.GATEWAY_ID)) {
+ query += "e." + field + "= '" + filterVal + "' AND ";
+ } else if (field.equals(ExperimentConstants.PROJECT_ID)) {
+ query += "e." + field + "= '" + filterVal + "' AND ";
+ } else {
+ if (filterVal.contains("*")){
+ filterVal = filterVal.replaceAll("\\*", "");
+ }
+ query += "e." + field + " LIKE '%" + filterVal + "%' AND ";
+ }
+ }
+ }
+ query = query.substring(0, query.length() - 5);
+
+ //ordering
+ if( orderByIdentifier != null && resultOrderType != null
+ && orderByIdentifier.equals(Constants.FieldConstants.ExperimentConstants.CREATION_TIME)){
+ String order = (resultOrderType == ResultOrderType.ASC) ? "ASC" : "DESC";
+ query += " ORDER BY e." + ExperimentConstants.CREATION_TIME + " " + order;
+ }
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+
+ //pagination
+ if(offset>=0 && limit >=0){
+ q = em.createQuery(query).setFirstResult(offset).setMaxResults(limit);
+ }else{
+ q = em.createQuery(query);
+ }
+ OpenJPAQuery kq = OpenJPAPersistence.cast(q);
+ JDBCFetchPlan fetch = (JDBCFetchPlan) kq.getFetchPlan();
+ fetch.setEagerFetchMode(FetchMode.JOIN);
+
+ List resultList = q.getResultList();
+ for (Object o : resultList) {
+ Experiment experiment = (Experiment) o;
+ ExperimentSummaryResource experimentSummaryResource =
+ (ExperimentSummaryResource) Utils.getResource(ResourceType.EXPERIMENT_SUMMARY, experiment);
+ result.add(experimentSummaryResource);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return result;
+ }
+
+ /**
+ *
+ * @return list of experiments for the user
+ */
+ public List<ExperimentResource> getExperimentsByCaching(String user) throws RegistryException{
+ List<ExperimentResource> result = new ArrayList<ExperimentResource>();
+ EntityManager em = null;
+ try {
+ String query = "SELECT e from Experiment e WHERE e.executionUser = '" + user + "'";
+ em = ResourceUtils.getEntityManager();
+// OpenJPAEntityManagerFactory oemf = OpenJPAPersistence.cast(em.getEntityManagerFactory());
+// QueryResultCache qcache = oemf.getQueryResultCache();
+ // qcache.evictAll(Experiment.class);
+ em.getTransaction().begin();
+ Query q = em.createQuery(query);
+ List resultList = q.getResultList();
+ for (Object o : resultList) {
+ Experiment experiment = (Experiment) o;
+ ExperimentResource experimentResource = (ExperimentResource) Utils.getResource(ResourceType.EXPERIMENT, experiment);
+ result.add(experimentResource);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return result;
+ }
+}
[24/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
deleted file mode 100644
index 4b6fc80..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
- *
- * 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.model.*;
-import org.apache.airavata.persistance.registry.jpa.resources.*;
-import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ResourceUtils {
- private final static Logger logger = LoggerFactory.getLogger(ResourceUtils.class);
- private static final String PERSISTENCE_UNIT_NAME = "airavata_data";
- protected static EntityManagerFactory factory;
-
- public static void reset(){
- factory=null;
- }
-
- public static EntityManager getEntityManager(){
- if (factory == null) {
- String connectionProperties = "DriverClassName=" + Utils.getJDBCDriver() + "," + "Url=" + Utils.getJDBCURL() + "?autoReconnect=true,," +
- "Username=" + Utils.getJDBCUser() + "," + "Password=" + Utils.getJDBCPassword() + ",validationQuery=" +
- Utils.getValidationQuery();
- System.out.println(connectionProperties);
- Map<String, String> properties = new HashMap<String, String>();
- properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource");
- properties.put("openjpa.ConnectionProperties", connectionProperties);
- properties.put("openjpa.DynamicEnhancementAgent", "true");
- properties.put("openjpa.RuntimeUnenhancedClasses", "unsupported");
- properties.put("openjpa.DataCache","" + Utils.isCachingEnabled() + "(CacheSize=" + Utils.getJPACacheSize() + ", SoftReferenceSize=0)");
- properties.put("openjpa.QueryCache","" + Utils.isCachingEnabled() + "(CacheSize=" + Utils.getJPACacheSize() + ", SoftReferenceSize=0)");
- properties.put("openjpa.RemoteCommitProvider","sjvm");
- properties.put("openjpa.Log","DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO");
- properties.put("openjpa.jdbc.DBDictionary","SupportsMultipleNontransactionalResultSets=false");
-// properties.put("openjpa.ReadLockLevel", "none");
-// properties.put("openjpa.WriteLockLevel", "none");
-// properties.put("openjpa.LockTimeout", "30000");
-// properties.put("openjpa.LockManager", "none");
- properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
- properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000, autoReconnect=true");
- properties.put("openjpa.jdbc.QuerySQLCache", "false");
- factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
- }
- return factory.createEntityManager();
- }
-
- /**
- * @param gatewayId
- * @return
- */
- public static Resource createGateway(String gatewayId) throws RegistryException {
- if (!isGatewayExist(gatewayId)) {
- GatewayResource gatewayResource = new GatewayResource();
- gatewayResource.setGatewayId(gatewayId);
- return gatewayResource;
- }else {
- return getGateway(gatewayId);
- }
- }
-
- public static UserResource createUser(String username, String password) throws RegistryException {
- if (!isUserExist(username)) {
- UserResource userResource = new UserResource();
- userResource.setUserName(username);
- userResource.setPassword(password);
- return userResource;
- }else {
- return (UserResource)getUser(username);
- }
-
- }
-
- public static Resource getGateway(String gatewayId) throws RegistryException{
- EntityManager em = null;
- try {
- if (isGatewayExist(gatewayId)) {
- em = getEntityManager();
- Gateway gateway = em.find(Gateway.class, gatewayId);
- GatewayResource gatewayResource = (GatewayResource)Utils.getResource(ResourceType.GATEWAY, gateway);
- em.close();
- return gatewayResource;
- }
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return null;
- }
-
- public static void addUser (String userName, String password) throws RegistryException{
- UserResource resource = new UserResource();
- resource.setUserName(userName);
- resource.setPassword(password);
- resource.save();
- }
-
- public static boolean isUserExist (String username) throws RegistryException{
- EntityManager em = null;
- try {
- em = getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(AbstractResource.USERS);
- generator.setParameter(AbstractResource.UserConstants.USERNAME, username);
- Query q = generator.selectQuery(em);
- int size = q.getResultList().size();
- em.getTransaction().commit();
- em.close();
- return size>0;
- } catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public static Resource getUser(String userName) throws RegistryException{
- EntityManager em = null;
- try {
- if (isUserExist(userName)) {
- em = getEntityManager();
- Users user = em.find(Users.class, userName);
- UserResource userResource = (UserResource)Utils.getResource(ResourceType.USER, user);
- em.close();
- return userResource;
- }
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return null;
-
- }
-
- public static Resource getWorker(String gatewayId, String userName) throws RegistryException{
- EntityManager em = null;
- try {
- em = getEntityManager();
- Gateway_Worker gatewayWorker = em.find(Gateway_Worker.class, new Gateway_Worker_PK(gatewayId, userName));
- WorkerResource workerResource = (WorkerResource) Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
- em.close();
- return workerResource;
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
-
- }
-
-
- /**
- * @param gatewayId
- * @return
- */
- public static boolean isGatewayExist(String gatewayId) throws RegistryException{
- EntityManager em = null;
- try {
- em = getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(AbstractResource.GATEWAY);
- generator.setParameter(AbstractResource.GatewayConstants.GATEWAY_ID, gatewayId);
- Query q = generator.selectQuery(em);
- int size = q.getResultList().size();
- em.getTransaction().commit();
- em.close();
- return size>0;
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
- }
-
- public static List<Resource> getAllGateways() throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(AbstractResource.GATEWAY);
- Query q = generator.selectQuery(em);
- List results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Gateway gateway = (Gateway) result;
- GatewayResource gatewayResource =
- (GatewayResource) Utils.getResource(ResourceType.GATEWAY, gateway);
- resourceList.add(gatewayResource);
- }
- }
- em.getTransaction().commit();
- em.close();
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- /**
- * @param gatewayId
- * @return
- */
- public static boolean removeGateway(String gatewayId) {
- EntityManager em = null;
- try {
- em = getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(AbstractResource.GATEWAY);
- generator.setParameter(AbstractResource.GatewayConstants.GATEWAY_ID, gatewayId);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- return true;
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- return false;
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- * @param gatewayResource
- * @param userResource
- */
- public static WorkerResource addGatewayWorker(GatewayResource gatewayResource, UserResource userResource) throws RegistryException{
- EntityManager em = null;
- try {
- em = getEntityManager();
- em.getTransaction().begin();
- if (!isGatewayExist(gatewayResource.getGatewayName())){
- gatewayResource.save();
- }
- if (!isUserExist(userResource.getUserName())){
- userResource.save();
- }
- Gateway gateway = em.find(Gateway.class, gatewayResource.getGatewayId());
- Users user = em.find(Users.class, userResource.getUserName());
- Gateway_Worker gatewayWorker = new Gateway_Worker();
- gatewayWorker.setGateway(gateway);
- gatewayWorker.setUser(user);
- em.persist(gatewayWorker);
- em.getTransaction().commit();
- em.close();
- return (WorkerResource)Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
- } catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- * @param gatewayResource
- * @param userResource
- * @return
- */
- public static boolean removeGatewayWorker(GatewayResource gatewayResource, UserResource userResource) {
- EntityManager em = null;
- try {
- em = getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(AbstractResource.GATEWAY_WORKER);
- generator.setParameter(AbstractResource.GatewayWorkerConstants.GATEWAY_ID,
- gatewayResource.getGatewayName());
- generator.setParameter(AbstractResource.UserConstants.USERNAME, userResource.getUserName());
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- return true;
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- return false;
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
- }
-
- /**
- * @param configKey
- * @return
- */
- public static List<ConfigurationResource> getConfigurations(String configKey){
- List<ConfigurationResource> list = new ArrayList<ConfigurationResource>();
- EntityManager em = null;
- try {
- em = getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(AbstractResource.CONFIGURATION);
- generator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_KEY, configKey);
- Query q = generator.selectQuery(em);
- List<?> resultList = q.getResultList();
- if (resultList.size() != 0) {
- for (Object result : resultList) {
- ConfigurationResource configurationResource = createConfigurationResourceObject(result);
- list.add(configurationResource);
- }
- }
- em.getTransaction().commit();
- em.close();
- }catch (Exception e) {
- logger.error(e.getMessage(), e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return list;
- }
-
- /**
- * @param configKey
- * @return
- */
- public static ConfigurationResource getConfiguration(String configKey){
- List<ConfigurationResource> configurations = getConfigurations(configKey);
- return (configurations != null && configurations.size() > 0) ? configurations.get(0) : null;
- }
-
- /**
- * @param configKey
- * @return
- */
- public static boolean isConfigurationExist(String configKey){
- List<ConfigurationResource> configurations = getConfigurations(configKey);
- return (configurations != null && configurations.size() > 0);
- }
-
- /**
- * @param configKey
- * @return
- */
- public static ConfigurationResource createConfiguration(String configKey) {
- ConfigurationResource config = new ConfigurationResource();
- config.setConfigKey(configKey);
- return config;
- }
-
- /**
- * @param result
- * @return
- */
- private static ConfigurationResource createConfigurationResourceObject(
- Object result) {
- Configuration configuration = (Configuration) result;
- ConfigurationResource configurationResource = new ConfigurationResource(configuration.getConfig_key(), configuration.getConfig_val());
- configurationResource.setExpireDate(configuration.getExpire_date());
- return configurationResource;
- }
-
- /**
- * @param configkey
- * @param configValue
- */
- public static void removeConfiguration(String configkey, String configValue) throws RegistryException{
- QueryGenerator queryGenerator = new QueryGenerator(AbstractResource.CONFIGURATION);
- queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_KEY, configkey);
- queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_VAL, configValue);
- EntityManager em = null;
- try {
- if(isConfigurationExists(configkey, configValue)){
- em = getEntityManager();
- em.getTransaction().begin();
- Query q = queryGenerator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- }
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- * @param configkey
- */
- public static void removeConfiguration(String configkey) throws RegistryException{
- QueryGenerator queryGenerator = new QueryGenerator(AbstractResource.CONFIGURATION);
- queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_KEY, configkey);
- EntityManager em = null;
- try {
- if(isConfigurationExist(configkey)){
- em = getEntityManager();
- em.getTransaction().begin();
- Query q = queryGenerator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- }
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public static boolean isConfigurationExists(String configKey, String configVal) throws RegistryException{
- EntityManager em = null;
- try{
- //Currently categoryID is hardcoded value
- em = ResourceUtils.getEntityManager();
- Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey, configVal, AbstractResource.ConfigurationConstants.CATEGORY_ID_DEFAULT_VALUE));
- em.close();
- return existing!= null;
- } catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
[05/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NodeOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NodeOutputResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NodeOutputResource.java
new file mode 100644
index 0000000..5edc314
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NodeOutputResource.java
@@ -0,0 +1,207 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.NodeOutput;
+import org.apache.airavata.experiment.catalog.model.NodeOutput_PK;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NodeOutputResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(NodeOutputResource.class);
+
+ private String nodeId;
+ private String outputKey;
+ private String dataType;
+ private String value;
+ private boolean isRequired;
+ private boolean dataMovement;
+ private String dataNameLocation;
+ private boolean requiredToCMD;
+ private String searchQuery;
+ private String appArgument;
+
+ public String getSearchQuery() {
+ return searchQuery;
+ }
+
+ public void setSearchQuery(String searchQuery) {
+ this.searchQuery = searchQuery;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+
+
+ public boolean getRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean getRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean required) {
+ this.isRequired = required;
+ }
+
+ public boolean isDataMovement() {
+ return dataMovement;
+ }
+
+ public void setDataMovement(boolean dataMovement) {
+ this.dataMovement = dataMovement;
+ }
+
+ public String getDataNameLocation() {
+ return dataNameLocation;
+ }
+
+ public void setDataNameLocation(String dataNameLocation) {
+ this.dataNameLocation = dataNameLocation;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public String getOutputKey() {
+ return outputKey;
+ }
+
+ public void setOutputKey(String outputKey) {
+ this.outputKey = outputKey;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+
+ public Resource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public Resource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ NodeOutput existingOutput = em.find(NodeOutput.class, new NodeOutput_PK(outputKey, nodeId));
+ em.close();
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ NodeOutput nodeOutput = new NodeOutput();
+ nodeOutput.setNodeId(nodeId);
+ nodeOutput.setOutputKey(outputKey);
+ nodeOutput.setDataType(dataType);
+ nodeOutput.setValue(value);
+ nodeOutput.setRequired(isRequired);
+ nodeOutput.setRequiredToCMD(requiredToCMD);
+ nodeOutput.setDataMovement(dataMovement);
+ nodeOutput.setDataNameLocation(dataNameLocation);
+ nodeOutput.setApplicationArgument(appArgument);
+ nodeOutput.setSearchQuery(searchQuery);
+
+ if (existingOutput != null) {
+ existingOutput.setNodeId(nodeId);
+ existingOutput.setOutputKey(outputKey);
+ existingOutput.setDataType(dataType);
+ existingOutput.setValue(value);
+ existingOutput.setRequired(isRequired);
+ existingOutput.setRequiredToCMD(requiredToCMD);
+ existingOutput.setDataMovement(dataMovement);
+ existingOutput.setDataNameLocation(dataNameLocation);
+ existingOutput.setApplicationArgument(appArgument);
+ existingOutput.setSearchQuery(searchQuery);
+ nodeOutput = em.merge(existingOutput);
+ } else {
+ em.persist(nodeOutput);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NotificationEmailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NotificationEmailResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NotificationEmailResource.java
new file mode 100644
index 0000000..1bcce9c
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NotificationEmailResource.java
@@ -0,0 +1,119 @@
+/*
+*
+* 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.*;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import java.util.List;
+
+public class NotificationEmailResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(NotificationEmailResource.class);
+
+ private int emailId = 0;
+ private String experimentId;
+ private String taskId;
+ private String emailAddress;
+
+
+ public String getEmailAddress() {
+ return emailAddress;
+ }
+
+ public void setEmailAddress(String emailAddress) {
+ this.emailAddress = emailAddress;
+ }
+
+ public String getExperimentId() {
+ return experimentId;
+ }
+
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public Resource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ public Resource get(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ public List<Resource> get(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Notification_Email notification_email;
+ if (emailId != 0 ){
+ notification_email = em.find(Notification_Email.class, emailId);
+ notification_email.setEmailId(emailId);
+ }else {
+ notification_email = new Notification_Email();
+ }
+ notification_email.setExperiment_id(experimentId);
+ notification_email.setTaskId(taskId);
+ notification_email.setEmailAddress(emailAddress);
+ em.persist(notification_email);
+ emailId = notification_email.getEmailId();
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ProjectResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ProjectResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ProjectResource.java
new file mode 100644
index 0000000..687a8cb
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ProjectResource.java
@@ -0,0 +1,508 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.*;
+import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.apache.airavata.registry.cpi.ResultOrderType;
+import org.apache.airavata.registry.cpi.utils.Constants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ProjectResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ProjectResource.class);
+ private String name;
+ private String id;
+ private String gatewayId;
+ private WorkerResource worker;
+ private String description;
+ private Timestamp creationTime;
+
+ /**
+ *
+ */
+ public ProjectResource() {
+ }
+
+ /**
+ *
+ * @param type child resource type
+ * @return child resource
+ */
+ public Resource create(ResourceType type) throws RegistryException {
+ if (type == ResourceType.EXPERIMENT) {
+ ExperimentResource experimentResource = new ExperimentResource();
+ experimentResource.setGatewayId(gatewayId);
+ experimentResource.setExecutionUser(worker.getUser());
+ experimentResource.setProjectId(id);
+ return experimentResource;
+ } else if (type == ResourceType.PROJECT_USER){
+ ProjectUserResource pr = new ProjectUserResource();
+ pr.setProjectId(id);
+ pr.setUserName(worker.getUser());
+ return pr;
+ }
+ else {
+ logger.error("Unsupported resource type for project resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for project resource.");
+ }
+ }
+
+ /**
+ *
+ * @param type child resource type
+ * @param name child resource name
+ */
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (type == ResourceType.EXPERIMENT) {
+ QueryGenerator generator = new QueryGenerator(EXPERIMENT);
+ generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
+ Query q = generator.deleteQuery(em);
+ q.executeUpdate();
+ } else if (type == ResourceType.PROJECT_USER) {
+ QueryGenerator generator = new QueryGenerator(PROJECT_USER);
+ generator.setParameter(ProjectUserConstants.USERNAME, name);
+ generator.setParameter(ProjectUserConstants.PROJECT_ID, this.id);
+ Query q = generator.deleteQuery(em);
+ q.executeUpdate();
+ } else {
+ logger.error("Unsupported resource type for project resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for project resource.");
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ /**
+ *
+ * @param type child resource type
+ * @param name child resource name
+ * @return child resource
+ */
+ public Resource get(ResourceType type, Object name) throws RegistryException {
+ EntityManager em = null;
+ try {
+ if (type == ResourceType.EXPERIMENT) {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(EXPERIMENT);
+ generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
+ Query q = generator.selectQuery(em);
+ Experiment experiment = (Experiment) q.getSingleResult();
+ ExperimentResource experimentResource = (ExperimentResource)
+ Utils.getResource(ResourceType.EXPERIMENT, experiment);
+ em.getTransaction().commit();
+ em.close();
+ return experimentResource;
+ } else if (type == ResourceType.PROJECT_USER) {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(PROJECT_USER);
+ generator.setParameter(ProjectUserConstants.USERNAME, name);
+ generator.setParameter(ProjectUserConstants.PROJECT_ID, this.id);
+ Query q = generator.selectQuery(em);
+ ProjectUser prUser = (ProjectUser) q.getSingleResult();
+ ExperimentResource experimentResource = (ExperimentResource)
+ Utils.getResource(ResourceType.PROJECT_USER, prUser);
+ em.getTransaction().commit();
+ em.close();
+ return experimentResource;
+ } else {
+ logger.error("Unsupported resource type for project resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for project resource.");
+ }
+ } catch (Exception e) {
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ /**
+ *
+ * @param type child resource type
+ * @return list of child resources
+ */
+ @Override
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ List<Resource> resourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ if (type == ResourceType.EXPERIMENT) {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(EXPERIMENT);
+ generator.setParameter(ExperimentConstants.PROJECT_ID, id);
+ Query q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Experiment experiment = (Experiment) result;
+ ExperimentResource experimentResource = (ExperimentResource)
+ Utils.getResource(ResourceType.EXPERIMENT, experiment);
+ resourceList.add(experimentResource);
+ }
+ }
+ em.getTransaction().commit();
+ em.close();
+ } else if (type == ResourceType.PROJECT_USER) {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(PROJECT_USER);
+ generator.setParameter(ProjectUserConstants.PROJECT_ID, id);
+ Query q = generator.selectQuery(em);
+ List<?> results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ProjectUser projectUser = (ProjectUser) result;
+ ProjectUserResource pr = (ProjectUserResource)
+ Utils.getResource(ResourceType.PROJECT_USER, projectUser);
+ resourceList.add(pr);
+ }
+ }
+ em.getTransaction().commit();
+ em.close();
+ } else {
+ logger.error("Unsupported resource type for project resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for project resource.");
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return resourceList;
+ }
+
+ /**
+ * Get results with pagination and ordering
+ *
+ * @param type
+ * @param limit
+ * @param offset
+ * @param orderByIdentifier
+ * @return
+ * @throws RegistryException
+ */
+ public List<Resource> get(ResourceType type, int limit, int offset, Object orderByIdentifier,
+ ResultOrderType resultOrderType) throws RegistryException{
+ List<Resource> resourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ if (type == ResourceType.EXPERIMENT) {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(EXPERIMENT);
+ generator.setParameter(ExperimentConstants.PROJECT_ID, id);
+ Query q;
+ //ordering - supported only by CREATION_TIME
+ if(orderByIdentifier != null && resultOrderType != null
+ && orderByIdentifier.equals(Constants.FieldConstants.ExperimentConstants.CREATION_TIME)) {
+ q = generator.selectQuery(em, ExperimentConstants.CREATION_TIME, resultOrderType);
+ }else{
+ q = generator.selectQuery(em);
+ }
+
+ //pagination
+ if(limit>0 && offset>=0){
+ q.setFirstResult(offset);
+ q.setMaxResults(limit);
+ }
+ List<?> results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Experiment experiment = (Experiment) result;
+ ExperimentResource experimentResource = (ExperimentResource)
+ Utils.getResource(ResourceType.EXPERIMENT, experiment);
+ resourceList.add(experimentResource);
+ }
+ }
+ em.getTransaction().commit();
+ em.close();
+ } else if (type == ResourceType.PROJECT_USER) {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(PROJECT_USER);
+ generator.setParameter(ProjectUserConstants.PROJECT_ID, id);
+ Query q;
+ //ordering - only supported only by CREATION_TIME
+ if(orderByIdentifier != null && resultOrderType != null
+ && orderByIdentifier.equals(Constants.FieldConstants.ProjectConstants.CREATION_TIME)) {
+ q = generator.selectQuery(em, ProjectConstants.CREATION_TIME, resultOrderType);
+ }else{
+ q = generator.selectQuery(em);
+ }
+
+ //pagination
+ if(limit>0 && offset>=0){
+ q.setFirstResult(offset);
+ q.setMaxResults(limit);
+ }
+ List<?> results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ProjectUser projectUser = (ProjectUser) result;
+ ProjectUserResource pr = (ProjectUserResource)
+ Utils.getResource(ResourceType.PROJECT_USER, projectUser);
+ resourceList.add(pr);
+ }
+ }
+ em.getTransaction().commit();
+ em.close();
+ } else {
+ logger.error("Unsupported resource type for project resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for project resource.");
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return resourceList;
+ }
+
+ /**
+ * save project to the database
+ */
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ Project existingProject = em.find(Project.class, id);
+ em.close();
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Project project = new Project();
+ project.setProject_id(id);
+ project.setProject_name(name);
+ project.setGateway_id(gatewayId);
+ Users user = em.find(Users.class, worker.getUser());
+ project.setUsers(user);
+ project.setUser_name(user.getUser_name());
+ project.setDescription(description);
+ project.setCreationTime(creationTime);
+
+ if (existingProject != null) {
+ existingProject.setProject_name(name);
+ existingProject.setGateway_id(gatewayId);
+ existingProject.setUsers(user);
+ existingProject.setUser_name(user.getUser_name());
+ existingProject.setDescription(description);
+ existingProject.setCreationTime(creationTime);
+ project = em.merge(existingProject);
+ } else {
+ em.persist(project);
+ }
+
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ *
+ * @return project name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ *
+ * @param name project name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ *
+ * @return gateway worker
+ */
+ public WorkerResource getWorker() {
+ return worker;
+ }
+
+ /**
+ *
+ * @param worker gateway worker
+ */
+ public void setWorker(WorkerResource worker) {
+ this.worker = worker;
+ }
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ /**
+ *
+ * @param experimentId experiment ID
+ * @return whether the experiment exist
+ */
+ public boolean isExperimentExists(String experimentId) throws RegistryException{
+ return isExists(ResourceType.EXPERIMENT, experimentId);
+ }
+
+ /**
+ *
+ * @param experimentId experiment ID
+ * @return experiment resource
+ */
+ public ExperimentResource createExperiment(String experimentId) throws RegistryException{
+ ExperimentResource experimentResource = (ExperimentResource)create(ResourceType.EXPERIMENT);
+ experimentResource.setExpID(experimentId);
+ return experimentResource;
+ }
+
+ /**
+ *
+ * @param experimentId experiment ID
+ * @return experiment resource
+ */
+ public ExperimentResource getExperiment(String experimentId) throws RegistryException{
+ return (ExperimentResource)get(ResourceType.EXPERIMENT,experimentId);
+ }
+
+ /**
+ *
+ * @return list of experiments
+ */
+ public List<ExperimentResource> getExperiments() throws RegistryException{
+ List<Resource> list = get(ResourceType.EXPERIMENT);
+ List<ExperimentResource> result=new ArrayList<ExperimentResource>();
+ for (Resource resource : list) {
+ result.add((ExperimentResource) resource);
+ }
+ return result;
+ }
+
+ public List<ExperimentResource> getExperiments(int limit, int offset, Object orderByIdentifier,
+ ResultOrderType resultOrderType) throws RegistryException{
+ List<Resource> list = get(ResourceType.EXPERIMENT, limit, offset, orderByIdentifier, resultOrderType);
+ List<ExperimentResource> result=new ArrayList<ExperimentResource>();
+ for (Resource resource : list) {
+ result.add((ExperimentResource) resource);
+ }
+ return result;
+ }
+
+ /**
+ *
+ * @param experimentId experiment ID
+ */
+ public void removeExperiment(String experimentId) throws RegistryException{
+ remove(ResourceType.EXPERIMENT, experimentId);
+ }
+
+ public List<ProjectUserResource> getProjectUserList () throws RegistryException{
+ List<Resource> resources = get(ResourceType.PROJECT_USER);
+ List<ProjectUserResource> projectUserResources = new ArrayList<ProjectUserResource>();
+ if (resources != null && !resources.isEmpty()){
+ for (Resource r : resources){
+ projectUserResources.add((ProjectUserResource)r);
+ }
+ }
+ return projectUserResources;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ProjectUserResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ProjectUserResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ProjectUserResource.java
new file mode 100644
index 0000000..f272433
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ProjectUserResource.java
@@ -0,0 +1,123 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.*;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import java.util.List;
+
+public class ProjectUserResource extends AbstractResource {
+ private String projectId;
+ private String userName;
+
+ private static final Logger logger = LoggerFactory.getLogger(ProjectUserResource.class);
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+
+ public Resource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for project resource data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for project resource data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public Resource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for project resource data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for project resource data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ ProjectUser existingPrUser = em.find(ProjectUser.class, new ProjectUser_PK(projectId, userName));
+ em.close();
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ ProjectUser prUser = new ProjectUser();
+ prUser.setProjectID(projectId);
+ prUser.setUserName(userName);
+ Users user = em.find(Users.class, userName);
+ prUser.setUser(user);
+ Project project = em.find(Project.class, projectId);
+ prUser.setProject(project);
+
+ if (existingPrUser != null) {
+ existingPrUser.setProjectID(projectId);
+ existingPrUser.setUserName(userName);
+ existingPrUser.setUser(user);
+ existingPrUser.setProject(project);
+ prUser = em.merge(existingPrUser);
+ } else {
+ em.persist(prUser);
+ }
+
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/QosParamResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/QosParamResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/QosParamResource.java
new file mode 100644
index 0000000..1d00a5c
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/QosParamResource.java
@@ -0,0 +1,144 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.QosParam;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.airavata.registry.cpi.RegistryException;
+
+import javax.persistence.EntityManager;
+import java.util.List;
+
+public class QosParamResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(QosParamResource.class);
+ private int qosId;
+ private String experimentId;
+ private String taskId;
+ private String startExecutionAt;
+ private String executeBefore;
+ private int noOfRetries;
+
+ public int getQosId() {
+ return qosId;
+ }
+
+ public void setQosId(int qosId) {
+ this.qosId = qosId;
+ }
+
+ public String getExperimentId() {
+ return experimentId;
+ }
+
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getStartExecutionAt() {
+ return startExecutionAt;
+ }
+
+ public void setStartExecutionAt(String startExecutionAt) {
+ this.startExecutionAt = startExecutionAt;
+ }
+
+ public String getExecuteBefore() {
+ return executeBefore;
+ }
+
+ public void setExecuteBefore(String executeBefore) {
+ this.executeBefore = executeBefore;
+ }
+
+ public int getNoOfRetries() {
+ return noOfRetries;
+ }
+
+ public void setNoOfRetries(int noOfRetries) {
+ this.noOfRetries = noOfRetries;
+ }
+
+
+ public Resource create(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for qos params resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for qos params resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public Resource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for qos params resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for qos params resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QosParam qosParam = new QosParam();
+ qosParam.setTaskId(taskId);
+ qosParam.setExpId(experimentId);
+ qosParam.setStartExecutionAt(startExecutionAt);
+ qosParam.setExecuteBefore(executeBefore);
+ qosParam.setNoOfRetries(noOfRetries);
+ em.persist(qosParam);
+ qosId = qosParam.getQosId();
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/StatusResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/StatusResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/StatusResource.java
new file mode 100644
index 0000000..257b657
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/StatusResource.java
@@ -0,0 +1,181 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.airavata.registry.cpi.RegistryException;
+
+import javax.persistence.EntityManager;
+import java.sql.Timestamp;
+import java.util.List;
+
+public class StatusResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(StatusResource.class);
+ private int statusId = 0;
+ private String experimentId;
+ private String nodeId;
+ private String transferId;
+ private String taskId;
+ private String jobId;
+ private String state;
+ private Timestamp statusUpdateTime;
+ private String statusType;
+
+ public int getStatusId() {
+ return statusId;
+ }
+
+ public void setStatusId(int statusId) {
+ this.statusId = statusId;
+ }
+
+ public String getExperimentId() {
+ return experimentId;
+ }
+
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public String getTransferId() {
+ return transferId;
+ }
+
+ public void setTransferId(String transferId) {
+ this.transferId = transferId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public Timestamp getStatusUpdateTime() {
+ return statusUpdateTime;
+ }
+
+ public void setStatusUpdateTime(Timestamp statusUpdateTime) {
+ this.statusUpdateTime = statusUpdateTime;
+ }
+
+ public String getStatusType() {
+ return statusType;
+ }
+
+ public void setStatusType(String statusType) {
+ this.statusType = statusType;
+ }
+
+
+ public Resource create(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for status resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for status resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public Resource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for status resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for status resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Status status;
+ if (statusId != 0) {
+ status = em.find(Status.class, statusId);
+ status.setStatusId(statusId);
+ } else {
+ status = new Status();
+ }
+ status.setExpId(experimentId);
+ status.setTaskId(taskId);
+ status.setNodeId(nodeId);
+ status.setTransferId(transferId);
+ status.setJobId(jobId);
+ status.setState(state);
+ status.setStatusUpdateTime(statusUpdateTime);
+ status.setStatusType(statusType);
+ em.persist(status);
+ statusId = status.getStatusId();
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/TaskDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/TaskDetailResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/TaskDetailResource.java
new file mode 100644
index 0000000..5144fe2
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/TaskDetailResource.java
@@ -0,0 +1,748 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.*;
+import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.apache.airavata.registry.cpi.utils.StatusType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class TaskDetailResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(TaskDetailResource.class);
+ private String taskId;
+ private String nodeId;
+ private Timestamp creationTime;
+ private String applicationId;
+ private String applicationVersion;
+ private String applicationDeploymentId;
+ private boolean enableEmailNotifications;
+ private List<ApplicationInputResource> applicationInputs;
+ private List<ApplicationOutputResource> applicationOutputs;
+ private ComputationSchedulingResource schedulingResource;
+ private AdvanceInputDataHandlingResource inputDataHandlingResource;
+ private AdvancedOutputDataHandlingResource outputDataHandlingResource;
+ private StatusResource taskStatus;
+ private List<JobDetailResource> jobDetailResources;
+ private List<DataTransferDetailResource> transferDetailResourceList;
+ private List<NotificationEmailResource> emailResourceList;
+ private List<ErrorDetailResource> errors;
+
+ public List<JobDetailResource> getJobDetailResources() {
+ return jobDetailResources;
+ }
+
+ public void setJobDetailResources(List<JobDetailResource> jobDetailResources) {
+ this.jobDetailResources = jobDetailResources;
+ }
+
+ public void setApplicationInputs(List<ApplicationInputResource> applicationInputs) {
+ this.applicationInputs = applicationInputs;
+ }
+
+ public void setApplicationOutputs(List<ApplicationOutputResource> applicationOutputs) {
+ this.applicationOutputs = applicationOutputs;
+ }
+
+ public ComputationSchedulingResource getSchedulingResource() {
+ return schedulingResource;
+ }
+
+ public void setSchedulingResource(ComputationSchedulingResource schedulingResource) {
+ this.schedulingResource = schedulingResource;
+ }
+
+ public AdvanceInputDataHandlingResource getInputDataHandlingResource() {
+ return inputDataHandlingResource;
+ }
+
+ public void setInputDataHandlingResource(AdvanceInputDataHandlingResource inputDataHandlingResource) {
+ this.inputDataHandlingResource = inputDataHandlingResource;
+ }
+
+ public AdvancedOutputDataHandlingResource getOutputDataHandlingResource() {
+ return outputDataHandlingResource;
+ }
+
+ public void setOutputDataHandlingResource(AdvancedOutputDataHandlingResource outputDataHandlingResource) {
+ this.outputDataHandlingResource = outputDataHandlingResource;
+ }
+
+ public void setTaskStatus(StatusResource taskStatus) {
+ this.taskStatus = taskStatus;
+ }
+
+ public List<DataTransferDetailResource> getTransferDetailResourceList() {
+ return transferDetailResourceList;
+ }
+
+ public void setTransferDetailResourceList(List<DataTransferDetailResource> transferDetailResourceList) {
+ this.transferDetailResourceList = transferDetailResourceList;
+ }
+
+ public List<NotificationEmailResource> getEmailResourceList() {
+ return emailResourceList;
+ }
+
+ public void setEmailResourceList(List<NotificationEmailResource> emailResourceList) {
+ this.emailResourceList = emailResourceList;
+ }
+
+ public List<ErrorDetailResource> getErrors() {
+ return errors;
+ }
+
+ public void setErrors(List<ErrorDetailResource> errors) {
+ this.errors = errors;
+ }
+
+ public boolean isEnableEmailNotifications() {
+ return enableEmailNotifications;
+ }
+
+ public void setEnableEmailNotifications(boolean enableEmailNotifications) {
+ this.enableEmailNotifications = enableEmailNotifications;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getApplicationId() {
+ return applicationId;
+ }
+
+ public void setApplicationId(String applicationId) {
+ this.applicationId = applicationId;
+ }
+
+ public String getApplicationVersion() {
+ return applicationVersion;
+ }
+
+ public void setApplicationVersion(String applicationVersion) {
+ this.applicationVersion = applicationVersion;
+ }
+
+
+ public Resource create(ResourceType type) throws RegistryException{
+ switch (type){
+ case ERROR_DETAIL:
+ ErrorDetailResource errorDetailResource = new ErrorDetailResource();
+ errorDetailResource.setTaskId(taskId);
+ return errorDetailResource;
+ case NOTIFICATION_EMAIL:
+ NotificationEmailResource emailResource = new NotificationEmailResource();
+ emailResource.setTaskId(taskId);
+ return emailResource;
+ case APPLICATION_INPUT:
+ ApplicationInputResource applicationInputResource = new ApplicationInputResource();
+ applicationInputResource.setTaskId(taskId);
+ return applicationInputResource;
+ case APPLICATION_OUTPUT:
+ ApplicationOutputResource applicationOutputResource = new ApplicationOutputResource();
+ applicationOutputResource.setTaskId(taskId);
+ return applicationOutputResource;
+ case JOB_DETAIL:
+ JobDetailResource jobDetailResource = new JobDetailResource();
+ jobDetailResource.setTaskId(taskId);
+ return jobDetailResource;
+ case DATA_TRANSFER_DETAIL:
+ DataTransferDetailResource dataTransferDetailResource = new DataTransferDetailResource();
+ dataTransferDetailResource.setTaskId(taskId);
+ return dataTransferDetailResource;
+ case STATUS:
+ StatusResource statusResource = new StatusResource();
+ statusResource.setTaskId(taskId);
+ return statusResource;
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ ComputationSchedulingResource schedulingResource = new ComputationSchedulingResource();
+ schedulingResource.setTaskId(taskId);
+ return schedulingResource;
+ case ADVANCE_INPUT_DATA_HANDLING:
+ AdvanceInputDataHandlingResource inputDataHandlingResource = new AdvanceInputDataHandlingResource();
+ inputDataHandlingResource.setTaskId(taskId);
+ return inputDataHandlingResource;
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ AdvancedOutputDataHandlingResource outputDataHandlingResource = new AdvancedOutputDataHandlingResource();
+ outputDataHandlingResource.setTaskId(taskId);
+ return outputDataHandlingResource;
+ case QOS_PARAM:
+ QosParamResource qosParamResource = new QosParamResource();
+ qosParamResource.setTaskId(taskId);
+ return qosParamResource;
+ default:
+ logger.error("Unsupported resource type for task detail resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for task detail resource.");
+ }
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ switch (type) {
+ case ERROR_DETAIL:
+ generator = new QueryGenerator(ERROR_DETAIL);
+ generator.setParameter(ErrorDetailConstants.TASK_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case NOTIFICATION_EMAIL:
+ generator = new QueryGenerator(NOTIFICATION_EMAIL);
+ generator.setParameter(NotificationEmailConstants.TASK_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case APPLICATION_INPUT:
+ generator = new QueryGenerator(APPLICATION_INPUT);
+ generator.setParameter(ApplicationInputConstants.TASK_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case APPLICATION_OUTPUT:
+ generator = new QueryGenerator(APPLICATION_OUTPUT);
+ generator.setParameter(ApplicationOutputConstants.TASK_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case JOB_DETAIL:
+ generator = new QueryGenerator(JOB_DETAIL);
+ generator.setParameter(JobDetailConstants.TASK_ID, taskId);
+ generator.setParameter(JobDetailConstants.JOB_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case DATA_TRANSFER_DETAIL:
+ generator = new QueryGenerator(DATA_TRANSFER_DETAIL);
+ generator.setParameter(DataTransferDetailConstants.TRANSFER_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.TASK_ID, name);
+ generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.TASK.toString());
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ generator = new QueryGenerator(COMPUTATIONAL_RESOURCE_SCHEDULING);
+ generator.setParameter(ComputationalResourceSchedulingConstants.TASK_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case ADVANCE_INPUT_DATA_HANDLING:
+ generator = new QueryGenerator(ADVANCE_INPUT_DATA_HANDLING);
+ generator.setParameter(AdvancedInputDataHandlingConstants.TASK_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ generator = new QueryGenerator(ADVANCE_OUTPUT_DATA_HANDLING);
+ generator.setParameter(AdvancedOutputDataHandlingConstants.TASK_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case QOS_PARAM:
+ generator = new QueryGenerator(QOS_PARAMS);
+ generator.setParameter(QosParamsConstants.TASK_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ default:
+ logger.error("Unsupported resource type for task detail resource.", new IllegalArgumentException());
+ break;
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+
+ public Resource get(ResourceType type, Object name) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator;
+ Query q;
+ switch (type) {
+ case ERROR_DETAIL:
+ generator = new QueryGenerator(ERROR_DETAIL);
+ generator.setParameter(ErrorDetailConstants.TASK_ID, name);
+ q = generator.selectQuery(em);
+ ErrorDetail errorDetail = (ErrorDetail) q.getSingleResult();
+ ErrorDetailResource errorDetailResource = (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
+ em.getTransaction().commit();
+ em.close();
+ return errorDetailResource;
+ case NOTIFICATION_EMAIL:
+ generator = new QueryGenerator(NOTIFICATION_EMAIL);
+ generator.setParameter(NotificationEmailConstants.TASK_ID, name);
+ q = generator.selectQuery(em);
+ Notification_Email notificationEmail = (Notification_Email) q.getSingleResult();
+ NotificationEmailResource emailResource = (NotificationEmailResource) Utils.getResource(ResourceType.NOTIFICATION_EMAIL, notificationEmail);
+ em.getTransaction().commit();
+ em.close();
+ return emailResource;
+ case APPLICATION_INPUT:
+ generator = new QueryGenerator(APPLICATION_INPUT);
+ generator.setParameter(ApplicationInputConstants.TASK_ID, name);
+ q = generator.selectQuery(em);
+ ApplicationInput applicationInput = (ApplicationInput) q.getSingleResult();
+ ApplicationInputResource inputResource = (ApplicationInputResource) Utils.getResource(ResourceType.APPLICATION_INPUT, applicationInput);
+ em.getTransaction().commit();
+ em.close();
+ return inputResource;
+ case APPLICATION_OUTPUT:
+ generator = new QueryGenerator(APPLICATION_OUTPUT);
+ generator.setParameter(ApplicationOutputConstants.TASK_ID, name);
+ q = generator.selectQuery(em);
+ ApplicationOutput applicationOutput = (ApplicationOutput) q.getSingleResult();
+ ApplicationOutputResource outputResource = (ApplicationOutputResource) Utils.getResource(ResourceType.APPLICATION_OUTPUT, applicationOutput);
+ em.getTransaction().commit();
+ em.close();
+ return outputResource;
+ case JOB_DETAIL:
+ generator = new QueryGenerator(JOB_DETAIL);
+ generator.setParameter(JobDetailConstants.JOB_ID, name);
+ generator.setParameter(JobDetailConstants.TASK_ID, taskId);
+ q = generator.selectQuery(em);
+ JobDetail jobDetail = (JobDetail) q.getSingleResult();
+ JobDetailResource jobDetailResource = (JobDetailResource) Utils.getResource(ResourceType.JOB_DETAIL, jobDetail);
+ em.getTransaction().commit();
+ em.close();
+ return jobDetailResource;
+ case DATA_TRANSFER_DETAIL:
+ generator = new QueryGenerator(DATA_TRANSFER_DETAIL);
+ generator.setParameter(DataTransferDetailConstants.TRANSFER_ID, name);
+ q = generator.selectQuery(em);
+ DataTransferDetail transferDetail = (DataTransferDetail) q.getSingleResult();
+ DataTransferDetailResource transferDetailResource = (DataTransferDetailResource) Utils.getResource(ResourceType.DATA_TRANSFER_DETAIL, transferDetail);
+ em.getTransaction().commit();
+ em.close();
+ return transferDetailResource;
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.TASK_ID, name);
+ generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.TASK.toString());
+ q = generator.selectQuery(em);
+ Status status = (Status) q.getSingleResult();
+ StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
+ em.getTransaction().commit();
+ em.close();
+ return statusResource;
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ generator = new QueryGenerator(COMPUTATIONAL_RESOURCE_SCHEDULING);
+ generator.setParameter(ComputationalResourceSchedulingConstants.TASK_ID, name);
+ q = generator.selectQuery(em);
+ Computational_Resource_Scheduling resourceScheduling = (Computational_Resource_Scheduling) q.getSingleResult();
+ ComputationSchedulingResource schedulingResource = (ComputationSchedulingResource) Utils.getResource(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, resourceScheduling);
+ em.getTransaction().commit();
+ em.close();
+ return schedulingResource;
+ case ADVANCE_INPUT_DATA_HANDLING:
+ generator = new QueryGenerator(ADVANCE_INPUT_DATA_HANDLING);
+ generator.setParameter(AdvancedInputDataHandlingConstants.TASK_ID, name);
+ q = generator.selectQuery(em);
+ AdvancedInputDataHandling dataHandling = (AdvancedInputDataHandling) q.getSingleResult();
+ AdvanceInputDataHandlingResource inputDataHandlingResource = (AdvanceInputDataHandlingResource) Utils.getResource(ResourceType.ADVANCE_INPUT_DATA_HANDLING, dataHandling);
+ em.getTransaction().commit();
+ em.close();
+ return inputDataHandlingResource;
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ generator = new QueryGenerator(ADVANCE_OUTPUT_DATA_HANDLING);
+ generator.setParameter(AdvancedOutputDataHandlingConstants.TASK_ID, name);
+ q = generator.selectQuery(em);
+ AdvancedOutputDataHandling outputDataHandling = (AdvancedOutputDataHandling) q.getSingleResult();
+ AdvancedOutputDataHandlingResource outputDataHandlingResource = (AdvancedOutputDataHandlingResource) Utils.getResource(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, outputDataHandling);
+ em.getTransaction().commit();
+ em.close();
+ return outputDataHandlingResource;
+ case QOS_PARAM:
+ generator = new QueryGenerator(QOS_PARAMS);
+ generator.setParameter(QosParamsConstants.TASK_ID, name);
+ q = generator.selectQuery(em);
+ QosParam qosParam = (QosParam) q.getSingleResult();
+ QosParamResource qosParamResource = (QosParamResource) Utils.getResource(ResourceType.QOS_PARAM, qosParam);
+ em.getTransaction().commit();
+ em.close();
+ return qosParamResource;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for workflow node resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for workflow node resource.");
+ }
+ } catch (Exception e) {
+// logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ List<Resource> resourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ List results;
+ switch (type) {
+ case ERROR_DETAIL:
+ generator = new QueryGenerator(ERROR_DETAIL);
+ generator.setParameter(ErrorDetailConstants.TASK_ID, taskId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ErrorDetail errorDetail = (ErrorDetail) result;
+ ErrorDetailResource errorDetailResource =
+ (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
+ resourceList.add(errorDetailResource);
+ }
+ }
+ break;
+ case NOTIFICATION_EMAIL:
+ generator = new QueryGenerator(NOTIFICATION_EMAIL);
+ generator.setParameter(NotificationEmailConstants.TASK_ID, taskId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Notification_Email notificationEmail = (Notification_Email) result;
+ NotificationEmailResource emailResource =
+ (NotificationEmailResource) Utils.getResource(ResourceType.NOTIFICATION_EMAIL, notificationEmail);
+ resourceList.add(emailResource);
+ }
+ }
+ break;
+ case APPLICATION_INPUT:
+ generator = new QueryGenerator(APPLICATION_INPUT);
+ generator.setParameter(ApplicationInputConstants.TASK_ID, taskId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationInput applicationInput = (ApplicationInput) result;
+ ApplicationInputResource inputResource =
+ (ApplicationInputResource) Utils.getResource(ResourceType.APPLICATION_INPUT, applicationInput);
+ resourceList.add(inputResource);
+ }
+ }
+ break;
+ case APPLICATION_OUTPUT:
+ generator = new QueryGenerator(APPLICATION_OUTPUT);
+ generator.setParameter(ApplicationOutputConstants.TASK_ID, taskId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ApplicationOutput applicationOutput = (ApplicationOutput) result;
+ ApplicationOutputResource outputResource =
+ (ApplicationOutputResource) Utils.getResource(ResourceType.APPLICATION_OUTPUT, applicationOutput);
+ resourceList.add(outputResource);
+ }
+ }
+ break;
+ case JOB_DETAIL:
+ generator = new QueryGenerator(JOB_DETAIL);
+ generator.setParameter(JobDetailConstants.TASK_ID, taskId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ JobDetail jobDetail = (JobDetail) result;
+ JobDetailResource jobDetailResource =
+ (JobDetailResource) Utils.getResource(ResourceType.JOB_DETAIL, jobDetail);
+ resourceList.add(jobDetailResource);
+ }
+ }
+ break;
+ case DATA_TRANSFER_DETAIL:
+ generator = new QueryGenerator(DATA_TRANSFER_DETAIL);
+ generator.setParameter(DataTransferDetailConstants.TASK_ID, taskId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ DataTransferDetail transferDetail = (DataTransferDetail) result;
+ DataTransferDetailResource transferDetailResource =
+ (DataTransferDetailResource) Utils.getResource(ResourceType.DATA_TRANSFER_DETAIL, transferDetail);
+ resourceList.add(transferDetailResource);
+ }
+ }
+ break;
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.TASK_ID, taskId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Status status = (Status) result;
+ StatusResource statusResource =
+ (StatusResource) Utils.getResource(ResourceType.STATUS, status);
+ resourceList.add(statusResource);
+ }
+ }
+ break;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for workflow node details resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return resourceList;
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ TaskDetail taskDetail = em.find(TaskDetail.class, taskId);
+ em.close();
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ if (taskDetail != null) {
+ updateTaskDetail(taskDetail, nodeId);
+ em.merge(taskDetail);
+ } else {
+ taskDetail = new TaskDetail();
+ updateTaskDetail(taskDetail, nodeId);
+ em.persist(taskDetail);
+ }
+ em.getTransaction().commit();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ private void updateTaskDetail(TaskDetail taskDetail, String nodeId) {
+ taskDetail.setTaskId(taskId);
+ taskDetail.setNodeId(nodeId);
+ taskDetail.setCreationTime(creationTime);
+ taskDetail.setAppId(applicationId);
+ taskDetail.setAppVersion(applicationVersion);
+ taskDetail.setAllowNotification(enableEmailNotifications);
+ taskDetail.setApplicationDeploymentId(getApplicationDeploymentId());
+ }
+
+ public List<ApplicationInputResource> getApplicationInputs() {
+ return applicationInputs;
+ }
+
+ public List<ApplicationOutputResource> getApplicationOutputs() {
+ return applicationOutputs;
+ }
+
+ public List<ApplicationInputResource> getApplicationInputs1() throws RegistryException{
+ List<ApplicationInputResource> applicationInputResources = new ArrayList<ApplicationInputResource>();
+ List<Resource> resources = get(ResourceType.APPLICATION_INPUT);
+ for (Resource resource : resources) {
+ ApplicationInputResource inputResource = (ApplicationInputResource) resource;
+ applicationInputResources.add(inputResource);
+ }
+ return applicationInputResources;
+ }
+
+ public List<ApplicationOutputResource> getApplicationOutputs1() throws RegistryException{
+ List<ApplicationOutputResource> outputResources = new ArrayList<ApplicationOutputResource>();
+ List<Resource> resources = get(ResourceType.APPLICATION_OUTPUT);
+ for (Resource resource : resources) {
+ ApplicationOutputResource outputResource = (ApplicationOutputResource) resource;
+ outputResources.add(outputResource);
+ }
+ return outputResources;
+ }
+
+ public StatusResource getTaskStatus() {
+ return taskStatus;
+ }
+
+ public StatusResource getTaskStatus1() throws RegistryException{
+ List<Resource> resources = get(ResourceType.STATUS);
+ for (Resource resource : resources) {
+ StatusResource taskStatus = (StatusResource) resource;
+ if(taskStatus.getStatusType().equals(StatusType.TASK.toString())){
+ if (taskStatus.getState() == null || taskStatus.getState().equals("") ){
+ taskStatus.setState("UNKNOWN");
+ }
+ return taskStatus;
+ }
+ }
+ return null;
+ }
+
+ public List<JobDetailResource> getJobDetailList() throws RegistryException{
+ List<JobDetailResource> jobDetailResources = new ArrayList<JobDetailResource>();
+ List<Resource> resources = get(ResourceType.JOB_DETAIL);
+ for (Resource resource : resources) {
+ JobDetailResource jobDetailResource = (JobDetailResource) resource;
+ jobDetailResources.add(jobDetailResource);
+ }
+ return jobDetailResources;
+ }
+
+ public List<DataTransferDetailResource> getDataTransferDetailList() throws RegistryException{
+ List<DataTransferDetailResource> transferDetails = new ArrayList<DataTransferDetailResource>();
+ List<Resource> resources = get(ResourceType.DATA_TRANSFER_DETAIL);
+ for (Resource resource : resources) {
+ DataTransferDetailResource transferDetailResource = (DataTransferDetailResource) resource;
+ transferDetails.add(transferDetailResource);
+ }
+ return transferDetails;
+ }
+
+ public List<ErrorDetailResource> getErrorDetailList() throws RegistryException{
+ List<ErrorDetailResource> errorDetailResources = new ArrayList<ErrorDetailResource>();
+ List<Resource> resources = get(ResourceType.ERROR_DETAIL);
+ for (Resource resource : resources) {
+ ErrorDetailResource errorDetailResource = (ErrorDetailResource) resource;
+ errorDetailResources.add(errorDetailResource);
+ }
+ return errorDetailResources;
+ }
+
+ public ComputationSchedulingResource getComputationScheduling (String taskId) throws RegistryException{
+ return (ComputationSchedulingResource)get(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, taskId);
+ }
+
+ public AdvanceInputDataHandlingResource getInputDataHandling (String taskId) throws RegistryException{
+ return (AdvanceInputDataHandlingResource)get(ResourceType.ADVANCE_INPUT_DATA_HANDLING, taskId);
+ }
+
+ public AdvancedOutputDataHandlingResource getOutputDataHandling (String taskId) throws RegistryException{
+ return (AdvancedOutputDataHandlingResource)get(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, taskId);
+ }
+
+ public JobDetailResource createJobDetail (String jobId) throws RegistryException{
+ JobDetailResource resource = (JobDetailResource)create(ResourceType.JOB_DETAIL);
+ resource.setJobId(jobId);
+ return resource;
+ }
+
+ public JobDetailResource getJobDetail (String jobId) throws RegistryException{
+ return (JobDetailResource)get(ResourceType.JOB_DETAIL, jobId);
+ }
+
+ public DataTransferDetailResource getDataTransferDetail (String dataTransferId) throws RegistryException{
+ return (DataTransferDetailResource)get(ResourceType.DATA_TRANSFER_DETAIL, dataTransferId);
+ }
+
+ public boolean isTaskStatusExist (String taskId) throws RegistryException{
+ return isExists(ResourceType.STATUS, taskId);
+ }
+
+ public String getApplicationDeploymentId() {
+ return applicationDeploymentId;
+ }
+
+ public void setApplicationDeploymentId(String applicationDeploymentId) {
+ this.applicationDeploymentId = applicationDeploymentId;
+ }
+
+ public List<NotificationEmailResource> getNotificationEmails () throws RegistryException{
+ List<NotificationEmailResource> emailResources = new ArrayList<NotificationEmailResource>();
+ List<Resource> resources = get(ResourceType.NOTIFICATION_EMAIL);
+ for (Resource resource : resources) {
+ emailResources.add((NotificationEmailResource) resource);
+ }
+ return emailResources;
+ }
+}
[18/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
deleted file mode 100644
index 024ab2c..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
+++ /dev/null
@@ -1,831 +0,0 @@
-/*
-*
-* 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.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-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.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.*;
-import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.utils.StatusType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ExperimentResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(ExperimentResource.class);
-// private WorkerResource worker;
- private String executionUser;
- private String expID;
- private Timestamp creationTime;
- private String gatewayId;
- private String projectId;
- private String expName;
- private String description;
- private String applicationId;
- private String applicationVersion;
- private String workflowTemplateId;
- private String workflowTemplateVersion;
- private String workflowExecutionId;
- private boolean enableEmailNotifications;
- private String gatewayExecutionId;
- private List<ExperimentInputResource> experimentInputResources;
- private List<ExperimentOutputResource> experimentOutputputResources;
- private ComputationSchedulingResource computationSchedulingResource;
- private ConfigDataResource userConfigDataResource;
- private List<WorkflowNodeDetailResource> workflowNodeDetailResourceList;
- private List<StatusResource> stateChangeList;
- private List<ErrorDetailResource> errorDetailList;
- private StatusResource experimentStatus;
- private List<NotificationEmailResource> emailResourceList;
-
- /**
- *
- * @return experiment ID
- */
- public String getExpID() {
- return expID;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getExpName() {
- return expName;
- }
-
- public void setExpName(String expName) {
- this.expName = expName;
- }
-
- public String getApplicationId() {
- return applicationId;
- }
-
- public void setApplicationId(String applicationId) {
- this.applicationId = applicationId;
- }
-
- public String getApplicationVersion() {
- return applicationVersion;
- }
-
- public void setApplicationVersion(String applicationVersion) {
- this.applicationVersion = applicationVersion;
- }
-
- public String getWorkflowTemplateId() {
- return workflowTemplateId;
- }
-
- public void setWorkflowTemplateId(String workflowTemplateId) {
- this.workflowTemplateId = workflowTemplateId;
- }
-
- public String getWorkflowTemplateVersion() {
- return workflowTemplateVersion;
- }
-
- public void setWorkflowTemplateVersion(String workflowTemplateVersion) {
- this.workflowTemplateVersion = workflowTemplateVersion;
- }
-
- public String getWorkflowExecutionId() {
- return workflowExecutionId;
- }
-
- public void setWorkflowExecutionId(String workflowExecutionId) {
- this.workflowExecutionId = workflowExecutionId;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public boolean isEnableEmailNotifications() {
- return enableEmailNotifications;
- }
-
- public void setEnableEmailNotifications(boolean enableEmailNotifications) {
- this.enableEmailNotifications = enableEmailNotifications;
- }
-
- public String getGatewayExecutionId() {
- return gatewayExecutionId;
- }
-
- public void setGatewayExecutionId(String gatewayExecutionId) {
- this.gatewayExecutionId = gatewayExecutionId;
- }
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public String getProjectId() {
- return projectId;
- }
-
- public void setProjectId(String projectId) {
- this.projectId = projectId;
- }
-
- public List<ExperimentInputResource> getExperimentInputResources() {
- return experimentInputResources;
- }
-
- public void setExperimentInputResources(List<ExperimentInputResource> experimentInputResources) {
- this.experimentInputResources = experimentInputResources;
- }
-
- public List<ExperimentOutputResource> getExperimentOutputputResources() {
- return experimentOutputputResources;
- }
-
- public void setExperimentOutputputResources(List<ExperimentOutputResource> experimentOutputputResources) {
- this.experimentOutputputResources = experimentOutputputResources;
- }
-
- public ComputationSchedulingResource getComputationSchedulingResource() {
- return computationSchedulingResource;
- }
-
- public void setComputationSchedulingResource(ComputationSchedulingResource computationSchedulingResource) {
- this.computationSchedulingResource = computationSchedulingResource;
- }
-
- public ConfigDataResource getUserConfigDataResource() {
- return userConfigDataResource;
- }
-
- public void setUserConfigDataResource(ConfigDataResource userConfigDataResource) {
- this.userConfigDataResource = userConfigDataResource;
- }
-
- public List<WorkflowNodeDetailResource> getWorkflowNodeDetailResourceList() {
- return workflowNodeDetailResourceList;
- }
-
- public void setWorkflowNodeDetailResourceList(List<WorkflowNodeDetailResource> workflowNodeDetailResourceList) {
- this.workflowNodeDetailResourceList = workflowNodeDetailResourceList;
- }
-
- public List<StatusResource> getStateChangeList() {
- return stateChangeList;
- }
-
- public void setStateChangeList(List<StatusResource> stateChangeList) {
- this.stateChangeList = stateChangeList;
- }
-
- public List<ErrorDetailResource> getErrorDetailList() {
- return errorDetailList;
- }
-
- public void setErrorDetailList(List<ErrorDetailResource> errorDetailList) {
- this.errorDetailList = errorDetailList;
- }
-
- public void setExperimentStatus(StatusResource experimentStatus) {
- this.experimentStatus = experimentStatus;
- }
-
- public List<NotificationEmailResource> getEmailResourceList() {
- return emailResourceList;
- }
-
- public void setEmailResourceList(List<NotificationEmailResource> emailResourceList) {
- this.emailResourceList = emailResourceList;
- }
-
-
- /**
- * Since experiments are at the leaf level, this method is not
- * valid for an experiment
- * @param type child resource types
- * @return UnsupportedOperationException
- */
- public Resource create(ResourceType type) throws RegistryException {
- switch (type){
- case EXPERIMENT_INPUT:
- ExperimentInputResource inputResource = new ExperimentInputResource();
- inputResource.setExperimentId(expID);
- return inputResource;
- case EXPERIMENT_OUTPUT:
- ExperimentOutputResource experimentOutputResource = new ExperimentOutputResource();
- experimentOutputResource.setExperimentId(expID);
- return experimentOutputResource;
- case NOTIFICATION_EMAIL:
- NotificationEmailResource emailResource = new NotificationEmailResource();
- emailResource.setExperimentId(expID);
- return emailResource;
- case WORKFLOW_NODE_DETAIL:
- WorkflowNodeDetailResource nodeDetailResource = new WorkflowNodeDetailResource();
- nodeDetailResource.setExperimentId(expID);
- return nodeDetailResource;
- case ERROR_DETAIL:
- ErrorDetailResource errorDetailResource = new ErrorDetailResource();
- errorDetailResource.setExperimentId(expID);
- return errorDetailResource;
- case STATUS:
- StatusResource statusResource = new StatusResource();
- statusResource.setExperimentId(expID);
- return statusResource;
- case CONFIG_DATA:
- ConfigDataResource configDataResource = new ConfigDataResource();
- configDataResource.setExperimentId(expID);
- return configDataResource;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- ComputationSchedulingResource schedulingResource = new ComputationSchedulingResource();
- schedulingResource.setExperimentId(expID);
- return schedulingResource;
- case ADVANCE_INPUT_DATA_HANDLING:
- AdvanceInputDataHandlingResource dataHandlingResource = new AdvanceInputDataHandlingResource();
- dataHandlingResource.setExperimentId(expID);
- return dataHandlingResource;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- AdvancedOutputDataHandlingResource outputDataHandlingResource = new AdvancedOutputDataHandlingResource();
- outputDataHandlingResource.setExperimentId(expID);
- return outputDataHandlingResource;
- case QOS_PARAM:
- QosParamResource qosParamResource = new QosParamResource();
- qosParamResource.setExperimentId(expID);
- return qosParamResource;
- default:
- logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for experiment resource.");
- }
- }
-
- /**
- *
- * @param type child resource types
- * @param name name of the child resource
- * @return UnsupportedOperationException
- */
- public void remove(ResourceType type, Object name) throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- switch (type) {
- case EXPERIMENT_INPUT:
- generator = new QueryGenerator(EXPERIMENT_INPUT);
- generator.setParameter(ExperimentInputConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case EXPERIMENT_OUTPUT:
- generator = new QueryGenerator(EXPERIMENT_OUTPUT);
- generator.setParameter(ExperimentOutputConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case NOTIFICATION_EMAIL:
- generator = new QueryGenerator(NOTIFICATION_EMAIL);
- generator.setParameter(NotificationEmailConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case WORKFLOW_NODE_DETAIL:
- generator = new QueryGenerator(WORKFLOW_NODE_DETAIL);
- generator.setParameter(WorkflowNodeDetailsConstants.NODE_INSTANCE_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.EXPERIMENT_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.EXPERIMENT.toString());
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case CONFIG_DATA:
- generator = new QueryGenerator(CONFIG_DATA);
- generator.setParameter(ExperimentConfigurationDataConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- generator = new QueryGenerator(COMPUTATIONAL_RESOURCE_SCHEDULING);
- generator.setParameter(ComputationalResourceSchedulingConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ADVANCE_INPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_INPUT_DATA_HANDLING);
- generator.setParameter(AdvancedInputDataHandlingConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_OUTPUT_DATA_HANDLING);
- generator.setParameter(AdvancedOutputDataHandlingConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case QOS_PARAM:
- generator = new QueryGenerator(QOS_PARAMS);
- generator.setParameter(QosParamsConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- default:
- logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @param type child resource types
- * @param name name of the child resource
- * @return UnsupportedOperationException
- */
- public Resource get(ResourceType type, Object name) throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case EXPERIMENT_INPUT:
- generator = new QueryGenerator(EXPERIMENT_INPUT);
- generator.setParameter(ExperimentInputConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- Experiment_Input experimentInput = (Experiment_Input) q.getSingleResult();
- ExperimentInputResource inputResource = (ExperimentInputResource) Utils.getResource(ResourceType.EXPERIMENT_INPUT, experimentInput);
- em.getTransaction().commit();
- em.close();
- return inputResource;
- case EXPERIMENT_OUTPUT:
- generator = new QueryGenerator(EXPERIMENT_OUTPUT);
- generator.setParameter(ExperimentOutputConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- Experiment_Output experimentOutput = (Experiment_Output) q.getSingleResult();
- ExperimentOutputResource outputResource = (ExperimentOutputResource) Utils.getResource(ResourceType.EXPERIMENT_OUTPUT, experimentOutput);
- em.getTransaction().commit();
- em.close();
- return outputResource;
- case NOTIFICATION_EMAIL:
- generator = new QueryGenerator(NOTIFICATION_EMAIL);
- generator.setParameter(NotificationEmailConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- Notification_Email notificationEmail = (Notification_Email) q.getSingleResult();
- NotificationEmailResource notificationEmailResource = (NotificationEmailResource) Utils.getResource(ResourceType.NOTIFICATION_EMAIL, notificationEmail);
- em.getTransaction().commit();
- em.close();
- return notificationEmailResource;
- case WORKFLOW_NODE_DETAIL:
- generator = new QueryGenerator(WORKFLOW_NODE_DETAIL);
- generator.setParameter(WorkflowNodeDetailsConstants.NODE_INSTANCE_ID, name);
- q = generator.selectQuery(em);
- WorkflowNodeDetail workflowNodeDetail = (WorkflowNodeDetail) q.getSingleResult();
- WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) Utils.getResource(ResourceType.WORKFLOW_NODE_DETAIL, workflowNodeDetail);
- em.getTransaction().commit();
- em.close();
- return nodeDetailResource;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- ErrorDetail errorDetail = (ErrorDetail) q.getSingleResult();
- ErrorDetailResource errorDetailResource = (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- em.getTransaction().commit();
- em.close();
- return errorDetailResource;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.EXPERIMENT_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.EXPERIMENT.toString());
- q = generator.selectQuery(em);
- Status status = (Status) q.getSingleResult();
- StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- em.getTransaction().commit();
- em.close();
- return statusResource;
- case CONFIG_DATA:
- generator = new QueryGenerator(CONFIG_DATA);
- generator.setParameter(ExperimentConfigurationDataConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- ExperimentConfigData configData = (ExperimentConfigData) q.getSingleResult();
- ConfigDataResource configDataResource = (ConfigDataResource) Utils.getResource(ResourceType.CONFIG_DATA, configData);
- em.getTransaction().commit();
- em.close();
- return configDataResource;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- generator = new QueryGenerator(COMPUTATIONAL_RESOURCE_SCHEDULING);
- generator.setParameter(ComputationalResourceSchedulingConstants.EXPERIMENT_ID, name);
- generator.setParameter(ComputationalResourceSchedulingConstants.TASK_ID, null);
- q = generator.selectQuery(em);
- Computational_Resource_Scheduling scheduling = (Computational_Resource_Scheduling) q.getSingleResult();
- ComputationSchedulingResource schedulingResource = (ComputationSchedulingResource) Utils.getResource(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, scheduling);
- em.getTransaction().commit();
- em.close();
- return schedulingResource;
- case ADVANCE_INPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_INPUT_DATA_HANDLING);
- generator.setParameter(AdvancedInputDataHandlingConstants.EXPERIMENT_ID, name);
- generator.setParameter(AdvancedInputDataHandlingConstants.TASK_ID, null);
- q = generator.selectQuery(em);
- AdvancedInputDataHandling inputDataHandling = (AdvancedInputDataHandling) q.getSingleResult();
- AdvanceInputDataHandlingResource dataHandlingResource = (AdvanceInputDataHandlingResource) Utils.getResource(ResourceType.ADVANCE_INPUT_DATA_HANDLING, inputDataHandling);
- em.getTransaction().commit();
- em.close();
- return dataHandlingResource;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_OUTPUT_DATA_HANDLING);
- generator.setParameter(AdvancedOutputDataHandlingConstants.EXPERIMENT_ID, name);
- generator.setParameter(AdvancedOutputDataHandlingConstants.TASK_ID, null);
- q = generator.selectQuery(em);
- AdvancedOutputDataHandling outputDataHandling = (AdvancedOutputDataHandling) q.getSingleResult();
- AdvancedOutputDataHandlingResource outputDataHandlingResource = (AdvancedOutputDataHandlingResource) Utils.getResource(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, outputDataHandling);
- em.getTransaction().commit();
- em.close();
- return outputDataHandlingResource;
- case QOS_PARAM:
- generator = new QueryGenerator(QOS_PARAMS);
- generator.setParameter(QosParamsConstants.EXPERIMENT_ID, name);
- generator.setParameter(QosParamsConstants.TASK_ID, null);
- q = generator.selectQuery(em);
- QosParam qosParam = (QosParam) q.getSingleResult();
- QosParamResource qosParamResource = (QosParamResource) Utils.getResource(ResourceType.QOS_PARAM, qosParam);
- em.getTransaction().commit();
- em.close();
- return qosParamResource;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for experiment data resource.");
- }
- } catch (Exception e) {
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
- }
-
- /**
- *
- * @param type child resource types
- * @return UnsupportedOperationException
- */
- public List<Resource> get(ResourceType type) throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- List results;
- switch (type) {
- case EXPERIMENT_INPUT:
- generator = new QueryGenerator(EXPERIMENT_INPUT);
- generator.setParameter(ExperimentInputConstants.EXPERIMENT_ID, expID);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Experiment_Input exInput = (Experiment_Input) result;
- ExperimentInputResource inputResource =
- (ExperimentInputResource) Utils.getResource(ResourceType.EXPERIMENT_INPUT, exInput);
- resourceList.add(inputResource);
- }
- }
- break;
- case EXPERIMENT_OUTPUT:
- generator = new QueryGenerator(EXPERIMENT_OUTPUT);
- generator.setParameter(ExperimentOutputConstants.EXPERIMENT_ID, expID);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Experiment_Output output = (Experiment_Output) result;
- ExperimentOutputResource outputResource =
- (ExperimentOutputResource) Utils.getResource(ResourceType.EXPERIMENT_OUTPUT, output);
- resourceList.add(outputResource);
- }
- }
- break;
- case NOTIFICATION_EMAIL:
- generator = new QueryGenerator(NOTIFICATION_EMAIL);
- generator.setParameter(NotificationEmailConstants.EXPERIMENT_ID, expID);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Notification_Email notificationEmail = (Notification_Email) result;
- NotificationEmailResource emailResource =
- (NotificationEmailResource) Utils.getResource(ResourceType.NOTIFICATION_EMAIL, notificationEmail);
- resourceList.add(emailResource);
- }
- }
- break;
- case WORKFLOW_NODE_DETAIL:
- generator = new QueryGenerator(WORKFLOW_NODE_DETAIL);
- generator.setParameter(WorkflowNodeDetailsConstants.EXPERIMENT_ID, expID);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowNodeDetail nodeDetail = (WorkflowNodeDetail) result;
- WorkflowNodeDetailResource nodeDetailResource =
- (WorkflowNodeDetailResource) Utils.getResource(ResourceType.WORKFLOW_NODE_DETAIL, nodeDetail);
- resourceList.add(nodeDetailResource);
- }
- }
- break;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.EXPERIMENT_ID, expID);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ErrorDetail errorDetail = (ErrorDetail) result;
- ErrorDetailResource errorDetailResource =
- (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- resourceList.add(errorDetailResource);
- }
- }
- break;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.EXPERIMENT_ID, expID);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Status status = (Status) result;
- StatusResource statusResource =
- (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- resourceList.add(statusResource);
- }
- }
- break;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for experiment resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- /**
- * save experiment
- */
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- Experiment existingExp = em.find(Experiment.class, expID);
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Experiment experiment = new Experiment();
- experiment.setProjectID(projectId);
- experiment.setExpId(expID);
- experiment.setExecutionUser(executionUser);
- experiment.setExecutionUser(executionUser);
- experiment.setGatewayId(gatewayId);
- experiment.setCreationTime(creationTime);
- experiment.setExpName(expName);
- experiment.setExpDesc(description);
- experiment.setApplicationId(applicationId);
- experiment.setAppVersion(applicationVersion);
- experiment.setWorkflowExecutionId(workflowExecutionId);
- experiment.setWorkflowTemplateVersion(workflowTemplateVersion);
- experiment.setWorkflowExecutionId(workflowExecutionId);
- experiment.setAllowNotification(enableEmailNotifications);
- experiment.setGatewayExecutionId(gatewayExecutionId);
- if (existingExp != null) {
- existingExp.setGatewayId(gatewayId);
- existingExp.setExecutionUser(executionUser);
- existingExp.setProjectID(projectId);
- existingExp.setCreationTime(creationTime);
- existingExp.setExpName(expName);
- existingExp.setExpDesc(description);
- existingExp.setApplicationId(applicationId);
- existingExp.setAppVersion(applicationVersion);
- existingExp.setWorkflowExecutionId(workflowExecutionId);
- existingExp.setWorkflowTemplateVersion(workflowTemplateVersion);
- existingExp.setWorkflowExecutionId(workflowExecutionId);
- existingExp.setAllowNotification(enableEmailNotifications);
- existingExp.setGatewayExecutionId(gatewayExecutionId);
- experiment = em.merge(existingExp);
- } else {
- em.persist(experiment);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @param expID experiment ID
- */
- public void setExpID(String expID) {
- this.expID = expID;
- }
-
- public String getExecutionUser() {
- return executionUser;
- }
-
- public void setExecutionUser(String executionUser) {
- this.executionUser = executionUser;
- }
-
- public List<NotificationEmailResource> getNotificationEmails () throws RegistryException{
- List<NotificationEmailResource> emailResources = new ArrayList<NotificationEmailResource>();
- List<Resource> resources = get(ResourceType.NOTIFICATION_EMAIL);
- for (Resource resource : resources) {
- emailResources.add((NotificationEmailResource) resource);
- }
- return emailResources;
- }
-
- public List<ExperimentInputResource> getExperimentInputs () throws RegistryException{
- List<ExperimentInputResource> expInputs = new ArrayList<ExperimentInputResource>();
- List<Resource> resources = get(ResourceType.EXPERIMENT_INPUT);
- for (Resource resource : resources) {
- expInputs.add((ExperimentInputResource) resource);
- }
- return expInputs;
- }
-
- public List<ExperimentOutputResource> getExperimentOutputs () throws RegistryException{
- List<ExperimentOutputResource> expOutputs = new ArrayList<ExperimentOutputResource>();
- List<Resource> resources = get(ResourceType.EXPERIMENT_OUTPUT);
- for (Resource resource : resources) {
- expOutputs.add((ExperimentOutputResource) resource);
- }
- return expOutputs;
- }
-
- public StatusResource getExperimentStatus() throws RegistryException{
- List<Resource> resources = get(ResourceType.STATUS);
- for (Resource resource : resources) {
- StatusResource expStatus = (StatusResource) resource;
- if(expStatus.getStatusType().equals(StatusType.EXPERIMENT.toString())){
- if (expStatus.getState() == null || expStatus.getState().equals("") ){
- expStatus.setState("UNKNOWN");
- }
- return expStatus;
- }
- }
- return null;
- }
-
- public List<StatusResource> getWorkflowNodeStatuses() throws RegistryException{
- List<StatusResource> statuses = new ArrayList<StatusResource>();
- List<Resource> resources = get(ResourceType.STATUS);
- for (Resource resource : resources) {
- StatusResource workflowNodeStatus = (StatusResource) resource;
- if(workflowNodeStatus.getStatusType().equals(StatusType.WORKFLOW_NODE.toString())){
- if (workflowNodeStatus.getState() == null || workflowNodeStatus.getState().equals("")){
- workflowNodeStatus.setState("UNKNOWN");
- }
- statuses.add(workflowNodeStatus);
- }
- }
- return statuses;
- }
-
- public List<WorkflowNodeDetailResource> getWorkflowNodeDetails () throws RegistryException{
- List<WorkflowNodeDetailResource> workflowNodeDetailResourceList = new ArrayList<WorkflowNodeDetailResource>();
- List<Resource> resources = get(ResourceType.WORKFLOW_NODE_DETAIL);
- for (Resource resource : resources) {
- WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) resource;
- workflowNodeDetailResourceList.add(nodeDetailResource);
- }
- return workflowNodeDetailResourceList;
- }
-
- public List<ErrorDetailResource> getErrorDetails () throws RegistryException{
- List<ErrorDetailResource> errorDetailResources = new ArrayList<ErrorDetailResource>();
- List<Resource> resources = get(ResourceType.ERROR_DETAIL);
- for (Resource resource : resources) {
- ErrorDetailResource errorDetailResource = (ErrorDetailResource) resource;
- errorDetailResources.add(errorDetailResource);
- }
- return errorDetailResources;
- }
-
- public ComputationSchedulingResource getComputationScheduling (String expId) throws RegistryException{
- return (ComputationSchedulingResource)get(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, expId);
- }
-
- public AdvanceInputDataHandlingResource getInputDataHandling (String expId) throws RegistryException{
- return (AdvanceInputDataHandlingResource)get(ResourceType.ADVANCE_INPUT_DATA_HANDLING, expId);
- }
-
- public AdvancedOutputDataHandlingResource getOutputDataHandling (String expId) throws RegistryException{
- return (AdvancedOutputDataHandlingResource)get(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, expId);
- }
-
- public QosParamResource getQOSparams (String expId) throws RegistryException{
- return (QosParamResource)get(ResourceType.QOS_PARAM, expId);
- }
-
- public ConfigDataResource getUserConfigData(String expID) throws RegistryException{
- return (ConfigDataResource)get(ResourceType.CONFIG_DATA, expID);
- }
- public WorkflowNodeDetailResource getWorkflowNode (String nodeId) throws RegistryException{
- return (WorkflowNodeDetailResource)get(ResourceType.WORKFLOW_NODE_DETAIL, nodeId);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentSummaryResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentSummaryResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentSummaryResource.java
deleted file mode 100644
index fe4fbd0..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentSummaryResource.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.el.MethodNotFoundException;
-import java.sql.Timestamp;
-import java.util.List;
-
-public class ExperimentSummaryResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ExperimentSummaryResource.class);
-
- private String executionUser;
- private String expID;
- private String projectID;
- private Timestamp creationTime;
- private String expName;
- private String description;
- private String applicationId;
-
- private StatusResource status;
-
- @Override
- public Resource create(ResourceType type) throws RegistryException {
- throw new MethodNotFoundException();
- }
-
- @Override
- public void remove(ResourceType type, Object name) throws RegistryException {
- throw new MethodNotFoundException();
- }
-
- @Override
- public Resource get(ResourceType type, Object name) throws RegistryException {
- throw new MethodNotFoundException();
- }
-
- @Override
- public List<Resource> get(ResourceType type) throws RegistryException {
- throw new MethodNotFoundException();
- }
-
- @Override
- public void save() throws RegistryException {
- throw new MethodNotFoundException();
- }
-
- public String getExecutionUser() {
- return executionUser;
- }
-
- public void setExecutionUser(String executionUser) {
- this.executionUser = executionUser;
- }
-
- public String getExpID() {
- return expID;
- }
-
- public void setExpID(String expID) {
- this.expID = expID;
- }
-
- public String getProjectID() {
- return projectID;
- }
-
- public void setProjectID(String projectID) {
- this.projectID = projectID;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getExpName() {
- return expName;
- }
-
- public void setExpName(String expName) {
- this.expName = expName;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getApplicationId() {
- return applicationId;
- }
-
- public void setApplicationId(String applicationId) {
- this.applicationId = applicationId;
- }
-
- public StatusResource getStatus() {
- return status;
- }
-
- public void setStatus(StatusResource status) {
- this.status = status;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
deleted file mode 100644
index b0070ee..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- *
- * 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.resources;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-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.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.*;
-import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GatewayResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(GatewayResource.class);
-
- private String gatewayId;
- private String gatewayName;
- private String domain;
- private String emailAddress;
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public String getEmailAddress() {
- return emailAddress;
- }
-
- public void setEmailAddress(String emailAddress) {
- this.emailAddress = emailAddress;
- }
-
- /**
- *
- * @param gatewayId gateway name
- */
- public GatewayResource(String gatewayId) {
- setGatewayId(gatewayId);
- }
-
- /**
- *
- */
- public GatewayResource() {
- }
-
- /**
- *
- * @return gateway name
- */
- public String getGatewayName() {
- return gatewayName;
- }
-
- /**
- *
- * @param gatewayName
- */
- public void setGatewayName(String gatewayName) {
- this.gatewayName = gatewayName;
- }
-
- /**
- *
- * @return domain of the gateway
- */
- public String getDomain() {
- return domain;
- }
-
- /**
- *
- * @param domain domain of the gateway
- */
- public void setDomain(String domain) {
- this.domain = domain;
- }
-
-
- /**
- * Gateway is at the root level. So it can populate his child resources.
- * Project, User, Published Workflows, User workflows, Host descriptors,
- * Service Descriptors, Application descriptors and Experiments are all
- * its children
- * @param type resource type of the children
- * @return specific child resource type
- */
- public Resource create(ResourceType type) throws RegistryException {
- switch (type) {
- case PROJECT:
- ProjectResource projectResource = new ProjectResource();
- projectResource.setGatewayId(gatewayId);
- return projectResource;
- case EXPERIMENT:
- ExperimentResource experimentResource =new ExperimentResource();
- experimentResource.setGatewayId(gatewayId);
- return experimentResource;
- case GATEWAY_WORKER:
- WorkerResource workerResource = new WorkerResource();
- workerResource.setGatewayId(gatewayId);
- return workerResource;
- default:
- logger.error("Unsupported resource type for gateway resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for gateway resource.");
- }
- }
-
- /**
- * Child resources can be removed from a gateway
- * @param type child resource type
- * @param name child resource name
- */
- public void remove(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- switch (type) {
- case USER:
- generator = new QueryGenerator(USERS);
- generator.setParameter(UserConstants.USERNAME, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case EXPERIMENT:
- generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- default:
- logger.error("Unsupported resource type for gateway resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- * Gateway can get information of his children
- * @param type child resource type
- * @param name child resource name
- * @return specific child resource type
- */
- public Resource get(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case GATEWAY_WORKER:
- generator = new QueryGenerator(GATEWAY_WORKER);
- generator.setParameter(GatewayWorkerConstants.USERNAME, name);
- generator.setParameter(GatewayWorkerConstants.GATEWAY_ID, gatewayId);
- q = generator.selectQuery(em);
- Gateway_Worker worker = (Gateway_Worker) q.getSingleResult();
- WorkerResource workerResource =
- (WorkerResource) Utils.getResource(ResourceType.GATEWAY_WORKER, worker);
- em.getTransaction().commit();
- em.close();
- return workerResource;
- case USER:
- generator = new QueryGenerator(USERS);
- generator.setParameter(UserConstants.USERNAME, name);
- q = generator.selectQuery(em);
- Users user = (Users) q.getSingleResult();
- UserResource userResource =
- (UserResource) Utils.getResource(ResourceType.USER, user);
- em.getTransaction().commit();
- em.close();
- return userResource;
- case EXPERIMENT:
- generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- Experiment experiment = (Experiment) q.getSingleResult();
- ExperimentResource experimentResource =
- (ExperimentResource) Utils.getResource(ResourceType.EXPERIMENT, experiment);
- em.getTransaction().commit();
- em.close();
- return experimentResource;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for gateway resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for gateway resource.");
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @param type child resource type
- * @return list of child resources
- */
- public List<Resource> get(ResourceType type) throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- List results;
- switch (type) {
- case PROJECT:
- generator = new QueryGenerator(PROJECT);
- Gateway gatewayModel = em.find(Gateway.class, gatewayId);
- generator.setParameter("gateway", gatewayModel);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Project project = (Project) result;
- ProjectResource projectResource =
- (ProjectResource) Utils.getResource(ResourceType.PROJECT, project);
- resourceList.add(projectResource);
- }
- }
- break;
- case GATEWAY_WORKER:
- generator = new QueryGenerator(GATEWAY_WORKER);
- generator.setParameter(GatewayWorkerConstants.GATEWAY_ID, gatewayId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Gateway_Worker gatewayWorker = (Gateway_Worker) result;
- WorkerResource workerResource =
- (WorkerResource) Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
- resourceList.add(workerResource);
- }
- }
- break;
- case EXPERIMENT:
- generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.GATEWAY_ID, gatewayId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Experiment experiment = (Experiment) result;
- ExperimentResource experimentResource =
- (ExperimentResource) Utils.getResource(ResourceType.EXPERIMENT, experiment);
- resourceList.add(experimentResource);
- }
- }
- break;
- case USER:
- generator = new QueryGenerator(USERS);
- q = generator.selectQuery(em);
- for (Object o : q.getResultList()) {
- Users user = (Users) o;
- UserResource userResource =
- (UserResource) Utils.getResource(ResourceType.USER, user);
- resourceList.add(userResource);
- }
- break;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for gateway resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for gateway resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- /**
- * save the gateway to the database
- */
- public void save() throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- Gateway existingGateway = em.find(Gateway.class, gatewayId);
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Gateway gateway = new Gateway();
- gateway.setGateway_name(gatewayName);
- gateway.setGateway_id(gatewayId);
- gateway.setDomain(domain);
- gateway.setEmailAddress(emailAddress);
- if (existingGateway != null) {
- existingGateway.setDomain(domain);
- existingGateway.setGateway_name(gatewayName);
- existingGateway.setEmailAddress(emailAddress);
- gateway = em.merge(existingGateway);
- } else {
- em.persist(gateway);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
- }
-
- /**
- * check whether child resource already exist in the database
- * @param type child resource type
- * @param name name of the child resource
- * @return true or false
- */
- public boolean isExists(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- switch (type) {
- case GATEWAY_WORKER:
- em = ResourceUtils.getEntityManager();
- Gateway_Worker existingWorker = em.find(Gateway_Worker.class, new Gateway_Worker_PK(gatewayId, name.toString()));
- em.close();
- return existingWorker != null;
- case USER:
- em = ResourceUtils.getEntityManager();
- Users existingUser = em.find(Users.class, name);
- em.close();
- return existingUser != null;
- case EXPERIMENT:
- em = ResourceUtils.getEntityManager();
- Experiment existingExp = em.find(Experiment.class, name.toString());
- em.close();
- return existingExp != null;
- default:
- logger.error("Unsupported resource type for gateway resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for gateway resource.");
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public ExperimentResource createExperiment (String experimentID) throws RegistryException{
- ExperimentResource metadataResource = (ExperimentResource)create(ResourceType.EXPERIMENT);
- metadataResource.setExpID(experimentID);
- return metadataResource;
- }
-
- public ExperimentResource getExperiment (String expId) throws RegistryException{
- return (ExperimentResource)get(ResourceType.EXPERIMENT, expId);
- }
-
- public List<ExperimentResource> getExperiments () throws RegistryException{
- List<ExperimentResource> experiments = new ArrayList<ExperimentResource>();
- List<Resource> resources = get(ResourceType.EXPERIMENT);
- for (Resource resource : resources){
- experiments.add((ExperimentResource)resource);
- }
- return experiments;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/JobDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/JobDetailResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/JobDetailResource.java
deleted file mode 100644
index 4619c33..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/JobDetailResource.java
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.*;
-import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.utils.StatusType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JobDetailResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(JobDetailResource.class);
- private String jobId;
- private String taskId;
- private String jobDescription;
- private Timestamp creationTime;
- private String computeResourceConsumed;
- private String jobName;
- private String workingDir;
- private StatusResource jobStatus;
- private List<ErrorDetailResource> errors;
-
- public void setJobStatus(StatusResource jobStatus) {
- this.jobStatus = jobStatus;
- }
-
- public List<ErrorDetailResource> getErrors() {
- return errors;
- }
-
- public void setErrors(List<ErrorDetailResource> errors) {
- this.errors = errors;
- }
-
- public String getJobName() {
- return jobName;
- }
-
- public void setJobName(String jobName) {
- this.jobName = jobName;
- }
-
- public String getWorkingDir() {
- return workingDir;
- }
-
- public void setWorkingDir(String workingDir) {
- this.workingDir = workingDir;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getJobDescription() {
- return jobDescription;
- }
-
- public void setJobDescription(String jobDescription) {
- this.jobDescription = jobDescription;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getComputeResourceConsumed() {
- return computeResourceConsumed;
- }
-
- public void setComputeResourceConsumed(String computeResourceConsumed) {
- this.computeResourceConsumed = computeResourceConsumed;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException {
- switch (type){
- case STATUS:
- StatusResource statusResource = new StatusResource();
- statusResource.setJobId(jobId);
- return statusResource;
- case ERROR_DETAIL:
- ErrorDetailResource errorDetailResource = new ErrorDetailResource();
- errorDetailResource.setJobId(jobId);
- return errorDetailResource;
- default:
- logger.error("Unsupported resource type for job details data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- switch (type) {
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.JOB_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.JOB.toString());
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ERROR_DETAIL:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(ErrorDetailConstants.JOB_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- default:
- logger.error("Unsupported resource type for job details resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.JOB_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.JOB.toString());
- q = generator.selectQuery(em);
- Status status = (Status) q.getSingleResult();
- StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- em.getTransaction().commit();
- em.close();
- return statusResource;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.JOB_ID, name);
- q = generator.selectQuery(em);
- ErrorDetail errorDetail = (ErrorDetail) q.getSingleResult();
- ErrorDetailResource errorDetailResource = (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- em.getTransaction().commit();
- em.close();
- return errorDetailResource;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for job details resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for job details resource.");
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- List results;
- switch (type) {
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.JOB_ID, jobId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Status status = (Status) result;
- StatusResource statusResource =
- (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- resourceList.add(statusResource);
- }
- }
- break;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.JOB_ID, jobId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ErrorDetail errorDetail = (ErrorDetail) result;
- ErrorDetailResource errorDetailResource =
- (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- resourceList.add(errorDetailResource);
- }
- }
- break;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for workflow node details resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- JobDetail existingJobDetail = em.find(JobDetail.class, new JobDetails_PK(jobId, taskId));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- JobDetail jobDetail = new JobDetail();
- jobDetail.setJobId(jobId);
- jobDetail.setTaskId(taskId);
- jobDetail.setCreationTime(creationTime);
- jobDetail.setJobName(jobName);
- jobDetail.setWorkingDir(workingDir);
- if (jobDescription != null) {
- jobDetail.setJobDescription(jobDescription.toCharArray());
- }
- jobDetail.setComputeResourceConsumed(computeResourceConsumed);
- if (existingJobDetail != null) {
- existingJobDetail.setJobId(jobId);
- existingJobDetail.setTaskId(taskId);
- existingJobDetail.setCreationTime(creationTime);
- if (jobDescription != null) {
- existingJobDetail.setJobDescription(jobDescription.toCharArray());
- }
- existingJobDetail.setComputeResourceConsumed(computeResourceConsumed);
- existingJobDetail.setJobName(jobName);
- existingJobDetail.setWorkingDir(workingDir);
- jobDetail = em.merge(existingJobDetail);
- } else {
- em.persist(jobDetail);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public StatusResource getJobStatus() {
- return jobStatus;
- }
-
- public StatusResource getJobStatus1() throws RegistryException{
- List<Resource> resources = get(ResourceType.STATUS);
- for (Resource resource : resources) {
- StatusResource jobStatus = (StatusResource) resource;
- if(jobStatus.getStatusType().equals(StatusType.JOB.toString())){
- if (jobStatus.getState() == null || jobStatus.getState().equals("") ){
- jobStatus.setState("UNKNOWN");
- }
- return jobStatus;
- }
- }
- return null;
- }
-
- public StatusResource getApplicationStatus() throws RegistryException{
- List<Resource> resources = get(ResourceType.STATUS);
- for (Resource resource : resources) {
- StatusResource appStatus = (StatusResource) resource;
- if(appStatus.getStatusType().equals(StatusType.APPLICATION.toString())){
- if (appStatus.getState() == null || appStatus.getState().equals("") ){
- appStatus.setState("UNKNOWN");
- }
- return appStatus;
- }
- }
- return null;
- }
-
- public List<ErrorDetailResource> getErrorDetails () throws RegistryException{
- List<ErrorDetailResource> errorDetailResources = new ArrayList<ErrorDetailResource>();
- List<Resource> resources = get(ResourceType.ERROR_DETAIL);
- for(Resource resource : resources){
- errorDetailResources.add((ErrorDetailResource)resource);
- }
- return errorDetailResources;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeInputResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeInputResource.java
deleted file mode 100644
index 4e38472..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeInputResource.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- *
- * 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.resources;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.NodeInput;
-import org.apache.airavata.persistance.registry.jpa.model.NodeInput_PK;
-import org.apache.airavata.persistance.registry.jpa.model.WorkflowNodeDetail;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NodeInputResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(NodeInputResource.class);
-
- private String nodeId;
- private String inputKey;
- private String dataType;
- private String metadata;
- private String value;
- private String appArgument;
- private boolean standardInput;
- private String userFriendlyDesc;
- private int inputOrder;
- private boolean isRequired;
- private boolean requiredToCMD;
- private boolean dataStaged;
-
- public boolean getRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean required) {
- this.isRequired = required;
- }
-
- public boolean getRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataStaged() {
- return dataStaged;
- }
-
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- NodeInput existingInput = em.find(NodeInput.class, new NodeInput_PK(inputKey, nodeId));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- NodeInput nodeInput = new NodeInput();
- nodeInput.setNodeId(nodeId);
- nodeInput.setInputKey(inputKey);
- nodeInput.setDataType(dataType);
- nodeInput.setValue(value);
- nodeInput.setMetadata(metadata);
- nodeInput.setAppArgument(appArgument);
- nodeInput.setStandardInput(standardInput);
- nodeInput.setUserFriendlyDesc(userFriendlyDesc);
- nodeInput.setInputOrder(inputOrder);
- nodeInput.setRequiredToCMD(requiredToCMD);
- nodeInput.setIsRequired(isRequired);
- nodeInput.setDataStaged(dataStaged);
-
- if (existingInput != null){
- existingInput.setNodeId(nodeId);
- existingInput.setInputKey(inputKey);
- existingInput.setDataType(dataType);
- existingInput.setValue(value);
- existingInput.setMetadata(metadata);
- existingInput.setAppArgument(appArgument);
- existingInput.setStandardInput(standardInput);
- existingInput.setUserFriendlyDesc(userFriendlyDesc);
- existingInput.setInputOrder(inputOrder);
- existingInput.setRequiredToCMD(requiredToCMD);
- existingInput.setIsRequired(isRequired);
- existingInput.setDataStaged(dataStaged);
- nodeInput = em.merge(existingInput);
- }else {
- em.persist(nodeInput);
- }
- em.getTransaction().commit();
- em.close();
- }catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
[06/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentResource.java
new file mode 100644
index 0000000..82c2c2b
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentResource.java
@@ -0,0 +1,831 @@
+/*
+*
+* 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.experiment.catalog.resources;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.*;
+import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.apache.airavata.registry.cpi.utils.StatusType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ExperimentResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(ExperimentResource.class);
+// private WorkerResource worker;
+ private String executionUser;
+ private String expID;
+ private Timestamp creationTime;
+ private String gatewayId;
+ private String projectId;
+ private String expName;
+ private String description;
+ private String applicationId;
+ private String applicationVersion;
+ private String workflowTemplateId;
+ private String workflowTemplateVersion;
+ private String workflowExecutionId;
+ private boolean enableEmailNotifications;
+ private String gatewayExecutionId;
+ private List<ExperimentInputResource> experimentInputResources;
+ private List<ExperimentOutputResource> experimentOutputputResources;
+ private ComputationSchedulingResource computationSchedulingResource;
+ private ConfigDataResource userConfigDataResource;
+ private List<WorkflowNodeDetailResource> workflowNodeDetailResourceList;
+ private List<StatusResource> stateChangeList;
+ private List<ErrorDetailResource> errorDetailList;
+ private StatusResource experimentStatus;
+ private List<NotificationEmailResource> emailResourceList;
+
+ /**
+ *
+ * @return experiment ID
+ */
+ public String getExpID() {
+ return expID;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getExpName() {
+ return expName;
+ }
+
+ public void setExpName(String expName) {
+ this.expName = expName;
+ }
+
+ public String getApplicationId() {
+ return applicationId;
+ }
+
+ public void setApplicationId(String applicationId) {
+ this.applicationId = applicationId;
+ }
+
+ public String getApplicationVersion() {
+ return applicationVersion;
+ }
+
+ public void setApplicationVersion(String applicationVersion) {
+ this.applicationVersion = applicationVersion;
+ }
+
+ public String getWorkflowTemplateId() {
+ return workflowTemplateId;
+ }
+
+ public void setWorkflowTemplateId(String workflowTemplateId) {
+ this.workflowTemplateId = workflowTemplateId;
+ }
+
+ public String getWorkflowTemplateVersion() {
+ return workflowTemplateVersion;
+ }
+
+ public void setWorkflowTemplateVersion(String workflowTemplateVersion) {
+ this.workflowTemplateVersion = workflowTemplateVersion;
+ }
+
+ public String getWorkflowExecutionId() {
+ return workflowExecutionId;
+ }
+
+ public void setWorkflowExecutionId(String workflowExecutionId) {
+ this.workflowExecutionId = workflowExecutionId;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public boolean isEnableEmailNotifications() {
+ return enableEmailNotifications;
+ }
+
+ public void setEnableEmailNotifications(boolean enableEmailNotifications) {
+ this.enableEmailNotifications = enableEmailNotifications;
+ }
+
+ public String getGatewayExecutionId() {
+ return gatewayExecutionId;
+ }
+
+ public void setGatewayExecutionId(String gatewayExecutionId) {
+ this.gatewayExecutionId = gatewayExecutionId;
+ }
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public List<ExperimentInputResource> getExperimentInputResources() {
+ return experimentInputResources;
+ }
+
+ public void setExperimentInputResources(List<ExperimentInputResource> experimentInputResources) {
+ this.experimentInputResources = experimentInputResources;
+ }
+
+ public List<ExperimentOutputResource> getExperimentOutputputResources() {
+ return experimentOutputputResources;
+ }
+
+ public void setExperimentOutputputResources(List<ExperimentOutputResource> experimentOutputputResources) {
+ this.experimentOutputputResources = experimentOutputputResources;
+ }
+
+ public ComputationSchedulingResource getComputationSchedulingResource() {
+ return computationSchedulingResource;
+ }
+
+ public void setComputationSchedulingResource(ComputationSchedulingResource computationSchedulingResource) {
+ this.computationSchedulingResource = computationSchedulingResource;
+ }
+
+ public ConfigDataResource getUserConfigDataResource() {
+ return userConfigDataResource;
+ }
+
+ public void setUserConfigDataResource(ConfigDataResource userConfigDataResource) {
+ this.userConfigDataResource = userConfigDataResource;
+ }
+
+ public List<WorkflowNodeDetailResource> getWorkflowNodeDetailResourceList() {
+ return workflowNodeDetailResourceList;
+ }
+
+ public void setWorkflowNodeDetailResourceList(List<WorkflowNodeDetailResource> workflowNodeDetailResourceList) {
+ this.workflowNodeDetailResourceList = workflowNodeDetailResourceList;
+ }
+
+ public List<StatusResource> getStateChangeList() {
+ return stateChangeList;
+ }
+
+ public void setStateChangeList(List<StatusResource> stateChangeList) {
+ this.stateChangeList = stateChangeList;
+ }
+
+ public List<ErrorDetailResource> getErrorDetailList() {
+ return errorDetailList;
+ }
+
+ public void setErrorDetailList(List<ErrorDetailResource> errorDetailList) {
+ this.errorDetailList = errorDetailList;
+ }
+
+ public void setExperimentStatus(StatusResource experimentStatus) {
+ this.experimentStatus = experimentStatus;
+ }
+
+ public List<NotificationEmailResource> getEmailResourceList() {
+ return emailResourceList;
+ }
+
+ public void setEmailResourceList(List<NotificationEmailResource> emailResourceList) {
+ this.emailResourceList = emailResourceList;
+ }
+
+
+ /**
+ * Since experiments are at the leaf level, this method is not
+ * valid for an experiment
+ * @param type child resource types
+ * @return UnsupportedOperationException
+ */
+ public Resource create(ResourceType type) throws RegistryException {
+ switch (type){
+ case EXPERIMENT_INPUT:
+ ExperimentInputResource inputResource = new ExperimentInputResource();
+ inputResource.setExperimentId(expID);
+ return inputResource;
+ case EXPERIMENT_OUTPUT:
+ ExperimentOutputResource experimentOutputResource = new ExperimentOutputResource();
+ experimentOutputResource.setExperimentId(expID);
+ return experimentOutputResource;
+ case NOTIFICATION_EMAIL:
+ NotificationEmailResource emailResource = new NotificationEmailResource();
+ emailResource.setExperimentId(expID);
+ return emailResource;
+ case WORKFLOW_NODE_DETAIL:
+ WorkflowNodeDetailResource nodeDetailResource = new WorkflowNodeDetailResource();
+ nodeDetailResource.setExperimentId(expID);
+ return nodeDetailResource;
+ case ERROR_DETAIL:
+ ErrorDetailResource errorDetailResource = new ErrorDetailResource();
+ errorDetailResource.setExperimentId(expID);
+ return errorDetailResource;
+ case STATUS:
+ StatusResource statusResource = new StatusResource();
+ statusResource.setExperimentId(expID);
+ return statusResource;
+ case CONFIG_DATA:
+ ConfigDataResource configDataResource = new ConfigDataResource();
+ configDataResource.setExperimentId(expID);
+ return configDataResource;
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ ComputationSchedulingResource schedulingResource = new ComputationSchedulingResource();
+ schedulingResource.setExperimentId(expID);
+ return schedulingResource;
+ case ADVANCE_INPUT_DATA_HANDLING:
+ AdvanceInputDataHandlingResource dataHandlingResource = new AdvanceInputDataHandlingResource();
+ dataHandlingResource.setExperimentId(expID);
+ return dataHandlingResource;
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ AdvancedOutputDataHandlingResource outputDataHandlingResource = new AdvancedOutputDataHandlingResource();
+ outputDataHandlingResource.setExperimentId(expID);
+ return outputDataHandlingResource;
+ case QOS_PARAM:
+ QosParamResource qosParamResource = new QosParamResource();
+ qosParamResource.setExperimentId(expID);
+ return qosParamResource;
+ default:
+ logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for experiment resource.");
+ }
+ }
+
+ /**
+ *
+ * @param type child resource types
+ * @param name name of the child resource
+ * @return UnsupportedOperationException
+ */
+ public void remove(ResourceType type, Object name) throws RegistryException {
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ switch (type) {
+ case EXPERIMENT_INPUT:
+ generator = new QueryGenerator(EXPERIMENT_INPUT);
+ generator.setParameter(ExperimentInputConstants.EXPERIMENT_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case EXPERIMENT_OUTPUT:
+ generator = new QueryGenerator(EXPERIMENT_OUTPUT);
+ generator.setParameter(ExperimentOutputConstants.EXPERIMENT_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case NOTIFICATION_EMAIL:
+ generator = new QueryGenerator(NOTIFICATION_EMAIL);
+ generator.setParameter(NotificationEmailConstants.EXPERIMENT_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case WORKFLOW_NODE_DETAIL:
+ generator = new QueryGenerator(WORKFLOW_NODE_DETAIL);
+ generator.setParameter(WorkflowNodeDetailsConstants.NODE_INSTANCE_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case ERROR_DETAIL:
+ generator = new QueryGenerator(ERROR_DETAIL);
+ generator.setParameter(ErrorDetailConstants.EXPERIMENT_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.EXPERIMENT_ID, name);
+ generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.EXPERIMENT.toString());
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case CONFIG_DATA:
+ generator = new QueryGenerator(CONFIG_DATA);
+ generator.setParameter(ExperimentConfigurationDataConstants.EXPERIMENT_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ generator = new QueryGenerator(COMPUTATIONAL_RESOURCE_SCHEDULING);
+ generator.setParameter(ComputationalResourceSchedulingConstants.EXPERIMENT_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case ADVANCE_INPUT_DATA_HANDLING:
+ generator = new QueryGenerator(ADVANCE_INPUT_DATA_HANDLING);
+ generator.setParameter(AdvancedInputDataHandlingConstants.EXPERIMENT_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ generator = new QueryGenerator(ADVANCE_OUTPUT_DATA_HANDLING);
+ generator.setParameter(AdvancedOutputDataHandlingConstants.EXPERIMENT_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case QOS_PARAM:
+ generator = new QueryGenerator(QOS_PARAMS);
+ generator.setParameter(QosParamsConstants.EXPERIMENT_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ default:
+ logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
+ break;
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ /**
+ *
+ * @param type child resource types
+ * @param name name of the child resource
+ * @return UnsupportedOperationException
+ */
+ public Resource get(ResourceType type, Object name) throws RegistryException {
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator;
+ Query q;
+ switch (type) {
+ case EXPERIMENT_INPUT:
+ generator = new QueryGenerator(EXPERIMENT_INPUT);
+ generator.setParameter(ExperimentInputConstants.EXPERIMENT_ID, name);
+ q = generator.selectQuery(em);
+ Experiment_Input experimentInput = (Experiment_Input) q.getSingleResult();
+ ExperimentInputResource inputResource = (ExperimentInputResource) Utils.getResource(ResourceType.EXPERIMENT_INPUT, experimentInput);
+ em.getTransaction().commit();
+ em.close();
+ return inputResource;
+ case EXPERIMENT_OUTPUT:
+ generator = new QueryGenerator(EXPERIMENT_OUTPUT);
+ generator.setParameter(ExperimentOutputConstants.EXPERIMENT_ID, name);
+ q = generator.selectQuery(em);
+ Experiment_Output experimentOutput = (Experiment_Output) q.getSingleResult();
+ ExperimentOutputResource outputResource = (ExperimentOutputResource) Utils.getResource(ResourceType.EXPERIMENT_OUTPUT, experimentOutput);
+ em.getTransaction().commit();
+ em.close();
+ return outputResource;
+ case NOTIFICATION_EMAIL:
+ generator = new QueryGenerator(NOTIFICATION_EMAIL);
+ generator.setParameter(NotificationEmailConstants.EXPERIMENT_ID, name);
+ q = generator.selectQuery(em);
+ Notification_Email notificationEmail = (Notification_Email) q.getSingleResult();
+ NotificationEmailResource notificationEmailResource = (NotificationEmailResource) Utils.getResource(ResourceType.NOTIFICATION_EMAIL, notificationEmail);
+ em.getTransaction().commit();
+ em.close();
+ return notificationEmailResource;
+ case WORKFLOW_NODE_DETAIL:
+ generator = new QueryGenerator(WORKFLOW_NODE_DETAIL);
+ generator.setParameter(WorkflowNodeDetailsConstants.NODE_INSTANCE_ID, name);
+ q = generator.selectQuery(em);
+ WorkflowNodeDetail workflowNodeDetail = (WorkflowNodeDetail) q.getSingleResult();
+ WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) Utils.getResource(ResourceType.WORKFLOW_NODE_DETAIL, workflowNodeDetail);
+ em.getTransaction().commit();
+ em.close();
+ return nodeDetailResource;
+ case ERROR_DETAIL:
+ generator = new QueryGenerator(ERROR_DETAIL);
+ generator.setParameter(ErrorDetailConstants.EXPERIMENT_ID, name);
+ q = generator.selectQuery(em);
+ ErrorDetail errorDetail = (ErrorDetail) q.getSingleResult();
+ ErrorDetailResource errorDetailResource = (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
+ em.getTransaction().commit();
+ em.close();
+ return errorDetailResource;
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.EXPERIMENT_ID, name);
+ generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.EXPERIMENT.toString());
+ q = generator.selectQuery(em);
+ Status status = (Status) q.getSingleResult();
+ StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
+ em.getTransaction().commit();
+ em.close();
+ return statusResource;
+ case CONFIG_DATA:
+ generator = new QueryGenerator(CONFIG_DATA);
+ generator.setParameter(ExperimentConfigurationDataConstants.EXPERIMENT_ID, name);
+ q = generator.selectQuery(em);
+ ExperimentConfigData configData = (ExperimentConfigData) q.getSingleResult();
+ ConfigDataResource configDataResource = (ConfigDataResource) Utils.getResource(ResourceType.CONFIG_DATA, configData);
+ em.getTransaction().commit();
+ em.close();
+ return configDataResource;
+ case COMPUTATIONAL_RESOURCE_SCHEDULING:
+ generator = new QueryGenerator(COMPUTATIONAL_RESOURCE_SCHEDULING);
+ generator.setParameter(ComputationalResourceSchedulingConstants.EXPERIMENT_ID, name);
+ generator.setParameter(ComputationalResourceSchedulingConstants.TASK_ID, null);
+ q = generator.selectQuery(em);
+ Computational_Resource_Scheduling scheduling = (Computational_Resource_Scheduling) q.getSingleResult();
+ ComputationSchedulingResource schedulingResource = (ComputationSchedulingResource) Utils.getResource(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, scheduling);
+ em.getTransaction().commit();
+ em.close();
+ return schedulingResource;
+ case ADVANCE_INPUT_DATA_HANDLING:
+ generator = new QueryGenerator(ADVANCE_INPUT_DATA_HANDLING);
+ generator.setParameter(AdvancedInputDataHandlingConstants.EXPERIMENT_ID, name);
+ generator.setParameter(AdvancedInputDataHandlingConstants.TASK_ID, null);
+ q = generator.selectQuery(em);
+ AdvancedInputDataHandling inputDataHandling = (AdvancedInputDataHandling) q.getSingleResult();
+ AdvanceInputDataHandlingResource dataHandlingResource = (AdvanceInputDataHandlingResource) Utils.getResource(ResourceType.ADVANCE_INPUT_DATA_HANDLING, inputDataHandling);
+ em.getTransaction().commit();
+ em.close();
+ return dataHandlingResource;
+ case ADVANCE_OUTPUT_DATA_HANDLING:
+ generator = new QueryGenerator(ADVANCE_OUTPUT_DATA_HANDLING);
+ generator.setParameter(AdvancedOutputDataHandlingConstants.EXPERIMENT_ID, name);
+ generator.setParameter(AdvancedOutputDataHandlingConstants.TASK_ID, null);
+ q = generator.selectQuery(em);
+ AdvancedOutputDataHandling outputDataHandling = (AdvancedOutputDataHandling) q.getSingleResult();
+ AdvancedOutputDataHandlingResource outputDataHandlingResource = (AdvancedOutputDataHandlingResource) Utils.getResource(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, outputDataHandling);
+ em.getTransaction().commit();
+ em.close();
+ return outputDataHandlingResource;
+ case QOS_PARAM:
+ generator = new QueryGenerator(QOS_PARAMS);
+ generator.setParameter(QosParamsConstants.EXPERIMENT_ID, name);
+ generator.setParameter(QosParamsConstants.TASK_ID, null);
+ q = generator.selectQuery(em);
+ QosParam qosParam = (QosParam) q.getSingleResult();
+ QosParamResource qosParamResource = (QosParamResource) Utils.getResource(ResourceType.QOS_PARAM, qosParam);
+ em.getTransaction().commit();
+ em.close();
+ return qosParamResource;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for experiment data resource.");
+ }
+ } catch (Exception e) {
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+
+ }
+
+ /**
+ *
+ * @param type child resource types
+ * @return UnsupportedOperationException
+ */
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ List<Resource> resourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ List results;
+ switch (type) {
+ case EXPERIMENT_INPUT:
+ generator = new QueryGenerator(EXPERIMENT_INPUT);
+ generator.setParameter(ExperimentInputConstants.EXPERIMENT_ID, expID);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Experiment_Input exInput = (Experiment_Input) result;
+ ExperimentInputResource inputResource =
+ (ExperimentInputResource) Utils.getResource(ResourceType.EXPERIMENT_INPUT, exInput);
+ resourceList.add(inputResource);
+ }
+ }
+ break;
+ case EXPERIMENT_OUTPUT:
+ generator = new QueryGenerator(EXPERIMENT_OUTPUT);
+ generator.setParameter(ExperimentOutputConstants.EXPERIMENT_ID, expID);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Experiment_Output output = (Experiment_Output) result;
+ ExperimentOutputResource outputResource =
+ (ExperimentOutputResource) Utils.getResource(ResourceType.EXPERIMENT_OUTPUT, output);
+ resourceList.add(outputResource);
+ }
+ }
+ break;
+ case NOTIFICATION_EMAIL:
+ generator = new QueryGenerator(NOTIFICATION_EMAIL);
+ generator.setParameter(NotificationEmailConstants.EXPERIMENT_ID, expID);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Notification_Email notificationEmail = (Notification_Email) result;
+ NotificationEmailResource emailResource =
+ (NotificationEmailResource) Utils.getResource(ResourceType.NOTIFICATION_EMAIL, notificationEmail);
+ resourceList.add(emailResource);
+ }
+ }
+ break;
+ case WORKFLOW_NODE_DETAIL:
+ generator = new QueryGenerator(WORKFLOW_NODE_DETAIL);
+ generator.setParameter(WorkflowNodeDetailsConstants.EXPERIMENT_ID, expID);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ WorkflowNodeDetail nodeDetail = (WorkflowNodeDetail) result;
+ WorkflowNodeDetailResource nodeDetailResource =
+ (WorkflowNodeDetailResource) Utils.getResource(ResourceType.WORKFLOW_NODE_DETAIL, nodeDetail);
+ resourceList.add(nodeDetailResource);
+ }
+ }
+ break;
+ case ERROR_DETAIL:
+ generator = new QueryGenerator(ERROR_DETAIL);
+ generator.setParameter(ErrorDetailConstants.EXPERIMENT_ID, expID);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ErrorDetail errorDetail = (ErrorDetail) result;
+ ErrorDetailResource errorDetailResource =
+ (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
+ resourceList.add(errorDetailResource);
+ }
+ }
+ break;
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.EXPERIMENT_ID, expID);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Status status = (Status) result;
+ StatusResource statusResource =
+ (StatusResource) Utils.getResource(ResourceType.STATUS, status);
+ resourceList.add(statusResource);
+ }
+ }
+ break;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for experiment resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return resourceList;
+ }
+
+ /**
+ * save experiment
+ */
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ Experiment existingExp = em.find(Experiment.class, expID);
+ em.close();
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Experiment experiment = new Experiment();
+ experiment.setProjectID(projectId);
+ experiment.setExpId(expID);
+ experiment.setExecutionUser(executionUser);
+ experiment.setExecutionUser(executionUser);
+ experiment.setGatewayId(gatewayId);
+ experiment.setCreationTime(creationTime);
+ experiment.setExpName(expName);
+ experiment.setExpDesc(description);
+ experiment.setApplicationId(applicationId);
+ experiment.setAppVersion(applicationVersion);
+ experiment.setWorkflowExecutionId(workflowExecutionId);
+ experiment.setWorkflowTemplateVersion(workflowTemplateVersion);
+ experiment.setWorkflowExecutionId(workflowExecutionId);
+ experiment.setAllowNotification(enableEmailNotifications);
+ experiment.setGatewayExecutionId(gatewayExecutionId);
+ if (existingExp != null) {
+ existingExp.setGatewayId(gatewayId);
+ existingExp.setExecutionUser(executionUser);
+ existingExp.setProjectID(projectId);
+ existingExp.setCreationTime(creationTime);
+ existingExp.setExpName(expName);
+ existingExp.setExpDesc(description);
+ existingExp.setApplicationId(applicationId);
+ existingExp.setAppVersion(applicationVersion);
+ existingExp.setWorkflowExecutionId(workflowExecutionId);
+ existingExp.setWorkflowTemplateVersion(workflowTemplateVersion);
+ existingExp.setWorkflowExecutionId(workflowExecutionId);
+ existingExp.setAllowNotification(enableEmailNotifications);
+ existingExp.setGatewayExecutionId(gatewayExecutionId);
+ experiment = em.merge(existingExp);
+ } else {
+ em.persist(experiment);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ /**
+ *
+ * @param expID experiment ID
+ */
+ public void setExpID(String expID) {
+ this.expID = expID;
+ }
+
+ public String getExecutionUser() {
+ return executionUser;
+ }
+
+ public void setExecutionUser(String executionUser) {
+ this.executionUser = executionUser;
+ }
+
+ public List<NotificationEmailResource> getNotificationEmails () throws RegistryException{
+ List<NotificationEmailResource> emailResources = new ArrayList<NotificationEmailResource>();
+ List<Resource> resources = get(ResourceType.NOTIFICATION_EMAIL);
+ for (Resource resource : resources) {
+ emailResources.add((NotificationEmailResource) resource);
+ }
+ return emailResources;
+ }
+
+ public List<ExperimentInputResource> getExperimentInputs () throws RegistryException{
+ List<ExperimentInputResource> expInputs = new ArrayList<ExperimentInputResource>();
+ List<Resource> resources = get(ResourceType.EXPERIMENT_INPUT);
+ for (Resource resource : resources) {
+ expInputs.add((ExperimentInputResource) resource);
+ }
+ return expInputs;
+ }
+
+ public List<ExperimentOutputResource> getExperimentOutputs () throws RegistryException{
+ List<ExperimentOutputResource> expOutputs = new ArrayList<ExperimentOutputResource>();
+ List<Resource> resources = get(ResourceType.EXPERIMENT_OUTPUT);
+ for (Resource resource : resources) {
+ expOutputs.add((ExperimentOutputResource) resource);
+ }
+ return expOutputs;
+ }
+
+ public StatusResource getExperimentStatus() throws RegistryException{
+ List<Resource> resources = get(ResourceType.STATUS);
+ for (Resource resource : resources) {
+ StatusResource expStatus = (StatusResource) resource;
+ if(expStatus.getStatusType().equals(StatusType.EXPERIMENT.toString())){
+ if (expStatus.getState() == null || expStatus.getState().equals("") ){
+ expStatus.setState("UNKNOWN");
+ }
+ return expStatus;
+ }
+ }
+ return null;
+ }
+
+ public List<StatusResource> getWorkflowNodeStatuses() throws RegistryException{
+ List<StatusResource> statuses = new ArrayList<StatusResource>();
+ List<Resource> resources = get(ResourceType.STATUS);
+ for (Resource resource : resources) {
+ StatusResource workflowNodeStatus = (StatusResource) resource;
+ if(workflowNodeStatus.getStatusType().equals(StatusType.WORKFLOW_NODE.toString())){
+ if (workflowNodeStatus.getState() == null || workflowNodeStatus.getState().equals("")){
+ workflowNodeStatus.setState("UNKNOWN");
+ }
+ statuses.add(workflowNodeStatus);
+ }
+ }
+ return statuses;
+ }
+
+ public List<WorkflowNodeDetailResource> getWorkflowNodeDetails () throws RegistryException{
+ List<WorkflowNodeDetailResource> workflowNodeDetailResourceList = new ArrayList<WorkflowNodeDetailResource>();
+ List<Resource> resources = get(ResourceType.WORKFLOW_NODE_DETAIL);
+ for (Resource resource : resources) {
+ WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) resource;
+ workflowNodeDetailResourceList.add(nodeDetailResource);
+ }
+ return workflowNodeDetailResourceList;
+ }
+
+ public List<ErrorDetailResource> getErrorDetails () throws RegistryException{
+ List<ErrorDetailResource> errorDetailResources = new ArrayList<ErrorDetailResource>();
+ List<Resource> resources = get(ResourceType.ERROR_DETAIL);
+ for (Resource resource : resources) {
+ ErrorDetailResource errorDetailResource = (ErrorDetailResource) resource;
+ errorDetailResources.add(errorDetailResource);
+ }
+ return errorDetailResources;
+ }
+
+ public ComputationSchedulingResource getComputationScheduling (String expId) throws RegistryException{
+ return (ComputationSchedulingResource)get(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, expId);
+ }
+
+ public AdvanceInputDataHandlingResource getInputDataHandling (String expId) throws RegistryException{
+ return (AdvanceInputDataHandlingResource)get(ResourceType.ADVANCE_INPUT_DATA_HANDLING, expId);
+ }
+
+ public AdvancedOutputDataHandlingResource getOutputDataHandling (String expId) throws RegistryException{
+ return (AdvancedOutputDataHandlingResource)get(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, expId);
+ }
+
+ public QosParamResource getQOSparams (String expId) throws RegistryException{
+ return (QosParamResource)get(ResourceType.QOS_PARAM, expId);
+ }
+
+ public ConfigDataResource getUserConfigData(String expID) throws RegistryException{
+ return (ConfigDataResource)get(ResourceType.CONFIG_DATA, expID);
+ }
+ public WorkflowNodeDetailResource getWorkflowNode (String nodeId) throws RegistryException{
+ return (WorkflowNodeDetailResource)get(ResourceType.WORKFLOW_NODE_DETAIL, nodeId);
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentSummaryResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentSummaryResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentSummaryResource.java
new file mode 100644
index 0000000..63d4e51
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentSummaryResource.java
@@ -0,0 +1,134 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.el.MethodNotFoundException;
+import java.sql.Timestamp;
+import java.util.List;
+
+public class ExperimentSummaryResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ExperimentSummaryResource.class);
+
+ private String executionUser;
+ private String expID;
+ private String projectID;
+ private Timestamp creationTime;
+ private String expName;
+ private String description;
+ private String applicationId;
+
+ private StatusResource status;
+
+ @Override
+ public Resource create(ResourceType type) throws RegistryException {
+ throw new MethodNotFoundException();
+ }
+
+ @Override
+ public void remove(ResourceType type, Object name) throws RegistryException {
+ throw new MethodNotFoundException();
+ }
+
+ @Override
+ public Resource get(ResourceType type, Object name) throws RegistryException {
+ throw new MethodNotFoundException();
+ }
+
+ @Override
+ public List<Resource> get(ResourceType type) throws RegistryException {
+ throw new MethodNotFoundException();
+ }
+
+ @Override
+ public void save() throws RegistryException {
+ throw new MethodNotFoundException();
+ }
+
+ public String getExecutionUser() {
+ return executionUser;
+ }
+
+ public void setExecutionUser(String executionUser) {
+ this.executionUser = executionUser;
+ }
+
+ public String getExpID() {
+ return expID;
+ }
+
+ public void setExpID(String expID) {
+ this.expID = expID;
+ }
+
+ public String getProjectID() {
+ return projectID;
+ }
+
+ public void setProjectID(String projectID) {
+ this.projectID = projectID;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getExpName() {
+ return expName;
+ }
+
+ public void setExpName(String expName) {
+ this.expName = expName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getApplicationId() {
+ return applicationId;
+ }
+
+ public void setApplicationId(String applicationId) {
+ this.applicationId = applicationId;
+ }
+
+ public StatusResource getStatus() {
+ return status;
+ }
+
+ public void setStatus(StatusResource status) {
+ this.status = status;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/GatewayResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/GatewayResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/GatewayResource.java
new file mode 100644
index 0000000..90c3062
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/GatewayResource.java
@@ -0,0 +1,437 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.*;
+import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GatewayResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(GatewayResource.class);
+
+ private String gatewayId;
+ private String gatewayName;
+ private String domain;
+ private String emailAddress;
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ public String getEmailAddress() {
+ return emailAddress;
+ }
+
+ public void setEmailAddress(String emailAddress) {
+ this.emailAddress = emailAddress;
+ }
+
+ /**
+ *
+ * @param gatewayId gateway name
+ */
+ public GatewayResource(String gatewayId) {
+ setGatewayId(gatewayId);
+ }
+
+ /**
+ *
+ */
+ public GatewayResource() {
+ }
+
+ /**
+ *
+ * @return gateway name
+ */
+ public String getGatewayName() {
+ return gatewayName;
+ }
+
+ /**
+ *
+ * @param gatewayName
+ */
+ public void setGatewayName(String gatewayName) {
+ this.gatewayName = gatewayName;
+ }
+
+ /**
+ *
+ * @return domain of the gateway
+ */
+ public String getDomain() {
+ return domain;
+ }
+
+ /**
+ *
+ * @param domain domain of the gateway
+ */
+ public void setDomain(String domain) {
+ this.domain = domain;
+ }
+
+
+ /**
+ * Gateway is at the root level. So it can populate his child resources.
+ * Project, User, Published Workflows, User workflows, Host descriptors,
+ * Service Descriptors, Application descriptors and Experiments are all
+ * its children
+ * @param type resource type of the children
+ * @return specific child resource type
+ */
+ public Resource create(ResourceType type) throws RegistryException {
+ switch (type) {
+ case PROJECT:
+ ProjectResource projectResource = new ProjectResource();
+ projectResource.setGatewayId(gatewayId);
+ return projectResource;
+ case EXPERIMENT:
+ ExperimentResource experimentResource =new ExperimentResource();
+ experimentResource.setGatewayId(gatewayId);
+ return experimentResource;
+ case GATEWAY_WORKER:
+ WorkerResource workerResource = new WorkerResource();
+ workerResource.setGatewayId(gatewayId);
+ return workerResource;
+ default:
+ logger.error("Unsupported resource type for gateway resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for gateway resource.");
+ }
+ }
+
+ /**
+ * Child resources can be removed from a gateway
+ * @param type child resource type
+ * @param name child resource name
+ */
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ switch (type) {
+ case USER:
+ generator = new QueryGenerator(USERS);
+ generator.setParameter(UserConstants.USERNAME, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case EXPERIMENT:
+ generator = new QueryGenerator(EXPERIMENT);
+ generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ default:
+ logger.error("Unsupported resource type for gateway resource.", new IllegalArgumentException());
+ break;
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ /**
+ * Gateway can get information of his children
+ * @param type child resource type
+ * @param name child resource name
+ * @return specific child resource type
+ */
+ public Resource get(ResourceType type, Object name) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator;
+ Query q;
+ switch (type) {
+ case GATEWAY_WORKER:
+ generator = new QueryGenerator(GATEWAY_WORKER);
+ generator.setParameter(GatewayWorkerConstants.USERNAME, name);
+ generator.setParameter(GatewayWorkerConstants.GATEWAY_ID, gatewayId);
+ q = generator.selectQuery(em);
+ Gateway_Worker worker = (Gateway_Worker) q.getSingleResult();
+ WorkerResource workerResource =
+ (WorkerResource) Utils.getResource(ResourceType.GATEWAY_WORKER, worker);
+ em.getTransaction().commit();
+ em.close();
+ return workerResource;
+ case USER:
+ generator = new QueryGenerator(USERS);
+ generator.setParameter(UserConstants.USERNAME, name);
+ q = generator.selectQuery(em);
+ Users user = (Users) q.getSingleResult();
+ UserResource userResource =
+ (UserResource) Utils.getResource(ResourceType.USER, user);
+ em.getTransaction().commit();
+ em.close();
+ return userResource;
+ case EXPERIMENT:
+ generator = new QueryGenerator(EXPERIMENT);
+ generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
+ q = generator.selectQuery(em);
+ Experiment experiment = (Experiment) q.getSingleResult();
+ ExperimentResource experimentResource =
+ (ExperimentResource) Utils.getResource(ResourceType.EXPERIMENT, experiment);
+ em.getTransaction().commit();
+ em.close();
+ return experimentResource;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for gateway resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for gateway resource.");
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ /**
+ *
+ * @param type child resource type
+ * @return list of child resources
+ */
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ List<Resource> resourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ List results;
+ switch (type) {
+ case PROJECT:
+ generator = new QueryGenerator(PROJECT);
+ Gateway gatewayModel = em.find(Gateway.class, gatewayId);
+ generator.setParameter("gateway", gatewayModel);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Project project = (Project) result;
+ ProjectResource projectResource =
+ (ProjectResource) Utils.getResource(ResourceType.PROJECT, project);
+ resourceList.add(projectResource);
+ }
+ }
+ break;
+ case GATEWAY_WORKER:
+ generator = new QueryGenerator(GATEWAY_WORKER);
+ generator.setParameter(GatewayWorkerConstants.GATEWAY_ID, gatewayId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Gateway_Worker gatewayWorker = (Gateway_Worker) result;
+ WorkerResource workerResource =
+ (WorkerResource) Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
+ resourceList.add(workerResource);
+ }
+ }
+ break;
+ case EXPERIMENT:
+ generator = new QueryGenerator(EXPERIMENT);
+ generator.setParameter(ExperimentConstants.GATEWAY_ID, gatewayId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Experiment experiment = (Experiment) result;
+ ExperimentResource experimentResource =
+ (ExperimentResource) Utils.getResource(ResourceType.EXPERIMENT, experiment);
+ resourceList.add(experimentResource);
+ }
+ }
+ break;
+ case USER:
+ generator = new QueryGenerator(USERS);
+ q = generator.selectQuery(em);
+ for (Object o : q.getResultList()) {
+ Users user = (Users) o;
+ UserResource userResource =
+ (UserResource) Utils.getResource(ResourceType.USER, user);
+ resourceList.add(userResource);
+ }
+ break;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for gateway resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for gateway resource.");
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return resourceList;
+ }
+
+ /**
+ * save the gateway to the database
+ */
+ public void save() throws RegistryException {
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ Gateway existingGateway = em.find(Gateway.class, gatewayId);
+ em.close();
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Gateway gateway = new Gateway();
+ gateway.setGateway_name(gatewayName);
+ gateway.setGateway_id(gatewayId);
+ gateway.setDomain(domain);
+ gateway.setEmailAddress(emailAddress);
+ if (existingGateway != null) {
+ existingGateway.setDomain(domain);
+ existingGateway.setGateway_name(gatewayName);
+ existingGateway.setEmailAddress(emailAddress);
+ gateway = em.merge(existingGateway);
+ } else {
+ em.persist(gateway);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+
+ }
+
+ /**
+ * check whether child resource already exist in the database
+ * @param type child resource type
+ * @param name name of the child resource
+ * @return true or false
+ */
+ public boolean isExists(ResourceType type, Object name) throws RegistryException{
+ EntityManager em = null;
+ try {
+ switch (type) {
+ case GATEWAY_WORKER:
+ em = ResourceUtils.getEntityManager();
+ Gateway_Worker existingWorker = em.find(Gateway_Worker.class, new Gateway_Worker_PK(gatewayId, name.toString()));
+ em.close();
+ return existingWorker != null;
+ case USER:
+ em = ResourceUtils.getEntityManager();
+ Users existingUser = em.find(Users.class, name);
+ em.close();
+ return existingUser != null;
+ case EXPERIMENT:
+ em = ResourceUtils.getEntityManager();
+ Experiment existingExp = em.find(Experiment.class, name.toString());
+ em.close();
+ return existingExp != null;
+ default:
+ logger.error("Unsupported resource type for gateway resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for gateway resource.");
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public ExperimentResource createExperiment (String experimentID) throws RegistryException{
+ ExperimentResource metadataResource = (ExperimentResource)create(ResourceType.EXPERIMENT);
+ metadataResource.setExpID(experimentID);
+ return metadataResource;
+ }
+
+ public ExperimentResource getExperiment (String expId) throws RegistryException{
+ return (ExperimentResource)get(ResourceType.EXPERIMENT, expId);
+ }
+
+ public List<ExperimentResource> getExperiments () throws RegistryException{
+ List<ExperimentResource> experiments = new ArrayList<ExperimentResource>();
+ List<Resource> resources = get(ResourceType.EXPERIMENT);
+ for (Resource resource : resources){
+ experiments.add((ExperimentResource)resource);
+ }
+ return experiments;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/JobDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/JobDetailResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/JobDetailResource.java
new file mode 100644
index 0000000..b8ee0fa
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/JobDetailResource.java
@@ -0,0 +1,376 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.*;
+import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.apache.airavata.registry.cpi.utils.StatusType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class JobDetailResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(JobDetailResource.class);
+ private String jobId;
+ private String taskId;
+ private String jobDescription;
+ private Timestamp creationTime;
+ private String computeResourceConsumed;
+ private String jobName;
+ private String workingDir;
+ private StatusResource jobStatus;
+ private List<ErrorDetailResource> errors;
+
+ public void setJobStatus(StatusResource jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+
+ public List<ErrorDetailResource> getErrors() {
+ return errors;
+ }
+
+ public void setErrors(List<ErrorDetailResource> errors) {
+ this.errors = errors;
+ }
+
+ public String getJobName() {
+ return jobName;
+ }
+
+ public void setJobName(String jobName) {
+ this.jobName = jobName;
+ }
+
+ public String getWorkingDir() {
+ return workingDir;
+ }
+
+ public void setWorkingDir(String workingDir) {
+ this.workingDir = workingDir;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getJobDescription() {
+ return jobDescription;
+ }
+
+ public void setJobDescription(String jobDescription) {
+ this.jobDescription = jobDescription;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getComputeResourceConsumed() {
+ return computeResourceConsumed;
+ }
+
+ public void setComputeResourceConsumed(String computeResourceConsumed) {
+ this.computeResourceConsumed = computeResourceConsumed;
+ }
+
+
+ public Resource create(ResourceType type) throws RegistryException {
+ switch (type){
+ case STATUS:
+ StatusResource statusResource = new StatusResource();
+ statusResource.setJobId(jobId);
+ return statusResource;
+ case ERROR_DETAIL:
+ ErrorDetailResource errorDetailResource = new ErrorDetailResource();
+ errorDetailResource.setJobId(jobId);
+ return errorDetailResource;
+ default:
+ logger.error("Unsupported resource type for job details data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ switch (type) {
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.JOB_ID, name);
+ generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.JOB.toString());
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case ERROR_DETAIL:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(ErrorDetailConstants.JOB_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ default:
+ logger.error("Unsupported resource type for job details resource.", new IllegalArgumentException());
+ break;
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+
+ public Resource get(ResourceType type, Object name) throws RegistryException {
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator;
+ Query q;
+ switch (type) {
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.JOB_ID, name);
+ generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.JOB.toString());
+ q = generator.selectQuery(em);
+ Status status = (Status) q.getSingleResult();
+ StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
+ em.getTransaction().commit();
+ em.close();
+ return statusResource;
+ case ERROR_DETAIL:
+ generator = new QueryGenerator(ERROR_DETAIL);
+ generator.setParameter(ErrorDetailConstants.JOB_ID, name);
+ q = generator.selectQuery(em);
+ ErrorDetail errorDetail = (ErrorDetail) q.getSingleResult();
+ ErrorDetailResource errorDetailResource = (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
+ em.getTransaction().commit();
+ em.close();
+ return errorDetailResource;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for job details resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for job details resource.");
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ List<Resource> resourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ List results;
+ switch (type) {
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.JOB_ID, jobId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Status status = (Status) result;
+ StatusResource statusResource =
+ (StatusResource) Utils.getResource(ResourceType.STATUS, status);
+ resourceList.add(statusResource);
+ }
+ }
+ break;
+ case ERROR_DETAIL:
+ generator = new QueryGenerator(ERROR_DETAIL);
+ generator.setParameter(ErrorDetailConstants.JOB_ID, jobId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ErrorDetail errorDetail = (ErrorDetail) result;
+ ErrorDetailResource errorDetailResource =
+ (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
+ resourceList.add(errorDetailResource);
+ }
+ }
+ break;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for workflow node details resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return resourceList;
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ JobDetail existingJobDetail = em.find(JobDetail.class, new JobDetails_PK(jobId, taskId));
+ em.close();
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ JobDetail jobDetail = new JobDetail();
+ jobDetail.setJobId(jobId);
+ jobDetail.setTaskId(taskId);
+ jobDetail.setCreationTime(creationTime);
+ jobDetail.setJobName(jobName);
+ jobDetail.setWorkingDir(workingDir);
+ if (jobDescription != null) {
+ jobDetail.setJobDescription(jobDescription.toCharArray());
+ }
+ jobDetail.setComputeResourceConsumed(computeResourceConsumed);
+ if (existingJobDetail != null) {
+ existingJobDetail.setJobId(jobId);
+ existingJobDetail.setTaskId(taskId);
+ existingJobDetail.setCreationTime(creationTime);
+ if (jobDescription != null) {
+ existingJobDetail.setJobDescription(jobDescription.toCharArray());
+ }
+ existingJobDetail.setComputeResourceConsumed(computeResourceConsumed);
+ existingJobDetail.setJobName(jobName);
+ existingJobDetail.setWorkingDir(workingDir);
+ jobDetail = em.merge(existingJobDetail);
+ } else {
+ em.persist(jobDetail);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public StatusResource getJobStatus() {
+ return jobStatus;
+ }
+
+ public StatusResource getJobStatus1() throws RegistryException{
+ List<Resource> resources = get(ResourceType.STATUS);
+ for (Resource resource : resources) {
+ StatusResource jobStatus = (StatusResource) resource;
+ if(jobStatus.getStatusType().equals(StatusType.JOB.toString())){
+ if (jobStatus.getState() == null || jobStatus.getState().equals("") ){
+ jobStatus.setState("UNKNOWN");
+ }
+ return jobStatus;
+ }
+ }
+ return null;
+ }
+
+ public StatusResource getApplicationStatus() throws RegistryException{
+ List<Resource> resources = get(ResourceType.STATUS);
+ for (Resource resource : resources) {
+ StatusResource appStatus = (StatusResource) resource;
+ if(appStatus.getStatusType().equals(StatusType.APPLICATION.toString())){
+ if (appStatus.getState() == null || appStatus.getState().equals("") ){
+ appStatus.setState("UNKNOWN");
+ }
+ return appStatus;
+ }
+ }
+ return null;
+ }
+
+ public List<ErrorDetailResource> getErrorDetails () throws RegistryException{
+ List<ErrorDetailResource> errorDetailResources = new ArrayList<ErrorDetailResource>();
+ List<Resource> resources = get(ResourceType.ERROR_DETAIL);
+ for(Resource resource : resources){
+ errorDetailResources.add((ErrorDetailResource)resource);
+ }
+ return errorDetailResources;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NodeInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NodeInputResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NodeInputResource.java
new file mode 100644
index 0000000..92aba23
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/NodeInputResource.java
@@ -0,0 +1,227 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.NodeInput;
+import org.apache.airavata.experiment.catalog.model.NodeInput_PK;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NodeInputResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(NodeInputResource.class);
+
+ private String nodeId;
+ private String inputKey;
+ private String dataType;
+ private String metadata;
+ private String value;
+ private String appArgument;
+ private boolean standardInput;
+ private String userFriendlyDesc;
+ private int inputOrder;
+ private boolean isRequired;
+ private boolean requiredToCMD;
+ private boolean dataStaged;
+
+ public boolean getRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean required) {
+ this.isRequired = required;
+ }
+
+ public boolean getRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean isDataStaged() {
+ return dataStaged;
+ }
+
+ public void setDataStaged(boolean dataStaged) {
+ this.dataStaged = dataStaged;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+
+ public boolean isStandardInput() {
+ return standardInput;
+ }
+
+ public void setStandardInput(boolean standardInput) {
+ this.standardInput = standardInput;
+ }
+
+ public String getUserFriendlyDesc() {
+ return userFriendlyDesc;
+ }
+
+ public void setUserFriendlyDesc(String userFriendlyDesc) {
+ this.userFriendlyDesc = userFriendlyDesc;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public String getInputKey() {
+ return inputKey;
+ }
+
+ public void setInputKey(String inputKey) {
+ this.inputKey = inputKey;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(String metadata) {
+ this.metadata = metadata;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public int getInputOrder() {
+ return inputOrder;
+ }
+
+ public void setInputOrder(int inputOrder) {
+ this.inputOrder = inputOrder;
+ }
+
+ public Resource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public Resource get(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<Resource> get(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for node input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ NodeInput existingInput = em.find(NodeInput.class, new NodeInput_PK(inputKey, nodeId));
+ em.close();
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ NodeInput nodeInput = new NodeInput();
+ nodeInput.setNodeId(nodeId);
+ nodeInput.setInputKey(inputKey);
+ nodeInput.setDataType(dataType);
+ nodeInput.setValue(value);
+ nodeInput.setMetadata(metadata);
+ nodeInput.setAppArgument(appArgument);
+ nodeInput.setStandardInput(standardInput);
+ nodeInput.setUserFriendlyDesc(userFriendlyDesc);
+ nodeInput.setInputOrder(inputOrder);
+ nodeInput.setRequiredToCMD(requiredToCMD);
+ nodeInput.setIsRequired(isRequired);
+ nodeInput.setDataStaged(dataStaged);
+
+ if (existingInput != null){
+ existingInput.setNodeId(nodeId);
+ existingInput.setInputKey(inputKey);
+ existingInput.setDataType(dataType);
+ existingInput.setValue(value);
+ existingInput.setMetadata(metadata);
+ existingInput.setAppArgument(appArgument);
+ existingInput.setStandardInput(standardInput);
+ existingInput.setUserFriendlyDesc(userFriendlyDesc);
+ existingInput.setInputOrder(inputOrder);
+ existingInput.setRequiredToCMD(requiredToCMD);
+ existingInput.setIsRequired(isRequired);
+ existingInput.setDataStaged(dataStaged);
+ nodeInput = em.merge(existingInput);
+ }else {
+ em.persist(nodeInput);
+ }
+ em.getTransaction().commit();
+ em.close();
+ }catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
[07/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ConfigDataResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ConfigDataResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ConfigDataResource.java
new file mode 100644
index 0000000..7038ede
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ConfigDataResource.java
@@ -0,0 +1,194 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.ExperimentConfigData;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import java.util.List;
+
+public class ConfigDataResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(ConfigDataResource.class);
+ private String experimentId;
+ private boolean airavataAutoSchedule;
+ private boolean overrideManualParams;
+ private boolean shareExp;
+ private String userDn;
+ private boolean generateCert;
+ private ComputationSchedulingResource computationSchedulingResource;
+ private AdvanceInputDataHandlingResource advanceInputDataHandlingResource;
+ private AdvancedOutputDataHandlingResource advancedOutputDataHandlingResource;
+ private QosParamResource qosParamResource;
+
+ public ComputationSchedulingResource getComputationSchedulingResource() {
+ return computationSchedulingResource;
+ }
+
+ public void setComputationSchedulingResource(ComputationSchedulingResource computationSchedulingResource) {
+ this.computationSchedulingResource = computationSchedulingResource;
+ }
+
+ public AdvanceInputDataHandlingResource getAdvanceInputDataHandlingResource() {
+ return advanceInputDataHandlingResource;
+ }
+
+ public void setAdvanceInputDataHandlingResource(AdvanceInputDataHandlingResource advanceInputDataHandlingResource) {
+ this.advanceInputDataHandlingResource = advanceInputDataHandlingResource;
+ }
+
+ public AdvancedOutputDataHandlingResource getAdvancedOutputDataHandlingResource() {
+ return advancedOutputDataHandlingResource;
+ }
+
+ public void setAdvancedOutputDataHandlingResource(AdvancedOutputDataHandlingResource advancedOutputDataHandlingResource) {
+ this.advancedOutputDataHandlingResource = advancedOutputDataHandlingResource;
+ }
+
+ public QosParamResource getQosParamResource() {
+ return qosParamResource;
+ }
+
+ public void setQosParamResource(QosParamResource qosParamResource) {
+ this.qosParamResource = qosParamResource;
+ }
+
+ public String getUserDn() {
+ return userDn;
+ }
+
+ public void setUserDn(String userDn) {
+ this.userDn = userDn;
+ }
+
+ public boolean isGenerateCert() {
+ return generateCert;
+ }
+
+ public void setGenerateCert(boolean generateCert) {
+ this.generateCert = generateCert;
+ }
+
+ public String getExperimentId() {
+ return experimentId;
+ }
+
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
+ }
+
+ public boolean isAiravataAutoSchedule() {
+ return airavataAutoSchedule;
+ }
+
+ public void setAiravataAutoSchedule(boolean airavataAutoSchedule) {
+ this.airavataAutoSchedule = airavataAutoSchedule;
+ }
+
+ public boolean isOverrideManualParams() {
+ return overrideManualParams;
+ }
+
+ public void setOverrideManualParams(boolean overrideManualParams) {
+ this.overrideManualParams = overrideManualParams;
+ }
+
+ public boolean isShareExp() {
+ return shareExp;
+ }
+
+ public void setShareExp(boolean shareExp) {
+ this.shareExp = shareExp;
+ }
+
+
+ public Resource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for config data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for config data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public Resource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for config data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for config data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ ExperimentConfigData existingConfig = em.find(ExperimentConfigData.class, experimentId);
+ em.close();
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ ExperimentConfigData configData = new ExperimentConfigData();
+ configData.setExpId(experimentId);
+ configData.setAiravataAutoSchedule(airavataAutoSchedule);
+ configData.setOverrideManualParams(overrideManualParams);
+ configData.setShareExp(shareExp);
+ configData.setUserDn(userDn);
+ configData.setGenerateCert(generateCert);
+ if (existingConfig != null) {
+ existingConfig.setExpId(experimentId);
+ existingConfig.setAiravataAutoSchedule(airavataAutoSchedule);
+ existingConfig.setOverrideManualParams(overrideManualParams);
+ existingConfig.setShareExp(shareExp);
+ existingConfig.setUserDn(userDn);
+ existingConfig.setGenerateCert(generateCert);
+ configData = em.merge(existingConfig);
+ } else {
+ em.persist(configData);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ConfigurationResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ConfigurationResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ConfigurationResource.java
new file mode 100644
index 0000000..a6e9d5e
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ConfigurationResource.java
@@ -0,0 +1,204 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import java.sql.Timestamp;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.Configuration;
+import org.apache.airavata.experiment.catalog.model.Configuration_PK;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ConfigurationResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ConfigurationResource.class);
+ private String configKey;
+ private String configVal;
+ private Timestamp expireDate;
+ private String categoryID = ConfigurationConstants.CATEGORY_ID_DEFAULT_VALUE;
+
+ public ConfigurationResource() {
+ }
+
+ /**
+ * @param configKey configuration key
+ * @param configVal configuration value
+ */
+ public ConfigurationResource(String configKey, String configVal) {
+ this.configKey = configKey;
+ this.configVal = configVal;
+ }
+
+ /**
+ * Since Configuration does not depend on any other data structures at the
+ * system, this method is not valid
+ *
+ * @param type child resource types
+ * @return UnsupportedOperationException
+ */
+ public Resource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported operation for configuration resource " +
+ "since there are no child resources generated by configuration resource.. ",
+ new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Since Configuration does not depend on any other data structures at the
+ * system, this method is not valid
+ *
+ * @param type child resource types
+ * @param name name of the child resource
+ * throws UnsupportedOperationException
+ */
+ public void remove(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported operation for configuration resource " +
+ "since there are no child resources generated by configuration resource.. ",
+ new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ /**
+ * Since Configuration does not depend on any other data structures at the
+ * system, this method is not valid
+ *
+ * @param type child resource types
+ * @param name name of the child resource
+ * @return UnsupportedOperationException
+ */
+ public Resource get(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported operation for configuration resource " +
+ "since there are no child resources generated by configuration resource.. ",
+ new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Since Configuration does not depend on any other data structures at the
+ * system, this method is not valid
+ *
+ * @param type child resource types
+ * @return UnsupportedOperationException
+ */
+ public List<Resource> get(ResourceType type) throws RegistryException {
+ logger.error("Unsupported operation for configuration resource " +
+ "since there are no child resources generated by configuration resource.. ",
+ new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @param expireDate expire date of the configuration
+ */
+ public void setExpireDate(Timestamp expireDate) {
+ this.expireDate = expireDate;
+ }
+
+ /**
+ * save configuration to database
+ */
+ public synchronized void save() throws RegistryException {
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ //whether existing
+ Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey, configVal, categoryID));
+ em.close();
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Configuration configuration = new Configuration();
+ configuration.setConfig_key(configKey);
+ configuration.setConfig_val(configVal);
+ configuration.setExpire_date(expireDate);
+ configuration.setCategory_id(categoryID);
+ if (existing != null) {
+ existing.setExpire_date(expireDate);
+ existing.setCategory_id(categoryID);
+ configuration = em.merge(existing);
+ } else {
+ em.persist(configuration);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ /**
+ * Since Configuration does not depend on any other data structures at the
+ * system, this method is not valid
+ *
+ * @param type child resource types
+ * @param name of the child resource
+ * @return UnsupportedOperationException
+ */
+ public boolean isExists(ResourceType type, Object name) {
+ logger.error("Unsupported operation for configuration resource " +
+ "since there are no child resources generated by configuration resource.. ",
+ new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @return configuration value
+ */
+ public String getConfigVal() {
+ return configVal;
+ }
+
+ /**
+ * @param configKey configuration key
+ */
+ public void setConfigKey(String configKey) {
+ this.configKey = configKey;
+ }
+
+ /**
+ * @param configVal configuration value
+ */
+ public void setConfigVal(String configVal) {
+ this.configVal = configVal;
+ }
+
+ public String getCategoryID() {
+ return categoryID;
+ }
+
+ public void setCategoryID(String categoryID) {
+ this.categoryID = categoryID;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/DataTransferDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/DataTransferDetailResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/DataTransferDetailResource.java
new file mode 100644
index 0000000..5e48333
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/DataTransferDetailResource.java
@@ -0,0 +1,276 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.DataTransferDetail;
+import org.apache.airavata.experiment.catalog.model.Status;
+import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.apache.airavata.registry.cpi.utils.StatusType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class DataTransferDetailResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(DataTransferDetailResource.class);
+ private String transferId;
+ private String taskId;
+ private Timestamp creationTime;
+ private String transferDescription;
+ private StatusResource datatransferStatus;
+
+ public StatusResource getDatatransferStatus() {
+ return datatransferStatus;
+ }
+
+ public void setDatatransferStatus(StatusResource datatransferStatus) {
+ this.datatransferStatus = datatransferStatus;
+ }
+
+ public String getTransferId() {
+ return transferId;
+ }
+
+ public void setTransferId(String transferId) {
+ this.transferId = transferId;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getTransferDescription() {
+ return transferDescription;
+ }
+
+ public void setTransferDescription(String transferDescription) {
+ this.transferDescription = transferDescription;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public Resource create(ResourceType type) throws RegistryException {
+ switch (type){
+ case STATUS:
+ StatusResource statusResource = new StatusResource();
+ statusResource.setTransferId(transferId);
+ return statusResource;
+ default:
+ logger.error("Unsupported resource type for data transfer details data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException {
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ switch (type) {
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.TRANSFER_ID, name);
+ generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.DATA_TRANSFER);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ default:
+ logger.error("Unsupported resource type for data transfer details resource.", new IllegalArgumentException());
+ break;
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+
+ public Resource get(ResourceType type, Object name) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator;
+ Query q;
+ switch (type) {
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.TRANSFER_ID, name);
+ generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.DATA_TRANSFER);
+ q = generator.selectQuery(em);
+ Status status = (Status) q.getSingleResult();
+ StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
+ em.getTransaction().commit();
+ em.close();
+ return statusResource;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for data transfer details resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for data transfer details resource.");
+ }
+ } catch (Exception e) {
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ List<Resource> resourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ List results;
+ switch (type) {
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.TRANSFER_ID, transferId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Status status = (Status) result;
+ StatusResource statusResource =
+ (StatusResource) Utils.getResource(ResourceType.STATUS, status);
+ resourceList.add(statusResource);
+ }
+ }
+ break;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for workflow node details resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return resourceList;
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ DataTransferDetail existingDF = em.find(DataTransferDetail.class, transferId);
+ em.close();
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ DataTransferDetail dataTransferDetail = new DataTransferDetail();
+ dataTransferDetail.setTransferId(transferId);
+ dataTransferDetail.setTaskId(taskId);
+ dataTransferDetail.setCreationTime(creationTime);
+ if (transferDescription != null) {
+ dataTransferDetail.setTransferDesc(transferDescription.toCharArray());
+ }
+ if (existingDF != null) {
+ existingDF.setTransferId(transferId);
+ existingDF.setTaskId(taskId);
+ existingDF.setCreationTime(creationTime);
+ if (transferDescription != null) {
+ existingDF.setTransferDesc(transferDescription.toCharArray());
+ }
+ dataTransferDetail = em.merge(existingDF);
+ } else {
+ em.persist(dataTransferDetail);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public StatusResource getDataTransferStatus () throws RegistryException{
+ List<Resource> resources = get(ResourceType.STATUS);
+ for (Resource resource : resources) {
+ StatusResource dataTransferStatus = (StatusResource) resource;
+ if(dataTransferStatus.getStatusType().equals(StatusType.DATA_TRANSFER.toString())){
+ if (dataTransferStatus.getState() == null || dataTransferStatus.getState().equals("") ){
+ dataTransferStatus.setState("UNKNOWN");
+ }
+ return dataTransferStatus;
+ }
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ErrorDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ErrorDetailResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ErrorDetailResource.java
new file mode 100644
index 0000000..f2426fc
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ErrorDetailResource.java
@@ -0,0 +1,215 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.ErrorDetail;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import java.sql.Timestamp;
+import java.util.List;
+
+public class ErrorDetailResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(ErrorDetailResource.class);
+ private int errorId;
+ private String experimentId;
+ private String taskId;
+ private String nodeId;
+ private Timestamp creationTime;
+ private String actualErrorMsg;
+ private String userFriendlyErrorMsg;
+ private boolean transientPersistent;
+ private String errorCategory;
+ private String correctiveAction;
+ private String actionableGroup;
+ private String jobId;
+
+ public int getErrorId() {
+ return errorId;
+ }
+
+ public void setErrorId(int errorId) {
+ this.errorId = errorId;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getActualErrorMsg() {
+ return actualErrorMsg;
+ }
+
+ public void setActualErrorMsg(String actualErrorMsg) {
+ this.actualErrorMsg = actualErrorMsg;
+ }
+
+ public String getUserFriendlyErrorMsg() {
+ return userFriendlyErrorMsg;
+ }
+
+ public String getExperimentId() {
+ return experimentId;
+ }
+
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public void setUserFriendlyErrorMsg(String userFriendlyErrorMsg) {
+ this.userFriendlyErrorMsg = userFriendlyErrorMsg;
+ }
+
+ public boolean isTransientPersistent() {
+ return transientPersistent;
+ }
+
+ public void setTransientPersistent(boolean transientPersistent) {
+ this.transientPersistent = transientPersistent;
+ }
+
+ public String getErrorCategory() {
+ return errorCategory;
+ }
+
+ public void setErrorCategory(String errorCategory) {
+ this.errorCategory = errorCategory;
+ }
+
+ public String getCorrectiveAction() {
+ return correctiveAction;
+ }
+
+ public void setCorrectiveAction(String correctiveAction) {
+ this.correctiveAction = correctiveAction;
+ }
+
+ public String getActionableGroup() {
+ return actionableGroup;
+ }
+
+ public void setActionableGroup(String actionableGroup) {
+ this.actionableGroup = actionableGroup;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+
+ public Resource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public Resource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ ErrorDetail errorDetail;
+ if (errorId != 0) {
+ errorDetail = em.find(ErrorDetail.class, errorId);
+ errorDetail.setErrorID(errorId);
+ } else {
+ errorDetail = new ErrorDetail();
+ }
+ errorDetail.setErrorID(errorId);
+ errorDetail.setExpId(experimentId);
+ errorDetail.setTaskId(taskId);
+ errorDetail.setNodeId(nodeId);
+ errorDetail.setCreationTime(creationTime);
+ if (actualErrorMsg != null){
+ errorDetail.setActualErrorMsg(actualErrorMsg.toCharArray());
+ }
+
+ errorDetail.setUserFriendlyErrorMsg(userFriendlyErrorMsg);
+ errorDetail.setTransientPersistent(transientPersistent);
+ errorDetail.setErrorCategory(errorCategory);
+ errorDetail.setCorrectiveAction(correctiveAction);
+ errorDetail.setActionableGroup(actionableGroup);
+ errorDetail.setJobId(jobId);
+ em.persist(errorDetail);
+ errorId = errorDetail.getErrorID();
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentInputResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentInputResource.java
new file mode 100644
index 0000000..edd487b
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentInputResource.java
@@ -0,0 +1,225 @@
+/*
+*
+* 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.Experiment_Input;
+import org.apache.airavata.experiment.catalog.model.Experiment_Input_PK;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import java.util.List;
+
+public class ExperimentInputResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(ExperimentInputResource.class);
+
+ private String experimentId;
+ private String experimentKey;
+ private String value;
+ private String metadata;
+ private String dataType;
+ private String appArgument;
+ private boolean standardInput;
+ private String userFriendlyDesc;
+ private int inputOrder;
+ private boolean isRequired;
+ private boolean requiredToCMD;
+ private boolean dataStaged;
+
+ public boolean getRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean required) {
+ this.isRequired = required;
+ }
+
+ public boolean getRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean isDataStaged() {
+ return dataStaged;
+ }
+
+ public void setDataStaged(boolean dataStaged) {
+ this.dataStaged = dataStaged;
+ }
+
+ public int getInputOrder() {
+ return inputOrder;
+ }
+
+ public void setInputOrder(int inputOrder) {
+ this.inputOrder = inputOrder;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+
+ public boolean isStandardInput() {
+ return standardInput;
+ }
+
+ public void setStandardInput(boolean standardInput) {
+ this.standardInput = standardInput;
+ }
+
+ public String getUserFriendlyDesc() {
+ return userFriendlyDesc;
+ }
+
+ public void setUserFriendlyDesc(String userFriendlyDesc) {
+ this.userFriendlyDesc = userFriendlyDesc;
+ }
+
+ public String getExperimentKey() {
+ return experimentKey;
+ }
+
+ public void setExperimentKey(String experimentKey) {
+ this.experimentKey = experimentKey;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getExperimentId() {
+ return experimentId;
+ }
+
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(String metadata) {
+ this.metadata = metadata;
+ }
+
+ public Resource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ public Resource get(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ public List<Resource> get(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ Experiment_Input existingInput = em.find(Experiment_Input.class, new Experiment_Input_PK(experimentId, experimentKey));
+ em.close();
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Experiment_Input exInput = new Experiment_Input();
+ exInput.setEx_key(experimentKey);
+ exInput.setExperiment_id(experimentId);
+ if (value != null){
+ exInput.setValue(value.toCharArray());
+ }
+ exInput.setDataType(dataType);
+ exInput.setMetadata(metadata);
+ exInput.setAppArgument(appArgument);
+ exInput.setStandardInput(standardInput);
+ exInput.setUserFriendlyDesc(userFriendlyDesc);
+ exInput.setInputOrder(inputOrder);
+ exInput.setRequiredToCMD(requiredToCMD);
+ exInput.setRequired(isRequired);
+ exInput.setDataStaged(dataStaged);
+ if (existingInput != null) {
+ existingInput.setEx_key(experimentKey);
+ existingInput.setExperiment_id(experimentId);
+ if (value != null){
+ existingInput.setValue(value.toCharArray());
+ }
+ existingInput.setDataType(dataType);
+ existingInput.setMetadata(metadata);
+ existingInput.setAppArgument(appArgument);
+ existingInput.setStandardInput(standardInput);
+ existingInput.setUserFriendlyDesc(userFriendlyDesc);
+ existingInput.setInputOrder(inputOrder);
+ existingInput.setRequiredToCMD(requiredToCMD);
+ existingInput.setRequired(isRequired);
+ existingInput.setDataStaged(dataStaged);
+ exInput = em.merge(existingInput);
+ } else {
+ em.persist(exInput);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentOutputResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentOutputResource.java
new file mode 100644
index 0000000..6a11adc
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ExperimentOutputResource.java
@@ -0,0 +1,204 @@
+/*
+*
+* 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.Experiment_Output;
+import org.apache.airavata.experiment.catalog.model.Experiment_Output_PK;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import java.util.List;
+
+public class ExperimentOutputResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(ExperimentOutputResource.class);
+
+ private String experimentId;
+ private String experimentKey;
+ private String value;
+ private String dataType;
+ private boolean isRequired;
+ private boolean dataMovement;
+ private String dataNameLocation;
+ private boolean requiredToCMD;
+ private String searchQuery;
+ private String appArgument;
+
+ public String getSearchQuery() {
+ return searchQuery;
+ }
+
+ public void setSearchQuery(String searchQuery) {
+ this.searchQuery = searchQuery;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+
+ public boolean getRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean getRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean required) {
+ this.isRequired = required;
+ }
+
+ public boolean isDataMovement() {
+ return dataMovement;
+ }
+
+ public void setDataMovement(boolean dataMovement) {
+ this.dataMovement = dataMovement;
+ }
+
+ public String getDataNameLocation() {
+ return dataNameLocation;
+ }
+
+ public void setDataNameLocation(String dataNameLocation) {
+ this.dataNameLocation = dataNameLocation;
+ }
+
+ public String getExperimentKey() {
+ return experimentKey;
+ }
+
+ public void setExperimentKey(String experimentKey) {
+ this.experimentKey = experimentKey;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getExperimentId() {
+ return experimentId;
+ }
+
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public Resource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ public Resource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ public List<Resource> get(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+ public void save() throws RegistryException {
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ Experiment_Output existingOutput = em.find(Experiment_Output.class, new Experiment_Output_PK(experimentId, experimentKey));
+ em.close();
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Experiment_Output exOutput = new Experiment_Output();
+ exOutput.setEx_key(experimentKey);
+ exOutput.setExperiment_id(experimentId);
+ if (value != null){
+ exOutput.setValue(value.toCharArray());
+ }
+ exOutput.setDataType(dataType);
+ exOutput.setRequired(isRequired);
+ exOutput.setRequiredToCMD(requiredToCMD);
+ exOutput.setDataMovement(dataMovement);
+ exOutput.setDataNameLocation(dataNameLocation);
+ exOutput.setApplicationArgument(appArgument);
+ exOutput.setSearchQuery(searchQuery);
+
+ if (existingOutput != null) {
+ existingOutput.setEx_key(experimentKey);
+ existingOutput.setExperiment_id(experimentId);
+ if (value != null){
+ existingOutput.setValue(value.toCharArray());
+ }
+ existingOutput.setDataType(dataType);
+ existingOutput.setRequired(isRequired);
+ existingOutput.setRequiredToCMD(requiredToCMD);
+ existingOutput.setDataMovement(dataMovement);
+ existingOutput.setDataNameLocation(dataNameLocation);
+ existingOutput.setApplicationArgument(appArgument);
+ existingOutput.setSearchQuery(searchQuery);
+ exOutput = em.merge(existingOutput);
+ } else {
+ em.persist(exOutput);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
[21/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ApplicationOutput.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ApplicationOutput.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ApplicationOutput.java
deleted file mode 100644
index 33ed202..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ApplicationOutput.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "APPLICATION_OUTPUT")
-@IdClass(ApplicationOutput_PK.class)
-public class ApplicationOutput implements Serializable {
- @Id
- @Column(name = "TASK_ID")
- private String taskId;
- @Id
- @Column(name = "OUTPUT_KEY")
- private String outputKey;
- @Column(name = "DATA_TYPE")
- private String dataType;
- @Lob
- @Column(name = "VALUE")
- private char[] value;
-
- @Column(name = "IS_REQUIRED")
- private boolean isRequired;
- @Column(name="REQUIRED_TO_COMMANDLINE")
- private boolean addedToCmd;
- @Column(name = "DATA_MOVEMENT")
- private boolean dataMovement;
- @Column(name = "DATA_NAME_LOCATION")
- private String dataNameLocation;
- @Column(name = "SEARCH_QUERY")
- private String searchQuery;
- @Column(name = "APP_ARGUMENT")
- private String applicationArgument;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public char[] getValue() {
- return value;
- }
-
- public void setValue(char[] value) {
- this.value = value;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isAddedToCmd() {
- return addedToCmd;
- }
-
- public void setAddedToCmd(boolean addedToCmd) {
- this.addedToCmd = addedToCmd;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-
- public String getSearchQuery() {
- return searchQuery;
- }
-
- public void setSearchQuery(String searchQuery) {
- this.searchQuery = searchQuery;
- }
-
- public String getApplicationArgument() {
- return applicationArgument;
- }
-
- public void setApplicationArgument(String applicationArgument) {
- this.applicationArgument = applicationArgument;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ApplicationOutput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ApplicationOutput_PK.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ApplicationOutput_PK.java
deleted file mode 100644
index 17a5021..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ApplicationOutput_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import java.io.Serializable;
-
-public class ApplicationOutput_PK implements Serializable {
- private String taskId;
- private String outputKey;
-
- public ApplicationOutput_PK(String outputKey, String taskId) {
- this.outputKey = outputKey;
- this.taskId = taskId;
- }
-
- public ApplicationOutput_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Computational_Resource_Scheduling.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Computational_Resource_Scheduling.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Computational_Resource_Scheduling.java
deleted file mode 100644
index 484a08b..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Computational_Resource_Scheduling.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@DataCache
-@Entity
-@Table(name = "COMPUTATIONAL_RESOURCE_SCHEDULING")
-public class Computational_Resource_Scheduling implements Serializable {
- @Id
- @GeneratedValue
- @Column(name = "RESOURCE_SCHEDULING_ID")
- private int schedulingId;
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "RESOURCE_HOST_ID")
- private String resourceHostId;
- @Column(name = "CPU_COUNT")
- private int cpuCount;
- @Column(name = "NODE_COUNT")
- private int nodeCount;
- @Column(name = "NO_OF_THREADS")
- private int numberOfThreads;
- @Column(name = "QUEUE_NAME")
- private String queueName;
- @Column(name = "WALLTIME_LIMIT")
- private int wallTimeLimit;
- @Column(name = "JOB_START_TIME")
- private Timestamp jobStartTime;
- @Column(name = "TOTAL_PHYSICAL_MEMORY")
- private int totalPhysicalmemory;
- @Column(name = "COMPUTATIONAL_PROJECT_ACCOUNT")
- private String projectName;
- @Column(name = "CHESSIS_NAME")
- private String chessisName;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- public String getChessisName() {
- return chessisName;
- }
-
- public void setChessisName(String chessisName) {
- this.chessisName = chessisName;
- }
-
- public int getSchedulingId() {
- return schedulingId;
- }
-
- public void setSchedulingId(int schedulingId) {
- this.schedulingId = schedulingId;
- }
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getResourceHostId() {
- return resourceHostId;
- }
-
- public void setResourceHostId(String resourceHostId) {
- this.resourceHostId = resourceHostId;
- }
-
- public int getCpuCount() {
- return cpuCount;
- }
-
- public void setCpuCount(int cpuCount) {
- this.cpuCount = cpuCount;
- }
-
- public int getNodeCount() {
- return nodeCount;
- }
-
- public void setNodeCount(int nodeCount) {
- this.nodeCount = nodeCount;
- }
-
- public int getNumberOfThreads() {
- return numberOfThreads;
- }
-
- public void setNumberOfThreads(int numberOfThreads) {
- this.numberOfThreads = numberOfThreads;
- }
-
- public String getQueueName() {
- return queueName;
- }
-
- public void setQueueName(String queueName) {
- this.queueName = queueName;
- }
-
- public int getWallTimeLimit() {
- return wallTimeLimit;
- }
-
- public void setWallTimeLimit(int wallTimeLimit) {
- this.wallTimeLimit = wallTimeLimit;
- }
-
- public Timestamp getJobStartTime() {
- return jobStartTime;
- }
-
- public void setJobStartTime(Timestamp jobStartTime) {
- this.jobStartTime = jobStartTime;
- }
-
- public int getTotalPhysicalmemory() {
- return totalPhysicalmemory;
- }
-
- public void setTotalPhysicalmemory(int totalPhysicalmemory) {
- this.totalPhysicalmemory = totalPhysicalmemory;
- }
-
- public String getProjectName() {
- return projectName;
- }
-
- public void setProjectName(String projectName) {
- this.projectName = projectName;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java
deleted file mode 100644
index a7a1d4f..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@DataCache
-@Entity
-@Table(name ="CONFIGURATION")
-@IdClass(Configuration_PK.class)
-public class Configuration implements Serializable {
- @Id
- @Column(name = "CONFIG_KEY")
- private String config_key;
-
- @Id
- @Column(name = "CONFIG_VAL")
- private String config_val;
-
- @Id
- @Column(name = "CATEGORY_ID")
- private String category_id;
-
- @Column(name = "EXPIRE_DATE")
- private Timestamp expire_date;
-
- public String getConfig_key() {
- return config_key;
- }
-
- public String getConfig_val() {
- return config_val;
- }
-
- public Timestamp getExpire_date() {
- return expire_date;
- }
-
- public void setConfig_key(String config_key) {
- this.config_key = config_key;
- }
-
- public void setConfig_val(String config_val) {
- this.config_val = config_val;
- }
-
- public void setExpire_date(Timestamp expire_date) {
- this.expire_date = expire_date;
- }
-
- public String getCategory_id() {
- return category_id;
- }
-
- public void setCategory_id(String category_id) {
- this.category_id = category_id;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration_PK.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration_PK.java
deleted file mode 100644
index b58fd71..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Configuration_PK.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import java.io.Serializable;
-
-public class Configuration_PK implements Serializable {
- private String config_key;
- private String config_val;
- private String category_id;
-
- public Configuration_PK(String config_key, String config_val, String category_id) {
- this.config_key = config_key;
- this.config_val = config_val;
- this.category_id = category_id;
- }
-
- public Configuration_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getConfig_key() {
- return config_key;
- }
-
- public void setConfig_key(String config_key) {
- this.config_key = config_key;
- }
-
- public void setConfig_val(String config_val) {
- this.config_val = config_val;
- }
-
- public String getConfig_val() {
- return config_val;
- }
-
- public String getCategory_id() {
- return category_id;
- }
-
- public void setCategory_id(String category_id) {
- this.category_id = category_id;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/DataTransferDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/DataTransferDetail.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/DataTransferDetail.java
deleted file mode 100644
index 2d1ac2e..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/DataTransferDetail.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-import org.apache.openjpa.persistence.jdbc.ElementJoinColumn;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@DataCache
-@Entity
-@Table(name = "DATA_TRANSFER_DETAIL")
-public class DataTransferDetail implements Serializable {
- @Id
- @Column(name = "TRANSFER_ID")
- private String transferId;
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
- @Lob
- @Column(name = "TRANSFER_DESC")
- private char[] transferDesc;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "transferDetail")
- private Status dataTransferStatus;
-
- public String getTransferId() {
- return transferId;
- }
-
- public void setTransferId(String transferId) {
- this.transferId = transferId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public char[] getTransferDesc() {
- return transferDesc;
- }
-
- public void setTransferDesc(char[] transferDesc) {
- this.transferDesc = transferDesc;
- }
-
- public Status getDataTransferStatus() {
- return dataTransferStatus;
- }
-
- public void setDataTransferStatus(Status dataTransferStatus) {
- this.dataTransferStatus = dataTransferStatus;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ErrorDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ErrorDetail.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ErrorDetail.java
deleted file mode 100644
index 03c2965..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ErrorDetail.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@DataCache
-@Entity
-@Table(name = "ERROR_DETAIL")
-public class ErrorDetail implements Serializable {
- @Id
- @GeneratedValue
- @Column(name = "ERROR_ID")
- private int errorID;
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "NODE_INSTANCE_ID")
- private String nodeId;
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
- @Lob
- @Column(name = "ACTUAL_ERROR_MESSAGE")
- private char[] actualErrorMsg;
-
- @Column(name = "USER_FRIEDNLY_ERROR_MSG")
- private String userFriendlyErrorMsg;
- @Column(name = "TRANSIENT_OR_PERSISTENT")
- private boolean transientPersistent;
- @Column(name = "ERROR_CATEGORY")
- private String errorCategory;
- @Column(name = "CORRECTIVE_ACTION")
- private String correctiveAction;
- @Column(name = "ACTIONABLE_GROUP")
- private String actionableGroup;
- @Column(name = "JOB_ID")
- private String jobId;
-
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "NODE_INSTANCE_ID")
- private WorkflowNodeDetail nodeDetail;
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "JOB_ID")
- private JobDetail jobDetail;
-
- public int getErrorID() {
- return errorID;
- }
-
- public void setErrorID(int errorID) {
- this.errorID = errorID;
- }
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public char[] getActualErrorMsg() {
- return actualErrorMsg;
- }
-
- public void setActualErrorMsg(char[] actualErrorMsg) {
- this.actualErrorMsg = actualErrorMsg;
- }
-
- public String getUserFriendlyErrorMsg() {
- return userFriendlyErrorMsg;
- }
-
- public void setUserFriendlyErrorMsg(String userFriendlyErrorMsg) {
- this.userFriendlyErrorMsg = userFriendlyErrorMsg;
- }
-
- public boolean isTransientPersistent() {
- return transientPersistent;
- }
-
- public void setTransientPersistent(boolean transientPersistent) {
- this.transientPersistent = transientPersistent;
- }
-
- public String getErrorCategory() {
- return errorCategory;
- }
-
- public void setErrorCategory(String errorCategory) {
- this.errorCategory = errorCategory;
- }
-
- public String getActionableGroup() {
- return actionableGroup;
- }
-
- public void setActionableGroup(String actionableGroup) {
- this.actionableGroup = actionableGroup;
- }
-
- public String getCorrectiveAction() {
- return correctiveAction;
- }
-
- public void setCorrectiveAction(String correctiveAction) {
- this.correctiveAction = correctiveAction;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java
deleted file mode 100644
index 5b94e82..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-*/
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-import org.apache.openjpa.persistence.jdbc.ElementJoinColumn;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.List;
-
-@Entity
-@Table(name = "EXPERIMENT")
-@DataCache
-public class Experiment implements Serializable {
- @Id
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Column(name = "GATEWAY_ID")
- private String gatewayId;
- @Column(name = "EXECUTION_USER")
- private String executionUser;
- @Column(name = "PROJECT_ID")
- private String projectID;
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
- @Column(name = "EXPERIMENT_NAME")
- private String expName;
- @Column(name = "EXPERIMENT_DESCRIPTION")
- private String expDesc;
- @Column(name = "APPLICATION_ID")
- private String applicationId;
- @Column(name = "APPLICATION_VERSION")
- private String appVersion;
- @Column(name = "WORKFLOW_TEMPLATE_ID")
- private String workflowTemplateId;
- @Column(name = "WORKFLOW_TEMPLATE_VERSION")
- private String workflowTemplateVersion;
- @Column(name = "WORKFLOW_EXECUTION_ID")
- private String workflowExecutionId;
- @Column(name = "ALLOW_NOTIFICATION")
- private boolean allowNotification;
- @Column(name = "GATEWAY_EXECUTION_ID")
- private String gatewayExecutionId;
-
- @ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.MERGE)
- @JoinColumn(name = "GATEWAY_ID")
- private Gateway gateway;
-
- @ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.MERGE)
- @JoinColumn(name = "PROJECT_ID")
- private Project project;
-
- @ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.MERGE)
- @JoinColumn(name = "EXECUTION_USER", referencedColumnName = "USER_NAME")
- private Users user;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
- private List<Experiment_Output> experimentOutputs;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
- private List<Experiment_Input> experimentInputs;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
- private Computational_Resource_Scheduling resourceScheduling;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
- private ExperimentConfigData userConfigurationData;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
- private List<WorkflowNodeDetail> workflowNodeDetails;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
- private List<Status> stateChangeList;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
- private List<ErrorDetail> errorDetails;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
- private Status experimentStatus;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "experiment")
- private List<Notification_Email> notificationEmails;
-
- @OneToMany(fetch=FetchType.LAZY, mappedBy = "experiment")
- private Collection<Status> statuses;
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public String getExecutionUser() {
- return executionUser;
- }
-
- public void setExecutionUser(String executionUser) {
- this.executionUser = executionUser;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getExpName() {
- return expName;
- }
-
- public void setExpName(String expName) {
- this.expName = expName;
- }
-
- public String getExpDesc() {
- return expDesc;
- }
-
- public void setExpDesc(String expDesc) {
- this.expDesc = expDesc;
- }
-
- public String getApplicationId() {
- return applicationId;
- }
-
- public void setApplicationId(String applicationId) {
- this.applicationId = applicationId;
- }
-
- public String getAppVersion() {
- return appVersion;
- }
-
- public void setAppVersion(String appVersion) {
- this.appVersion = appVersion;
- }
-
- public String getWorkflowTemplateId() {
- return workflowTemplateId;
- }
-
- public void setWorkflowTemplateId(String workflowTemplateId) {
- this.workflowTemplateId = workflowTemplateId;
- }
-
- public String getWorkflowTemplateVersion() {
- return workflowTemplateVersion;
- }
-
- public void setWorkflowTemplateVersion(String workflowTemplateVersion) {
- this.workflowTemplateVersion = workflowTemplateVersion;
- }
-
- public String getWorkflowExecutionId() {
- return workflowExecutionId;
- }
-
- public void setWorkflowExecutionId(String workflowExecutionId) {
- this.workflowExecutionId = workflowExecutionId;
- }
-
- public boolean isAllowNotification() {
- return allowNotification;
- }
-
- public void setAllowNotification(boolean allowNotification) {
- this.allowNotification = allowNotification;
- }
-
- public String getGatewayExecutionId() {
- return gatewayExecutionId;
- }
-
- public String getProjectID() {
- return projectID;
- }
-
- public void setProjectID(String projectID) {
- this.projectID = projectID;
- }
-
- public List<Experiment_Output> getExperimentOutputs() {
- return experimentOutputs;
- }
-
- public void setExperimentOutputs(List<Experiment_Output> experimentOutputs) {
- this.experimentOutputs = experimentOutputs;
- }
-
- public List<Experiment_Input> getExperimentInputs() {
- return experimentInputs;
- }
-
- public void setExperimentInputs(List<Experiment_Input> experimentInputs) {
- this.experimentInputs = experimentInputs;
- }
-
- public Computational_Resource_Scheduling getResourceScheduling() {
- return resourceScheduling;
- }
-
- public void setResourceScheduling(Computational_Resource_Scheduling resourceScheduling) {
- this.resourceScheduling = resourceScheduling;
- }
-
- public List<ErrorDetail> getErrorDetails() {
- return errorDetails;
- }
-
- public ExperimentConfigData getUserConfigurationData() {
- return userConfigurationData;
- }
-
- public void setUserConfigurationData(ExperimentConfigData userConfigurationData) {
- this.userConfigurationData = userConfigurationData;
- }
-
- public List<WorkflowNodeDetail> getWorkflowNodeDetails() {
- return workflowNodeDetails;
- }
-
- public void setWorkflowNodeDetails(List<WorkflowNodeDetail> workflowNodeDetails) {
- this.workflowNodeDetails = workflowNodeDetails;
- }
-
- public List<Status> getStateChangeList() {
- return stateChangeList;
- }
-
- public void setStateChangeList(List<Status> stateChangeList) {
- this.stateChangeList = stateChangeList;
- }
-
- public void setErrorDetails(List<ErrorDetail> errorDetails) {
- this.errorDetails = errorDetails;
- }
-
- public Status getExperimentStatus() {
- return experimentStatus;
- }
-
- public void setExperimentStatus(Status experimentStatus) {
- this.experimentStatus = experimentStatus;
- }
-
- public List<Notification_Email> getNotificationEmails() {
- return notificationEmails;
- }
-
- public void setNotificationEmails(List<Notification_Email> notificationEmails) {
- this.notificationEmails = notificationEmails;
- }
-
- public void setGatewayExecutionId(String gatewayExecutionId) {
- this.gatewayExecutionId = gatewayExecutionId;
- }
-
- public Collection<Status> getStatuses() {
- return statuses;
- }
-
- public void setStatuses(Collection<Status> statuses) {
- this.statuses = statuses;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ExperimentConfigData.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ExperimentConfigData.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ExperimentConfigData.java
deleted file mode 100644
index a7c6e32..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ExperimentConfigData.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-import org.apache.openjpa.persistence.jdbc.ElementJoinColumn;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "CONFIG_DATA")
-public class ExperimentConfigData implements Serializable {
- @Id
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Column(name = "AIRAVATA_AUTO_SCHEDULE")
- private boolean airavataAutoSchedule;
- @Column(name = "OVERRIDE_MANUAL_SCHEDULE_PARAMS")
- private boolean overrideManualParams;
- @Column(name = "SHARE_EXPERIMENT")
- private boolean shareExp;
- @Column(name = "USER_DN")
- private String userDn;
- @Column(name = "GENERATE_CERT")
- private boolean generateCert;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
- private Computational_Resource_Scheduling resourceScheduling;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
- private AdvancedInputDataHandling inputDataHandling;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
- private AdvancedOutputDataHandling outputDataHandling;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "experiment")
- private QosParam qosParam;
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public boolean isAiravataAutoSchedule() {
- return airavataAutoSchedule;
- }
-
- public void setAiravataAutoSchedule(boolean airavataAutoSchedule) {
- this.airavataAutoSchedule = airavataAutoSchedule;
- }
-
- public boolean isOverrideManualParams() {
- return overrideManualParams;
- }
-
- public void setOverrideManualParams(boolean overrideManualParams) {
- this.overrideManualParams = overrideManualParams;
- }
-
- public boolean isShareExp() {
- return shareExp;
- }
-
- public void setShareExp(boolean shareExp) {
- this.shareExp = shareExp;
- }
-
- public String getUserDn() {
- return userDn;
- }
-
- public void setUserDn(String userDn) {
- this.userDn = userDn;
- }
-
- public boolean isGenerateCert() {
- return generateCert;
- }
-
- public void setGenerateCert(boolean generateCert) {
- this.generateCert = generateCert;
- }
-
- public AdvancedInputDataHandling getInputDataHandling() {
- return inputDataHandling;
- }
-
- public void setInputDataHandling(AdvancedInputDataHandling inputDataHandling) {
- this.inputDataHandling = inputDataHandling;
- }
-
- public AdvancedOutputDataHandling getOutputDataHandling() {
- return outputDataHandling;
- }
-
- public void setOutputDataHandling(AdvancedOutputDataHandling outputDataHandling) {
- this.outputDataHandling = outputDataHandling;
- }
-
- public QosParam getQosParam() {
- return qosParam;
- }
-
- public void setQosParam(QosParam qosParam) {
- this.qosParam = qosParam;
- }
-
- public Computational_Resource_Scheduling getResourceScheduling() {
- return resourceScheduling;
- }
-
- public void setResourceScheduling(Computational_Resource_Scheduling resourceScheduling) {
- this.resourceScheduling = resourceScheduling;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Input.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Input.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Input.java
deleted file mode 100644
index 6a063f4..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Input.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name ="EXPERIMENT_INPUT")
-@IdClass(Experiment_Input_PK.class)
-public class Experiment_Input implements Serializable {
- @Id
- @Column(name = "EXPERIMENT_ID")
- private String experiment_id;
-
- @Id
- @Column(name = "INPUT_KEY")
- private String ex_key;
-
- @Lob
- @Column(name = "VALUE")
- private char[] value;
-
- @Column(name = "DATA_TYPE")
- private String dataType;
-
- @Column(name = "APP_ARGUMENT")
- private String appArgument;
-
- @Column(name = "STANDARD_INPUT")
- private boolean standardInput;
-
- @Column(name = "USER_FRIENDLY_DESC")
- private String userFriendlyDesc;
-
- @Column(name = "METADATA")
- private String metadata;
-
- @Column(name = "INPUT_ORDER")
- private int inputOrder;
-
- @Column(name="IS_REQUIRED")
- private boolean isRequired;
- @Column(name="REQUIRED_TO_COMMANDLINE")
- private boolean requiredToCMD;
- @Column(name = "DATA_STAGED")
- private boolean dataStaged;
-
- @ManyToOne
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public String getExperiment_id() {
- return experiment_id;
- }
-
- public void setExperiment_id(String experiment_id) {
- this.experiment_id = experiment_id;
- }
-
- public String getEx_key() {
- return ex_key;
- }
-
- public void setEx_key(String ex_key) {
- this.ex_key = ex_key;
- }
-
- public char[] getValue() {
- return value;
- }
-
- public void setValue(char[] value) {
- this.value = value;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataStaged() {
- return dataStaged;
- }
-
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Input_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Input_PK.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Input_PK.java
deleted file mode 100644
index 73a83a7..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Input_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import java.io.Serializable;
-
-public class Experiment_Input_PK implements Serializable {
- private String experiment_id;
- private String ex_key;
-
- public Experiment_Input_PK(String experiment_id, String ex_key) {
- this.experiment_id = experiment_id;
- this.ex_key = ex_key;
- }
-
- public Experiment_Input_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getExperiment_id() {
- return experiment_id;
- }
-
- public void setExperiment_id(String experiment_id) {
- this.experiment_id = experiment_id;
- }
-
- public String getEx_key() {
- return ex_key;
- }
-
- public void setEx_key(String ex_key) {
- this.ex_key = ex_key;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Output.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Output.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Output.java
deleted file mode 100644
index 689749b..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Output.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name ="EXPERIMENT_OUTPUT")
-@IdClass(Experiment_Output_PK.class)
-public class Experiment_Output implements Serializable {
- @Id
- @Column(name = "EXPERIMENT_ID")
- private String experiment_id;
-
- @Id
- @Column(name = "OUTPUT_KEY")
- private String ex_key;
- @Lob
- @Column(name = "VALUE")
- private char[] value;
- @Column(name = "DATA_TYPE")
- private String dataType;
-
- @Column(name = "IS_REQUIRED")
- private boolean isRequired;
- @Column(name="REQUIRED_TO_COMMANDLINE")
- private boolean requiredToCMD;
- @Column(name = "DATA_MOVEMENT")
- private boolean dataMovement;
- @Column(name = "DATA_NAME_LOCATION")
- private String dataNameLocation;
- @Column(name = "SEARCH_QUERY")
- private String searchQuery;
- @Column(name = "APP_ARGUMENT")
- private String applicationArgument;
-
- @ManyToOne
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- public String getExperiment_id() {
- return experiment_id;
- }
-
- public void setExperiment_id(String experiment_id) {
- this.experiment_id = experiment_id;
- }
-
- public String getEx_key() {
- return ex_key;
- }
-
- public void setEx_key(String ex_key) {
- this.ex_key = ex_key;
- }
-
- public char[] getValue() {
- return value;
- }
-
- public void setValue(char[] value) {
- this.value = value;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-
- public String getSearchQuery() {
- return searchQuery;
- }
-
- public void setSearchQuery(String searchQuery) {
- this.searchQuery = searchQuery;
- }
-
- public String getApplicationArgument() {
- return applicationArgument;
- }
-
- public void setApplicationArgument(String applicationArgument) {
- this.applicationArgument = applicationArgument;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Output_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Output_PK.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Output_PK.java
deleted file mode 100644
index c41d8d9..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Output_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import java.io.Serializable;
-
-public class Experiment_Output_PK implements Serializable {
- private String experiment_id;
- private String ex_key;
-
- public Experiment_Output_PK(String experiment_id, String ex_key) {
- this.experiment_id = experiment_id;
- this.ex_key = ex_key;
- }
-
- public Experiment_Output_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getExperiment_id() {
- return experiment_id;
- }
-
- public void setExperiment_id(String experiment_id) {
- this.experiment_id = experiment_id;
- }
-
- public String getEx_key() {
- return ex_key;
- }
-
- public void setEx_key(String ex_key) {
- this.ex_key = ex_key;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java
deleted file mode 100644
index 7619f17..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name ="GATEWAY")
-public class Gateway implements Serializable {
- @Id
- @Column(name = "GATEWAY_ID")
- private String gateway_id;
- @Column(name = "GATEWAY_NAME")
- private String gateway_name;
- @Column(name = "DOMAIN")
- private String domain;
- @Column(name = "EMAIL_ADDRESS")
- private String emailAddress;
-
- public String getGateway_name() {
- return gateway_name;
- }
-
- public void setGateway_name(String gateway_name) {
- this.gateway_name = gateway_name;
- }
-
- public String getDomain() {
- return domain;
- }
-
- public void setDomain(String domain) {
- this.domain = domain;
- }
-
- public String getGateway_id() {
- return gateway_id;
- }
-
- public void setGateway_id(String gateway_id) {
- this.gateway_id = gateway_id;
- }
-
- public String getEmailAddress() {
- return emailAddress;
- }
-
- public void setEmailAddress(String emailAddress) {
- this.emailAddress = emailAddress;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java
deleted file mode 100644
index 12f3202..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name ="GATEWAY_WORKER")
-@IdClass(Gateway_Worker_PK.class)
-public class Gateway_Worker implements Serializable {
- @Id
- @Column(name = "GATEWAY_ID")
- private String gateway_id;
-
- @Id
- @Column(name = "USER_NAME")
- private String user_name;
-
- @ManyToOne(cascade=CascadeType.MERGE)
- @JoinColumn(name = "GATEWAY_ID")
- private Gateway gateway;
-
-
- @ManyToOne(cascade=CascadeType.MERGE)
- @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 void setGateway(Gateway gateway) {
- this.gateway = gateway;
- }
-
- public Gateway getGateway() {
- return gateway;
- }
-
- public Users getUser() {
- return user;
- }
-
- public void setUser(Users user) {
- this.user = user;
- }
-
- public String getGateway_id() {
- return gateway_id;
- }
-
- public void setGateway_id(String gateway_id) {
- this.gateway_id = gateway_id;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker_PK.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker_PK.java
deleted file mode 100644
index b2a93a6..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Gateway_Worker_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import java.io.Serializable;
-
-public class Gateway_Worker_PK implements Serializable {
- private String gateway_id;
- private String user_name;
-
- public Gateway_Worker_PK(String gateway_id, String user_name) {
- this.gateway_id = gateway_id;
- this.user_name = user_name;
- }
-
- public Gateway_Worker_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getUser_name() {
- return user_name;
- }
-
- public void setUser_name(String user_name) {
- this.user_name = user_name;
- }
-
- public String getGateway_id() {
- return gateway_id;
- }
-
- public void setGateway_id(String gateway_id) {
- this.gateway_id = gateway_id;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/JobDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/JobDetail.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/JobDetail.java
deleted file mode 100644
index bac9308..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/JobDetail.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-import org.apache.openjpa.persistence.jdbc.ElementJoinColumn;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-import java.util.List;
-
-@DataCache
-@Entity
-@Table(name = "JOB_DETAIL")
-@IdClass(JobDetails_PK.class)
-public class JobDetail implements Serializable {
- @Id
- @Column(name = "JOB_ID")
- private String jobId;
- @Id
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "JOB_DESCRIPTION")
- @Lob
- private char[] jobDescription;
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
- @Column(name = "COMPUTE_RESOURCE_CONSUMED")
- private String computeResourceConsumed;
- @Column(name = "JOBNAME")
- private String jobName;
- @Column(name = "WORKING_DIR")
- private String workingDir;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "jobDetail")
- private Status jobStatus;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "jobDetail")
- private List<ErrorDetail> errorDetails;
-
- public List<ErrorDetail> getErrorDetails() {
- return errorDetails;
- }
-
- public void setErrorDetails(List<ErrorDetail> errorDetails) {
- this.errorDetails = errorDetails;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public char[] getJobDescription() {
- return jobDescription;
- }
-
- public void setJobDescription(char[] jobDescription) {
- this.jobDescription = jobDescription;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getComputeResourceConsumed() {
- return computeResourceConsumed;
- }
-
- public void setComputeResourceConsumed(String computeResourceConsumed) {
- this.computeResourceConsumed = computeResourceConsumed;
- }
-
- public String getJobName() {
- return jobName;
- }
-
- public void setJobName(String jobName) {
- this.jobName = jobName;
- }
-
- public String getWorkingDir() {
- return workingDir;
- }
-
- public void setWorkingDir(String workingDir) {
- this.workingDir = workingDir;
- }
-
- public Status getJobStatus() {
- return jobStatus;
- }
-
- public void setJobStatus(Status jobStatus) {
- this.jobStatus = jobStatus;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/JobDetails_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/JobDetails_PK.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/JobDetails_PK.java
deleted file mode 100644
index 1247fb6..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/JobDetails_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import java.io.Serializable;
-
-public class JobDetails_PK implements Serializable {
- private String jobId;
- private String taskId;
-
- public JobDetails_PK(String jobId, String taskId) {
- this.jobId = jobId;
- this.taskId = taskId;
- }
-
- public JobDetails_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/NodeInput.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/NodeInput.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/NodeInput.java
deleted file mode 100644
index 9957369..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/NodeInput.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "NODE_INPUT")
-@IdClass(NodeInput_PK.class)
-public class NodeInput implements Serializable {
- @Id
- @Column(name = "NODE_INSTANCE_ID")
- private String nodeId;
- @Id
- @Column(name = "INPUT_KEY")
- private String inputKey;
- @Column(name = "DATA_TYPE")
- private String dataType;
- @Column(name = "METADATA")
- private String metadata;
- @Column(name = "VALUE")
- private String value;
- @Column(name = "APP_ARGUMENT")
- private String appArgument;
- @Column(name = "INPUT_ORDER")
- private int inputOrder;
-
- @Column(name = "STANDARD_INPUT")
- private boolean standardInput;
-
- @Column(name = "USER_FRIENDLY_DESC")
- private String userFriendlyDesc;
-
- @Column(name="IS_REQUIRED")
- private boolean isRequired;
- @Column(name="REQUIRED_TO_COMMANDLINE")
- private boolean requiredToCMD;
- @Column(name = "DATA_STAGED")
- private boolean dataStaged;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "NODE_INSTANCE_ID")
- private WorkflowNodeDetail nodeDetail;
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public boolean getIsRequired() {
- return isRequired;
- }
-
- public void setIsRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean getRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataStaged() {
- return dataStaged;
- }
-
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/NodeInput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/NodeInput_PK.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/NodeInput_PK.java
deleted file mode 100644
index 9db1cbe..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/NodeInput_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import java.io.Serializable;
-
-public class NodeInput_PK implements Serializable {
- private String nodeId;
- private String inputKey;
-
- public NodeInput_PK(String nodeId, String inputKey) {
- this.nodeId = nodeId;
- this.inputKey = inputKey;
- }
-
- public NodeInput_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/NodeOutput.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/NodeOutput.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/NodeOutput.java
deleted file mode 100644
index 9753901..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/NodeOutput.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "NODE_OUTPUT")
-@IdClass(NodeOutput_PK.class)
-public class NodeOutput implements Serializable {
- @Id
- @Column(name = "NODE_INSTANCE_ID")
- private String nodeId;
- @Id
- @Column(name = "OUTPUT_KEY")
- private String outputKey;
- @Column(name = "DATA_TYPE")
- private String dataType;
- @Column(name = "VALUE")
- private String value;
- @Column(name = "IS_REQUIRED")
- private boolean isRequired;
- @Column(name="REQUIRED_TO_COMMANDLINE")
- private boolean requiredToCMD;
- @Column(name = "DATA_MOVEMENT")
- private boolean dataMovement;
- @Column(name = "DATA_NAME_LOCATION")
- private String dataNameLocation;
- @Column(name = "SEARCH_QUERY")
- private String searchQuery;
- @Column(name = "APP_ARGUMENT")
- private String applicationArgument;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "NODE_INSTANCE_ID")
- private WorkflowNodeDetail nodeDetail;
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-
- public String getSearchQuery() {
- return searchQuery;
- }
-
- public void setSearchQuery(String searchQuery) {
- this.searchQuery = searchQuery;
- }
-
- public String getApplicationArgument() {
- return applicationArgument;
- }
-
- public void setApplicationArgument(String applicationArgument) {
- this.applicationArgument = applicationArgument;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/NodeOutput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/NodeOutput_PK.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/NodeOutput_PK.java
deleted file mode 100644
index 84fded8..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/NodeOutput_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import java.io.Serializable;
-
-public class NodeOutput_PK implements Serializable {
- private String nodeId;
- private String outputKey;
-
- public NodeOutput_PK(String nodeId, String outputKey) {
- this.nodeId = nodeId;
- this.outputKey = outputKey;
- }
-
- public NodeOutput_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Notification_Email.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Notification_Email.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Notification_Email.java
deleted file mode 100644
index e3504f6..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Notification_Email.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name ="NOTIFICATION_EMAIL")
-public class Notification_Email implements Serializable {
- @Id
- @GeneratedValue
- private int emailId;
- @Column(name = "EXPERIMENT_ID")
- private String experiment_id;
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "EMAIL_ADDRESS")
- private String emailAddress;
-
- @ManyToOne
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
- @ManyToOne
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- public String getExperiment_id() {
- return experiment_id;
- }
-
- public void setExperiment_id(String experiment_id) {
- this.experiment_id = experiment_id;
- }
-
- public String getEmailAddress() {
- return emailAddress;
- }
-
- public void setEmailAddress(String emailAddress) {
- this.emailAddress = emailAddress;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public int getEmailId() {
- return emailId;
- }
-
- public void setEmailId(int emailId) {
- this.emailId = emailId;
- }
-}
[20/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java
deleted file mode 100644
index 054411d..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Project.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@DataCache
-@Entity
-@Table(name ="PROJECT")
-public class Project implements Serializable {
- @Id
- @Column(name = "PROJECT_ID")
- private String project_id;
-
- @Column(name = "GATEWAY_ID")
- private String gateway_id;
-
- @Column(name = "PROJECT_NAME")
- private String project_name;
-
- @Column(name = "DESCRIPTION")
- private String description;
-
- @Column(name = "USER_NAME")
- private String user_name;
-
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
-
- @ManyToOne(cascade=CascadeType.MERGE)
- @JoinColumn(name = "GATEWAY_ID")
- private Gateway gateway;
-
- @ManyToOne(cascade=CascadeType.MERGE)
- @JoinColumn(name = "USER_NAME")
- private Users users;
-
-
- public String getProject_name() {
- return project_name;
- }
-
- public Gateway getGateway() {
- return gateway;
- }
-
- public void setProject_name(String project_name) {
- this.project_name = project_name;
- }
-
- public void setGateway(Gateway gateway) {
- this.gateway = gateway;
- }
-
- public Users getUsers() {
- return users;
- }
-
- public void setUsers(Users users) {
- this.users = users;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public void setProject_id(String project_id) {
- this.project_id = project_id;
- }
-
- public String getProject_id() {
- return project_id;
- }
-
- public String getUser_name() {
- return user_name;
- }
-
- public void setUser_name(String user_name) {
- this.user_name = user_name;
- }
-
- public String getGateway_id() {
- return gateway_id;
- }
-
- public void setGateway_id(String gateway_id) {
- this.gateway_id = gateway_id;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ProjectUser.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ProjectUser.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ProjectUser.java
deleted file mode 100644
index 1509612..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ProjectUser.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@IdClass(ProjectUser_PK.class)
-@Table(name = "PROJECT_USER")
-public class ProjectUser implements Serializable {
- @Id
- @Column(name = "PROJECT_ID")
- private String projectID;
- @Id
- @Column(name = "USER_NAME")
- private String userName;
-
- @ManyToOne(cascade=CascadeType.MERGE)
- @JoinColumn(name = "PROJECT_ID")
- private Project project;
-
- @ManyToOne(cascade=CascadeType.MERGE)
- @JoinColumn(name = "USER_NAME")
- private Users user;
-
- public String getProjectID() {
- return projectID;
- }
-
- public void setProjectID(String projectID) {
- this.projectID = projectID;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public Project getProject() {
- return project;
- }
-
- public void setProject(Project project) {
- this.project = project;
- }
-
- public Users getUser() {
- return user;
- }
-
- public void setUser(Users user) {
- this.user = user;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ProjectUser_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ProjectUser_PK.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ProjectUser_PK.java
deleted file mode 100644
index 4b1be3e..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ProjectUser_PK.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import java.io.Serializable;
-
-public class ProjectUser_PK implements Serializable {
- private String projectID;
- private String userName;
-
- public ProjectUser_PK(String projectID, String userName) {
- this.projectID = projectID;
- this.userName = userName;
- }
-
- public ProjectUser_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
- public String getProjectID() {
- return projectID;
- }
-
- public void setProjectID(String projectID) {
- this.projectID = projectID;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/QosParam.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/QosParam.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/QosParam.java
deleted file mode 100644
index f124588..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/QosParam.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "QOS_PARAMS")
-public class QosParam implements Serializable {
- @Id
- @GeneratedValue
- @Column(name = "QOS_ID")
- private int qosId;
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "START_EXECUTION_AT")
- private String startExecutionAt;
- @Column(name = "EXECUTE_BEFORE")
- private String executeBefore;
- @Column(name = "NO_OF_RETRIES")
- private int noOfRetries;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- public int getQosId() {
- return qosId;
- }
-
- public void setQosId(int qosId) {
- this.qosId = qosId;
- }
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getStartExecutionAt() {
- return startExecutionAt;
- }
-
- public void setStartExecutionAt(String startExecutionAt) {
- this.startExecutionAt = startExecutionAt;
- }
-
- public String getExecuteBefore() {
- return executeBefore;
- }
-
- public void setExecuteBefore(String executeBefore) {
- this.executeBefore = executeBefore;
- }
-
- public int getNoOfRetries() {
- return noOfRetries;
- }
-
- public void setNoOfRetries(int noOfRetries) {
- this.noOfRetries = noOfRetries;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Status.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Status.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Status.java
deleted file mode 100644
index b3d65c0..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Status.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-@DataCache
-@Entity
-@Table(name = "STATUS")
-public class Status implements Serializable {
- @Id
- @GeneratedValue
- @Column(name = "STATUS_ID")
- private int statusId;
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Column(name = "NODE_INSTANCE_ID")
- private String nodeId;
- @Column(name = "TRANSFER_ID")
- private String transferId;
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "JOB_ID")
- private String jobId;
- @Column(name = "STATE")
- private String state;
- @Column(name = "STATUS_UPDATE_TIME")
- private Timestamp statusUpdateTime;
- @Column(name = "STATUS_TYPE")
- private String statusType;
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "NODE_INSTANCE_ID")
- private WorkflowNodeDetail nodeDetail;
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "TRANSFER_ID")
- private DataTransferDetail transferDetail;
-
- @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
- @JoinColumn(name = "JOB_ID")
- private JobDetail jobDetail;
-
- public int getStatusId() {
- return statusId;
- }
-
- public void setStatusId(int statusId) {
- this.statusId = statusId;
- }
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getTransferId() {
- return transferId;
- }
-
- public void setTransferId(String transferId) {
- this.transferId = transferId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- public Timestamp getStatusUpdateTime() {
- return statusUpdateTime;
- }
-
- public void setStatusUpdateTime(Timestamp statusUpdateTime) {
- this.statusUpdateTime = statusUpdateTime;
- }
-
- public String getStatusType() {
- return statusType;
- }
-
- public void setStatusType(String statusType) {
- this.statusType = statusType;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/TaskDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/TaskDetail.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/TaskDetail.java
deleted file mode 100644
index f455aca..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/TaskDetail.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-import org.apache.openjpa.persistence.jdbc.ElementJoinColumn;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.List;
-
-@DataCache
-@Entity
-@Table(name = "TASK_DETAIL")
-public class TaskDetail implements Serializable {
- @Id
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "NODE_INSTANCE_ID")
- private String nodeId;
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
- @Column(name = "APPLICATION_ID")
- private String appId;
- @Column(name = "APPLICATION_VERSION")
- private String appVersion;
- @Column(name = "ALLOW_NOTIFICATION")
- private boolean allowNotification;
-
- @Column(name = "APPLICATION_DEPLOYMENT_ID")
- private String applicationDeploymentId;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "NODE_INSTANCE_ID")
- private WorkflowNodeDetail nodeDetail;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
- private List<ApplicationOutput> applicationOutputs;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
- private List<ApplicationInput> applicationInputs;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "task")
- private Computational_Resource_Scheduling resourceScheduling;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "task")
- private AdvancedInputDataHandling inputDataHandling;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "task")
- private AdvancedOutputDataHandling outputDataHandling;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "task")
- private Status taskStatus;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
- private List<JobDetail> jobDetails;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
- private List<DataTransferDetail> dataTransferDetails;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
- private List<Notification_Email> notificationEmails;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
- private List<ErrorDetail> errorDetails;
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getAppId() {
- return appId;
- }
-
- public void setAppId(String appId) {
- this.appId = appId;
- }
-
- public String getAppVersion() {
- return appVersion;
- }
-
- public void setAppVersion(String appVersion) {
- this.appVersion = appVersion;
- }
-
- public String getApplicationDeploymentId() {
- return applicationDeploymentId;
- }
-
- public void setApplicationDeploymentId(String applicationDeploymentId) {
- this.applicationDeploymentId = applicationDeploymentId;
- }
-
- public boolean isAllowNotification() {
- return allowNotification;
- }
-
- public void setAllowNotification(boolean allowNotification) {
- this.allowNotification = allowNotification;
- }
-
- public List<ApplicationOutput> getApplicationOutputs() {
- return applicationOutputs;
- }
-
- public void setApplicationOutputs(List<ApplicationOutput> applicationOutputs) {
- this.applicationOutputs = applicationOutputs;
- }
-
- public List<ApplicationInput> getApplicationInputs() {
- return applicationInputs;
- }
-
- public void setApplicationInputs(List<ApplicationInput> applicationInputs) {
- this.applicationInputs = applicationInputs;
- }
-
- public Computational_Resource_Scheduling getResourceScheduling() {
- return resourceScheduling;
- }
-
- public void setResourceScheduling(Computational_Resource_Scheduling resourceScheduling) {
- this.resourceScheduling = resourceScheduling;
- }
-
- public AdvancedInputDataHandling getInputDataHandling() {
- return inputDataHandling;
- }
-
- public void setInputDataHandling(AdvancedInputDataHandling inputDataHandling) {
- this.inputDataHandling = inputDataHandling;
- }
-
- public AdvancedOutputDataHandling getOutputDataHandling() {
- return outputDataHandling;
- }
-
- public void setOutputDataHandling(AdvancedOutputDataHandling outputDataHandling) {
- this.outputDataHandling = outputDataHandling;
- }
-
- public List<JobDetail> getJobDetails() {
- return jobDetails;
- }
-
- public void setJobDetails(List<JobDetail> jobDetails) {
- this.jobDetails = jobDetails;
- }
-
- public List<DataTransferDetail> getDataTransferDetails() {
- return dataTransferDetails;
- }
-
- public void setDataTransferDetails(List<DataTransferDetail> dataTransferDetails) {
- this.dataTransferDetails = dataTransferDetails;
- }
-
- public List<Notification_Email> getNotificationEmails() {
- return notificationEmails;
- }
-
- public void setNotificationEmails(List<Notification_Email> notificationEmails) {
- this.notificationEmails = notificationEmails;
- }
-
- public Status getTaskStatus() {
- return taskStatus;
- }
-
- public void setTaskStatus(Status taskStatus) {
- this.taskStatus = taskStatus;
- }
-
- public List<ErrorDetail> getErrorDetails() {
- return errorDetails;
- }
-
- public void setErrorDetails(List<ErrorDetail> errorDetails) {
- this.errorDetails = errorDetails;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.java
deleted file mode 100644
index 9005985..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Users.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name ="USERS")
-public class Users implements Serializable {
-
- @Id
- @Column(name = "USER_NAME")
- private String user_name;
- @Column(name = "PASSWORD")
- private String password;
-
-
- public String getUser_name() {
- return user_name;
- }
-
- public void setUser_name(String user_name) {
- this.user_name = user_name;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/WorkflowNodeDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/WorkflowNodeDetail.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/WorkflowNodeDetail.java
deleted file mode 100644
index fc0abf8..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/WorkflowNodeDetail.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-import org.apache.openjpa.persistence.jdbc.ElementJoinColumn;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.List;
-
-@DataCache
-@Entity
-@Table(name = "WORKFLOW_NODE_DETAIL")
-public class WorkflowNodeDetail implements Serializable {
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Id
- @Column(name = "NODE_INSTANCE_ID")
- private String nodeId;
- @Column(name = "EXECUTION_UNIT")
- private String executionUnit;
- @Column(name = "EXECUTION_UNIT_DATA")
- private String executionUnitData;
- @Column(name = "CREATION_TIME")
- private Timestamp creationTime;
- @Column(name = "NODE_NAME")
- private String nodeName;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "nodeDetail")
- private List<TaskDetail> taskDetails;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "nodeDetail")
- private List<NodeInput> nodeInputs;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "nodeDetail")
- private List<NodeOutput> nodeOutputs;
-
- @OneToOne (fetch = FetchType.LAZY, mappedBy = "nodeDetail")
- private Status nodeStatus;
-
- @OneToMany (fetch = FetchType.LAZY, mappedBy = "nodeDetail")
- private List<ErrorDetail> errorDetails;
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getNodeName() {
- return nodeName;
- }
-
- public void setNodeName(String nodeName) {
- this.nodeName = nodeName;
- }
-
- public String getExecutionUnitData() {
- return executionUnitData;
- }
-
- public void setExecutionUnitData(String executionUnitData) {
- this.executionUnitData = executionUnitData;
- }
-
- public String getExecutionUnit() {
- return executionUnit;
- }
-
- public void setExecutionUnit(String executionUnit) {
- this.executionUnit = executionUnit;
- }
-
- public List<TaskDetail> getTaskDetails() {
- return taskDetails;
- }
-
- public void setTaskDetails(List<TaskDetail> taskDetails) {
- this.taskDetails = taskDetails;
- }
-
- public List<NodeInput> getNodeInputs() {
- return nodeInputs;
- }
-
- public void setNodeInputs(List<NodeInput> nodeInputs) {
- this.nodeInputs = nodeInputs;
- }
-
- public List<NodeOutput> getNodeOutputs() {
- return nodeOutputs;
- }
-
- public void setNodeOutputs(List<NodeOutput> nodeOutputs) {
- this.nodeOutputs = nodeOutputs;
- }
-
- public Status getNodeStatus() {
- return nodeStatus;
- }
-
- public void setNodeStatus(Status nodeStatus) {
- this.nodeStatus = nodeStatus;
- }
-
- public List<ErrorDetail> getErrorDetails() {
- return errorDetails;
- }
-
- public void setErrorDetails(List<ErrorDetail> errorDetails) {
- this.errorDetails = errorDetails;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
deleted file mode 100644
index e05d59d..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AbstractResource.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.registry.cpi.RegistryException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public abstract class AbstractResource implements Resource {
- // table names
- public static final String GATEWAY = "Gateway";
- public static final String CONFIGURATION = "Configuration";
- public static final String USERS = "Users";
- public static final String GATEWAY_WORKER = "Gateway_Worker";
- public static final String PROJECT = "Project";
- public static final String PROJECT_USER = "ProjectUser";
- public static final String EXPERIMENT = "Experiment";
- public static final String NOTIFICATION_EMAIL = "Notification_Email";
- public static final String EXPERIMENT_CONFIG_DATA = "ExperimentConfigData";
- public static final String EXPERIMENT_INPUT = "Experiment_Input";
- public static final String EXPERIMENT_OUTPUT = "Experiment_Output";
- public static final String WORKFLOW_NODE_DETAIL = "WorkflowNodeDetail";
- public static final String TASK_DETAIL = "TaskDetail";
- public static final String ERROR_DETAIL = "ErrorDetail";
- public static final String APPLICATION_INPUT = "ApplicationInput";
- public static final String APPLICATION_OUTPUT = "ApplicationOutput";
- public static final String NODE_INPUT = "NodeInput";
- public static final String NODE_OUTPUT = "NodeOutput";
- public static final String JOB_DETAIL = "JobDetail";
- public static final String DATA_TRANSFER_DETAIL = "DataTransferDetail";
- public static final String STATUS = "Status";
- public static final String CONFIG_DATA = "ExperimentConfigData";
- public static final String COMPUTATIONAL_RESOURCE_SCHEDULING = "Computational_Resource_Scheduling";
- public static final String ADVANCE_INPUT_DATA_HANDLING = "AdvancedInputDataHandling";
- public static final String ADVANCE_OUTPUT_DATA_HANDLING = "AdvancedOutputDataHandling";
- public static final String QOS_PARAMS = "QosParam";
-
-
- // Gateway Table
- public final class GatewayConstants {
- public static final String GATEWAY_ID = "gateway_id";
- public static final String GATEWAY_NAME = "gateway_name";
- public static final String DOMAIN = "domain";
- public static final String EMAIL_ADDRESS = "emailAddress";
- }
-
- // Configuration Table
- public final class ConfigurationConstants {
- // public static final String CONFIG_ID = "config_ID";
- public static final String CONFIG_KEY = "config_key";
- public static final String CONFIG_VAL = "config_val";
- public static final String EXPIRE_DATE = "expire_date";
- public static final String CATEGORY_ID = "category_id";
- public static final String CATEGORY_ID_DEFAULT_VALUE = "SYSTEM";
- }
-
- // Users table
- public final class UserConstants {
- public static final String USERNAME = "user_name";
- public static final String PASSWORD = "password";
- }
-
- // Gateway_Worker table
- public final class GatewayWorkerConstants {
- public static final String USERNAME = "user_name";
- public static final String GATEWAY_ID = "gateway_id";
- }
-
- // Project table
- public final class ProjectConstants {
- public static final String GATEWAY_ID = "gateway_id";
- public static final String USERNAME = "user_name";
- public static final String PROJECT_NAME = "project_name";
- public static final String PROJECT_ID = "project_id";
- public static final String DESCRIPTION = "description";
- public static final String CREATION_TIME = "creationTime";
- }
-
- // Project table
- public final class ProjectUserConstants {
- public static final String USERNAME = "userName";
- public static final String PROJECT_ID = "projectID";
- }
-
- // Experiment table
- public final class ExperimentConstants {
- public static final String PROJECT_ID = "projectID";
- public static final String EXECUTION_USER = "executionUser";
- public static final String GATEWAY_ID = "gatewayId";
- public static final String EXPERIMENT_ID = "expId";
- public static final String EXPERIMENT_NAME = "expName";
- public static final String DESCRIPTION = "expDesc";
- public static final String CREATION_TIME = "creationTime";
- public static final String APPLICATION_ID = "applicationId";
- public static final String APPLICATION_VERSION = "appVersion";
- public static final String WORKFLOW_TEMPLATE_ID = "workflowTemplateId";
- public static final String WORKFLOW_TEMPLATE_VERSION = "workflowTemplateVersion";
- public static final String WORKFLOW_EXECUTION_ID = "workflowExecutionId";
- }
-
- // Experiment Configuration Data table
- public final class ExperimentConfigurationDataConstants {
- public static final String EXPERIMENT_ID = "expId";
- public static final String AIRAVATA_AUTO_SCHEDULE = "airavataAutoSchedule";
- public static final String OVERRIDE_MANUAL_SCHEDULE = "overrideManualParams";
- public static final String SHARE_EXPERIMENT = "shareExp";
- }
-
- public final class NotificationEmailConstants {
- public static final String EXPERIMENT_ID = "experiment_id";
- public static final String TASK_ID = "taskId";
- public static final String EMAIL_ADDRESS = "emailAddress";
- }
-
- //Experiment Input table
- public final class ExperimentInputConstants {
- public static final String EXPERIMENT_ID = "experiment_id";
- public static final String EXPERIMENT_INPUT_KEY = "ex_key";
- public static final String EXPERIMENT_INPUT_VAL = "value";
- public static final String INPUT_TYPE = "inputType";
- public static final String METADATA = "metadata";
- }
-
- //Experiment Output table
- public final class ExperimentOutputConstants {
- public static final String EXPERIMENT_ID = "experiment_id";
- public static final String EXPERIMENT_OUTPUT_KEY = "ex_key";
- public static final String EXPERIMENT_OUTPUT_VAL = "value";
- public static final String OUTPUT_TYPE = "outputKeyType";
- public static final String METADATA = "metadata";
- }
-
- // Workflow_Data table
- public final class WorkflowNodeDetailsConstants {
- public static final String EXPERIMENT_ID = "expId";
- public static final String NODE_INSTANCE_ID = "nodeId";
- public static final String CREATION_TIME = "creationTime";
- public static final String NODE_NAME = "nodeName";
- }
-
- // TaskDetail table
- public final class TaskDetailConstants {
- public static final String TASK_ID = "taskId";
- public static final String NODE_INSTANCE_ID = "nodeId";
- public static final String CREATION_TIME = "creationTime";
- public static final String APPLICATION_ID = "appId";
- public static final String APPLICATION_VERSION = "appVersion";
- }
-
- // ErrorDetails table
- public final class ErrorDetailConstants {
- public static final String ERROR_ID = "errorID";
- public static final String EXPERIMENT_ID = "expId";
- public static final String TASK_ID = "taskId";
- public static final String JOB_ID = "jobId";
- public static final String NODE_INSTANCE_ID = "nodeId";
- public static final String CREATION_TIME = "creationTime";
- public static final String ACTUAL_ERROR_MESSAGE = "actualErrorMsg";
- public static final String USER_FRIEDNLY_ERROR_MSG = "userFriendlyErrorMsg";
- public static final String TRANSIENT_OR_PERSISTENT = "transientPersistent";
- public static final String ERROR_CATEGORY = "errorCategory";
- public static final String CORRECTIVE_ACTION = "correctiveAction";
- public static final String ACTIONABLE_GROUP = "actionableGroup";
- }
-
- // ApplicationInput table
- public final class ApplicationInputConstants {
- public static final String TASK_ID = "taskId";
- public static final String INPUT_KEY = "inputKey";
- public static final String INPUT_KEY_TYPE = "inputKeyType";
- public static final String METADATA = "metadata";
- public static final String VALUE = "value";
- }
-
- // ApplicationOutput table
- public final class ApplicationOutputConstants {
- public static final String TASK_ID = "taskId";
- public static final String OUTPUT_KEY = "outputKey";
- public static final String OUTPUT_KEY_TYPE = "outputKeyType";
- public static final String METADATA = "metadata";
- public static final String VALUE = "value";
- }
-
- // NodeInput table
- public final class NodeInputConstants {
- public static final String NODE_INSTANCE_ID = "nodeId";
- public static final String INPUT_KEY = "inputKey";
- public static final String INPUT_KEY_TYPE = "inputKeyType";
- public static final String METADATA = "metadata";
- public static final String VALUE = "value";
- }
-
- // NodeOutput table
- public final class NodeOutputConstants {
- public static final String NODE_INSTANCE_ID = "nodeId";
- public static final String OUTPUT_KEY = "outputKey";
- public static final String OUTPUT_KEY_TYPE = "outputKeyType";
- public static final String METADATA = "metadata";
- public static final String VALUE = "value";
- }
-
- // Job Details table constants
- public final class JobDetailConstants{
- public static final String JOB_ID = "jobId";
- public static final String TASK_ID = "taskId";
- public static final String JOB_DESCRIPTION = "jobDescription";
- public static final String CREATION_TIME = "jobDescription";
- }
-
- // Data transfer Details table constants
- public final class DataTransferDetailConstants{
- public static final String TRANSFER_ID = "transferId";
- public static final String TASK_ID = "taskId";
- public static final String TRANSFER_DESC = "transferDesc";
- public static final String CREATION_TIME = "creationTime";
- }
-
- // Status table constants
- public final class StatusConstants {
- public static final String STATUS_ID = "statusId";
- public static final String EXPERIMENT_ID = "expId";
- public static final String NODE_INSTANCE_ID = "nodeId";
- public static final String TRANSFER_ID = "transferId";
- public static final String TASK_ID = "taskId";
- public static final String JOB_ID = "jobId";
- public static final String STATE = "state";
- public static final String STATUS_UPDATE_TIME = "statusUpdateTime";
- public static final String STATUS_TYPE = "statusType";
- }
-
- public static final class ComputationalResourceSchedulingConstants{
- public static final String RESOURCE_SCHEDULING_ID = "schedulingId";
- public static final String EXPERIMENT_ID = "expId";
- public static final String TASK_ID = "taskId";
- public static final String RESOURCE_HOST_ID = "resourceHostId";
- public static final String CPU_COUNT = "cpuCount";
- public static final String NODE_COUNT = "nodeCount";
- public static final String NO_OF_THREADS = "numberOfThreads";
- public static final String QUEUE_NAME = "queueName";
- public static final String WALLTIME_LIMIT = "wallTimeLimit";
- public static final String JOB_START_TIME = "jobStartTime";
- public static final String TOTAL_PHYSICAL_MEMORY = "totalPhysicalmemory";
- public static final String COMPUTATIONAL_PROJECT_ACCOUNT = "projectName";
- }
-
- public static final class AdvancedInputDataHandlingConstants {
- public static final String INPUT_DATA_HANDLING_ID = "dataHandlingId";
- public static final String EXPERIMENT_ID = "expId";
- public static final String TASK_ID = "taskId";
- public static final String WORKING_DIR_PARENT = "parentWorkingDir";
- public static final String UNIQUE_WORKING_DIR = "workingDir";
- public static final String STAGE_INPUT_FILES_TO_WORKING_DIR = "stageInputsToWorkingDir";
- public static final String CLEAN_AFTER_JOB = "cleanAfterJob";
- }
-
- public static final class AdvancedOutputDataHandlingConstants {
- public static final String OUTPUT_DATA_HANDLING_ID = "outputDataHandlingId";
- public static final String EXPERIMENT_ID = "expId";
- public static final String TASK_ID = "taskId";
- public static final String OUTPUT_DATA_DIR = "outputDataDir";
- public static final String DATA_REG_URL = "dataRegUrl";
- public static final String PERSIST_OUTPUT_DATA = "persistOutputData";
- }
-
- public static final class QosParamsConstants {
- public static final String QOS_ID = "qosId";
- public static final String EXPERIMENT_ID = "expId";
- public static final String TASK_ID = "taskId";
- public static final String START_EXECUTION_AT = "startExecutionAt";
- public static final String EXECUTE_BEFORE = "executeBefore";
- public static final String NO_OF_RETRIES = "noOfRetries";
- }
-
-
- protected AbstractResource() {
- }
-
- public boolean isExists(ResourceType type, Object name) throws RegistryException {
- try {
- return get(type, name) != null;
- } catch (Exception e) {
- return false;
- }
- }
-
- @SuppressWarnings("unchecked")
- public static <T> List<T> getResourceList(List<Resource> resources,
- Class<?> T) {
- List<T> list = new ArrayList<T>();
- for (Resource o : resources) {
- list.add((T) o);
- }
- return list;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AdvanceInputDataHandlingResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AdvanceInputDataHandlingResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AdvanceInputDataHandlingResource.java
deleted file mode 100644
index 07b1915..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AdvanceInputDataHandlingResource.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.AdvancedInputDataHandling;
-import org.apache.airavata.persistance.registry.jpa.model.Experiment;
-import org.apache.airavata.persistance.registry.jpa.model.TaskDetail;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class AdvanceInputDataHandlingResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(AdvanceInputDataHandlingResource.class);
- private int dataHandlingId = 0;
- private String workingDirParent;
- private String workingDir;
- private boolean stageInputFiles;
- private boolean cleanAfterJob;
- private String experimentId;
- private String taskId;
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public int getDataHandlingId() {
- return dataHandlingId;
- }
-
- public void setDataHandlingId(int dataHandlingId) {
- this.dataHandlingId = dataHandlingId;
- }
-
- public String getWorkingDirParent() {
- return workingDirParent;
- }
-
- public void setWorkingDirParent(String workingDirParent) {
- this.workingDirParent = workingDirParent;
- }
-
- public String getWorkingDir() {
- return workingDir;
- }
-
- public void setWorkingDir(String workingDir) {
- this.workingDir = workingDir;
- }
-
- public boolean isStageInputFiles() {
- return stageInputFiles;
- }
-
- public void setStageInputFiles(boolean stageInputFiles) {
- this.stageInputFiles = stageInputFiles;
- }
-
- public boolean isCleanAfterJob() {
- return cleanAfterJob;
- }
-
- public void setCleanAfterJob(boolean cleanAfterJob) {
- this.cleanAfterJob = cleanAfterJob;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for input data handling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for input data handling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for input data handling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for input data handling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- AdvancedInputDataHandling dataHandling;
- if (dataHandlingId != 0) {
- dataHandling = em.find(AdvancedInputDataHandling.class, dataHandlingId);
- dataHandling.setDataHandlingId(dataHandlingId);
- } else {
- dataHandling = new AdvancedInputDataHandling();
- }
- dataHandling.setWorkingDir(workingDir);
- dataHandling.setParentWorkingDir(workingDirParent);
- dataHandling.setStageInputsToWorkingDir(stageInputFiles);
- dataHandling.setCleanAfterJob(cleanAfterJob);
- dataHandling.setExpId(experimentId);
- dataHandling.setTaskId(taskId);
- em.persist(dataHandling);
- dataHandlingId = dataHandling.getDataHandlingId();
- em.getTransaction().commit();
- em.close();
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AdvancedOutputDataHandlingResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AdvancedOutputDataHandlingResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AdvancedOutputDataHandlingResource.java
deleted file mode 100644
index 2b61549..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/AdvancedOutputDataHandlingResource.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.AdvancedOutputDataHandling;
-import org.apache.airavata.persistance.registry.jpa.model.Experiment;
-import org.apache.airavata.persistance.registry.jpa.model.TaskDetail;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class AdvancedOutputDataHandlingResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(AdvancedOutputDataHandlingResource.class);
- private int outputDataHandlingId = 0;
- private String outputDataDir;
- private String dataRegUrl;
- private boolean persistOutputData;
- private String experimentId;
- private String taskId;
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public int getOutputDataHandlingId() {
- return outputDataHandlingId;
- }
-
- public void setOutputDataHandlingId(int outputDataHandlingId) {
- this.outputDataHandlingId = outputDataHandlingId;
- }
-
- public String getOutputDataDir() {
- return outputDataDir;
- }
-
- public void setOutputDataDir(String outputDataDir) {
- this.outputDataDir = outputDataDir;
- }
-
- public String getDataRegUrl() {
- return dataRegUrl;
- }
-
- public void setDataRegUrl(String dataRegUrl) {
- this.dataRegUrl = dataRegUrl;
- }
-
- public boolean isPersistOutputData() {
- return persistOutputData;
- }
-
- public void setPersistOutputData(boolean persistOutputData) {
- this.persistOutputData = persistOutputData;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for output data handling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for output data handling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for output data handling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for output data handling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- AdvancedOutputDataHandling dataHandling;
- if (outputDataHandlingId != 0 ){
- dataHandling = em.find(AdvancedOutputDataHandling.class, outputDataHandlingId);
- dataHandling.setOutputDataHandlingId(outputDataHandlingId);
- }else {
- dataHandling = new AdvancedOutputDataHandling();
- }
- dataHandling.setDataRegUrl(dataRegUrl);
- dataHandling.setOutputDataDir(outputDataDir);
- dataHandling.setPersistOutputData(persistOutputData);
- dataHandling.setExpId(experimentId);
- dataHandling.setTaskId(taskId);
- em.persist(dataHandling);
- outputDataHandlingId = dataHandling.getOutputDataHandlingId();
- em.getTransaction().commit();
- em.close();
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- }finally {
- if (em != null && em.isOpen()){
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationInputResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationInputResource.java
deleted file mode 100644
index 1bab796..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationInputResource.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- *
- * 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.resources;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.ApplicationInput;
-import org.apache.airavata.persistance.registry.jpa.model.ApplicationInput_PK;
-import org.apache.airavata.persistance.registry.jpa.model.TaskDetail;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ApplicationInputResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(ApplicationInputResource.class);
- private String inputKey;
- private String dataType;
- private String metadata;
- private String value;
- private String appArgument;
- private boolean standardInput;
- private String userFriendlyDesc;
- private int inputOrder;
- private boolean isRequired;
- private boolean requiredToCMD;
- private boolean dataStaged;
- private String taskId;
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataStaged() {
- return dataStaged;
- }
-
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
- }
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for application input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for application input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for application input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for application input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- ApplicationInput existingInput = em.find(ApplicationInput.class, new ApplicationInput_PK(inputKey, taskId));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- ApplicationInput applicationInput = new ApplicationInput();
- applicationInput.setTaskId(taskId);
- applicationInput.setInputKey(inputKey);
- applicationInput.setDataType(dataType);
- applicationInput.setAppArgument(appArgument);
- applicationInput.setStandardInput(standardInput);
- applicationInput.setUserFriendlyDesc(userFriendlyDesc);
- applicationInput.setInputOrder(inputOrder);
- applicationInput.setRequiredToCMD(requiredToCMD);
- applicationInput.setRequired(isRequired);
- applicationInput.setDataStaged(dataStaged);
- if (value != null) {
- applicationInput.setValue(value.toCharArray());
- }
-
- applicationInput.setMetadata(metadata);
-
- if (existingInput != null) {
- existingInput.setTaskId(taskId);
- existingInput.setInputKey(inputKey);
- existingInput.setDataType(dataType);
- existingInput.setAppArgument(appArgument);
- existingInput.setStandardInput(standardInput);
- existingInput.setUserFriendlyDesc(userFriendlyDesc);
- existingInput.setInputOrder(inputOrder);
- existingInput.setRequiredToCMD(requiredToCMD);
- existingInput.setRequired(isRequired);
- existingInput.setDataStaged(dataStaged);
- if (value != null) {
- existingInput.setValue(value.toCharArray());
- }
- existingInput.setMetadata(metadata);
- applicationInput = em.merge(existingInput);
- } else {
- em.persist(applicationInput);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- throw new RegistryException(e.getMessage());
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationOutputResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationOutputResource.java
deleted file mode 100644
index 0127cde..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ApplicationOutputResource.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- *
- * 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.resources;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.ApplicationOutput;
-import org.apache.airavata.persistance.registry.jpa.model.ApplicationOutput_PK;
-import org.apache.airavata.persistance.registry.jpa.model.TaskDetail;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ApplicationOutputResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(ApplicationOutputResource.class);
- private String taskId;
- private String outputKey;
- private String dataType;
- private String value;
- private boolean isRequired;
- private boolean dataMovement;
- private String dataNameLocation;
- private boolean requiredToCMD;
- private String searchQuery;
- private String appArgument;
-
- public String getSearchQuery() {
- return searchQuery;
- }
-
- public void setSearchQuery(String searchQuery) {
- this.searchQuery = searchQuery;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for application output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for application output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for application output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for application output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- ApplicationOutput existingOutput = em.find(ApplicationOutput.class, new ApplicationOutput_PK(outputKey, taskId));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- ApplicationOutput applicationOutput = new ApplicationOutput();
- applicationOutput.setTaskId(taskId);
- applicationOutput.setOutputKey(outputKey);
- applicationOutput.setDataType(dataType);
- applicationOutput.setRequired(isRequired);
- applicationOutput.setAddedToCmd(requiredToCMD);
- applicationOutput.setDataMovement(dataMovement);
- applicationOutput.setDataNameLocation(dataNameLocation);
- applicationOutput.setSearchQuery(searchQuery);
- applicationOutput.setApplicationArgument(appArgument);
- if (value != null){
- applicationOutput.setValue(value.toCharArray());
- }
-
- if (existingOutput != null) {
- existingOutput.setTaskId(taskId);
- existingOutput.setOutputKey(outputKey);
- existingOutput.setDataType(dataType);
- existingOutput.setRequired(isRequired);
- existingOutput.setAddedToCmd(requiredToCMD);
- existingOutput.setDataMovement(dataMovement);
- existingOutput.setDataNameLocation(dataNameLocation);
- existingOutput.setSearchQuery(searchQuery);
- existingOutput.setApplicationArgument(appArgument);
- if (value != null){
- existingOutput.setValue(value.toCharArray());
- }
- applicationOutput = em.merge(existingOutput);
- } else {
- em.persist(applicationOutput);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e.getMessage());
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ComputationSchedulingResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ComputationSchedulingResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ComputationSchedulingResource.java
deleted file mode 100644
index 9789a82..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ComputationSchedulingResource.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.Computational_Resource_Scheduling;
-import org.apache.airavata.persistance.registry.jpa.model.Experiment;
-import org.apache.airavata.persistance.registry.jpa.model.TaskDetail;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.sql.Timestamp;
-import java.util.List;
-
-public class ComputationSchedulingResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(ComputationSchedulingResource.class);
- private int schedulingId = 0;
- private String experimentId;
- private String taskId;
- private String resourceHostId;
- private int cpuCount;
- private int nodeCount;
- private int numberOfThreads;
- private String queueName;
- private int walltimeLimit;
- private Timestamp jobStartTime;
- private int physicalMemory;
- private String projectName;
- private String chessisName;
-
- public String getChessisName() {
- return chessisName;
- }
-
- public void setChessisName(String chessisName) {
- this.chessisName = chessisName;
- }
-
- public int getSchedulingId() {
- return schedulingId;
- }
-
- public void setSchedulingId(int schedulingId) {
- this.schedulingId = schedulingId;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getResourceHostId() {
- return resourceHostId;
- }
-
- public void setResourceHostId(String resourceHostId) {
- this.resourceHostId = resourceHostId;
- }
-
- public int getCpuCount() {
- return cpuCount;
- }
-
- public void setCpuCount(int cpuCount) {
- this.cpuCount = cpuCount;
- }
-
- public int getNodeCount() {
- return nodeCount;
- }
-
- public void setNodeCount(int nodeCount) {
- this.nodeCount = nodeCount;
- }
-
- public int getNumberOfThreads() {
- return numberOfThreads;
- }
-
- public void setNumberOfThreads(int numberOfThreads) {
- this.numberOfThreads = numberOfThreads;
- }
-
- public String getQueueName() {
- return queueName;
- }
-
- public void setQueueName(String queueName) {
- this.queueName = queueName;
- }
-
- public int getWalltimeLimit() {
- return walltimeLimit;
- }
-
- public void setWalltimeLimit(int walltimeLimit) {
- this.walltimeLimit = walltimeLimit;
- }
-
- public Timestamp getJobStartTime() {
- return jobStartTime;
- }
-
- public void setJobStartTime(Timestamp jobStartTime) {
- this.jobStartTime = jobStartTime;
- }
-
- public int getPhysicalMemory() {
- return physicalMemory;
- }
-
- public void setPhysicalMemory(int physicalMemory) {
- this.physicalMemory = physicalMemory;
- }
-
- public String getProjectName() {
- return projectName;
- }
-
- public void setProjectName(String projectName) {
- this.projectName = projectName;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for computational scheduling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for computational scheduling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for computational scheduling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for computational scheduling resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Computational_Resource_Scheduling scheduling;
- if (schedulingId != 0) {
- scheduling = em.find(Computational_Resource_Scheduling.class, schedulingId);
- scheduling.setSchedulingId(schedulingId);
- } else {
- scheduling = new Computational_Resource_Scheduling();
- }
- scheduling.setExpId(experimentId);
- scheduling.setTaskId(taskId);
- scheduling.setResourceHostId(resourceHostId);
- scheduling.setCpuCount(cpuCount);
- scheduling.setNodeCount(nodeCount);
- scheduling.setNumberOfThreads(numberOfThreads);
- scheduling.setQueueName(queueName);
- scheduling.setWallTimeLimit(walltimeLimit);
- scheduling.setJobStartTime(jobStartTime);
- scheduling.setTotalPhysicalmemory(physicalMemory);
- scheduling.setProjectName(projectName);
- scheduling.setChessisName(chessisName);
- em.persist(scheduling);
- schedulingId = scheduling.getSchedulingId();
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
[15/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
deleted file mode 100644
index 0775f77..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
+++ /dev/null
@@ -1,515 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.*;
-import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.utils.StatusType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.airavata.registry.cpi.RegistryException;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class WorkflowNodeDetailResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(WorkflowNodeDetailResource.class);
- private String experimentId;
- private String nodeInstanceId;
- private Timestamp creationTime;
- private String nodeName;
- private String executionUnit;
- private String executionUnitData;
- private List<TaskDetailResource> taskDetailResourceList;
- private List<NodeInputResource> nodeInputs;
- private List<NodeOutputResource> nodeOutputs;
- private StatusResource nodeStatus;
- private List<ErrorDetailResource> erros;
-
- public List<TaskDetailResource> getTaskDetailResourceList() {
- return taskDetailResourceList;
- }
-
- public void setTaskDetailResourceList(List<TaskDetailResource> taskDetailResourceList) {
- this.taskDetailResourceList = taskDetailResourceList;
- }
-
- public void setNodeInputs(List<NodeInputResource> nodeInputs) {
- this.nodeInputs = nodeInputs;
- }
-
- public void setNodeOutputs(List<NodeOutputResource> nodeOutputs) {
- this.nodeOutputs = nodeOutputs;
- }
-
- public StatusResource getNodeStatus() {
- return nodeStatus;
- }
-
- public void setNodeStatus(StatusResource nodeStatus) {
- this.nodeStatus = nodeStatus;
- }
-
- public List<ErrorDetailResource> getErros() {
- return erros;
- }
-
- public void setErros(List<ErrorDetailResource> erros) {
- this.erros = erros;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getNodeInstanceId() {
- return nodeInstanceId;
- }
-
- public void setNodeInstanceId(String nodeInstanceId) {
- this.nodeInstanceId = nodeInstanceId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getNodeName() {
- return nodeName;
- }
-
- public void setNodeName(String nodeName) {
- this.nodeName = nodeName;
- }
-
- public Resource create(ResourceType type) throws RegistryException{
- switch (type){
- case TASK_DETAIL:
- TaskDetailResource taskDetailResource = new TaskDetailResource();
- taskDetailResource.setNodeId(nodeInstanceId);
- return taskDetailResource;
- case ERROR_DETAIL:
- ErrorDetailResource errorDetailResource = new ErrorDetailResource();
- errorDetailResource.setNodeId(nodeInstanceId);;
- return errorDetailResource;
- case NODE_INPUT:
- NodeInputResource nodeInputResource = new NodeInputResource();
- nodeInputResource.setNodeId(nodeInstanceId);
- return nodeInputResource;
- case NODE_OUTPUT:
- NodeOutputResource nodeOutputResource = new NodeOutputResource();
- nodeOutputResource.setNodeId(nodeInstanceId);
- return nodeOutputResource;
- case STATUS:
- StatusResource statusResource = new StatusResource();
- statusResource.setNodeId(nodeInstanceId);
- return statusResource;
- default:
- logger.error("Unsupported resource type for workflow node detail resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for workflow node detail resource.");
- }
- }
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- switch (type) {
- case TASK_DETAIL:
- generator = new QueryGenerator(TASK_DETAIL);
- generator.setParameter(TaskDetailConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.NODE_INSTANCE_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case NODE_INPUT:
- generator = new QueryGenerator(NODE_INPUT);
- generator.setParameter(NodeInputConstants.NODE_INSTANCE_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case NODE_OUTPUT:
- generator = new QueryGenerator(NODE_OUTPUT);
- generator.setParameter(NodeOutputConstants.NODE_INSTANCE_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.NODE_INSTANCE_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.WORKFLOW_NODE.toString());
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- default:
- logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case TASK_DETAIL:
- generator = new QueryGenerator(TASK_DETAIL);
- generator.setParameter(TaskDetailConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- TaskDetail taskDetail = (TaskDetail) q.getSingleResult();
- TaskDetailResource taskDetailResource = (TaskDetailResource) Utils.getResource(ResourceType.TASK_DETAIL, taskDetail);
- em.getTransaction().commit();
- em.close();
- return taskDetailResource;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.NODE_INSTANCE_ID, name);
- q = generator.selectQuery(em);
- ErrorDetail errorDetail = (ErrorDetail) q.getSingleResult();
- ErrorDetailResource errorDetailResource = (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- em.getTransaction().commit();
- em.close();
- return errorDetailResource;
- case NODE_INPUT:
- generator = new QueryGenerator(NODE_INPUT);
- generator.setParameter(NodeInputConstants.NODE_INSTANCE_ID, name);
- q = generator.selectQuery(em);
- NodeInput nodeInput = (NodeInput) q.getSingleResult();
- NodeInputResource nodeInputResource = (NodeInputResource) Utils.getResource(ResourceType.NODE_INPUT, nodeInput);
- em.getTransaction().commit();
- em.close();
- return nodeInputResource;
- case NODE_OUTPUT:
- generator = new QueryGenerator(NODE_OUTPUT);
- generator.setParameter(NodeOutputConstants.NODE_INSTANCE_ID, name);
- q = generator.selectQuery(em);
- NodeOutput nodeOutput = (NodeOutput) q.getSingleResult();
- NodeOutputResource nodeOutputResource = (NodeOutputResource) Utils.getResource(ResourceType.NODE_OUTPUT, nodeOutput);
- em.getTransaction().commit();
- em.close();
- return nodeOutputResource;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.NODE_INSTANCE_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.WORKFLOW_NODE.toString());
- q = generator.selectQuery(em);
- Status status = (Status) q.getSingleResult();
- StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- em.getTransaction().commit();
- em.close();
- return statusResource;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for workflow node resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for workflow node resource.");
- }
- } catch (Exception e) {
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- List results;
- switch (type) {
- case TASK_DETAIL:
- generator = new QueryGenerator(TASK_DETAIL);
- generator.setParameter(TaskDetailConstants.NODE_INSTANCE_ID, nodeInstanceId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- TaskDetail taskDetail = (TaskDetail) result;
- TaskDetailResource taskDetailResource =
- (TaskDetailResource) Utils.getResource(ResourceType.TASK_DETAIL, taskDetail);
- resourceList.add(taskDetailResource);
- }
- }
- break;
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.NODE_INSTANCE_ID, nodeInstanceId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ErrorDetail errorDetail = (ErrorDetail) result;
- ErrorDetailResource errorDetailResource =
- (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- resourceList.add(errorDetailResource);
- }
- }
- break;
- case NODE_INPUT:
- generator = new QueryGenerator(NODE_INPUT);
- generator.setParameter(NodeInputConstants.NODE_INSTANCE_ID, nodeInstanceId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- NodeInput nodeInput = (NodeInput) result;
- NodeInputResource nodeInputResource =
- (NodeInputResource) Utils.getResource(ResourceType.NODE_INPUT, nodeInput);
- resourceList.add(nodeInputResource);
- }
- }
- break;
- case NODE_OUTPUT:
- generator = new QueryGenerator(NODE_OUTPUT);
- generator.setParameter(NodeOutputConstants.NODE_INSTANCE_ID, nodeInstanceId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- NodeOutput nodeOutput = (NodeOutput) result;
- NodeOutputResource nodeOutputResource =
- (NodeOutputResource) Utils.getResource(ResourceType.NODE_OUTPUT, nodeOutput);
- resourceList.add(nodeOutputResource);
- }
- }
- break;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.NODE_INSTANCE_ID, nodeInstanceId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Status status = (Status) result;
- StatusResource statusResource =
- (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- resourceList.add(statusResource);
- }
- }
- break;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for workflow node details resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
-// logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- WorkflowNodeDetail existingNode = em.find(WorkflowNodeDetail.class, nodeInstanceId);
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- WorkflowNodeDetail workflowNodeDetail = new WorkflowNodeDetail();
- workflowNodeDetail.setNodeId(nodeInstanceId);
- workflowNodeDetail.setExpId(experimentId);
- workflowNodeDetail.setCreationTime(creationTime);
- workflowNodeDetail.setNodeName(nodeName);
- workflowNodeDetail.setExecutionUnit(getExecutionUnit());
- workflowNodeDetail.setExecutionUnitData(getExecutionUnitData());
-
- if (existingNode != null) {
- existingNode.setExpId(experimentId);
- existingNode.setCreationTime(creationTime);
- existingNode.setNodeName(nodeName);
- existingNode.setExecutionUnit(getExecutionUnit());
- existingNode.setExecutionUnitData(getExecutionUnitData());
- workflowNodeDetail = em.merge(existingNode);
- } else {
- em.persist(workflowNodeDetail);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<NodeInputResource> getNodeInputs() {
- return nodeInputs;
- }
-
- public List<NodeOutputResource> getNodeOutputs() {
- return nodeOutputs;
- }
-
- public List<NodeInputResource> getNodeInputs1() throws RegistryException{
- List<NodeInputResource> nodeInputResourceList = new ArrayList<NodeInputResource>();
- List<Resource> resources = get(ResourceType.NODE_INPUT);
- for (Resource resource : resources) {
- NodeInputResource nodeInputResource = (NodeInputResource) resource;
- nodeInputResourceList.add(nodeInputResource);
- }
- return nodeInputResourceList;
- }
-
- public List<NodeOutputResource> getNodeOutputs1() throws RegistryException{
- List<NodeOutputResource> outputResources = new ArrayList<NodeOutputResource>();
- List<Resource> resources = get(ResourceType.NODE_OUTPUT);
- for (Resource resource : resources) {
- NodeOutputResource nodeOutputResource = (NodeOutputResource) resource;
- outputResources.add(nodeOutputResource);
- }
- return outputResources;
- }
-
- public StatusResource getWorkflowNodeStatus() throws RegistryException{
- List<Resource> resources = get(ResourceType.STATUS);
- for (Resource resource : resources) {
- StatusResource nodeStatus = (StatusResource) resource;
- if(nodeStatus.getStatusType().equals(StatusType.WORKFLOW_NODE.toString())){
- if (nodeStatus.getState() == null || nodeStatus.getState().equals("") ){
- nodeStatus.setState("UNKNOWN");
- }
- return nodeStatus;
- }
- }
- return null;
- }
-
- public StatusResource getTaskStatus(String taskId) throws RegistryException{
- List<Resource> resources = get(ResourceType.STATUS);
- for (Resource resource : resources) {
- StatusResource taskStatus = (StatusResource) resource;
- if(taskStatus.getStatusType().equals(StatusType.TASK.toString()) && taskStatus.getTaskId().equals(taskId)){
- if (taskStatus.getState() == null || taskStatus.getState().equals("") ){
- taskStatus.setState("UNKNOWN");
- }
- return taskStatus;
- }
- }
- return null;
- }
-
- public List<TaskDetailResource> getTaskDetails() throws RegistryException{
- List<TaskDetailResource> taskDetailResources = new ArrayList<TaskDetailResource>();
- List<Resource> resources = get(ResourceType.TASK_DETAIL);
- for (Resource resource : resources) {
- TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
- taskDetailResources.add(taskDetailResource);
- }
- return taskDetailResources;
- }
-
- public List<ErrorDetailResource> getErrorDetails() throws RegistryException{
- List<ErrorDetailResource> errorDetails = new ArrayList<ErrorDetailResource>();
- List<Resource> resources = get(ResourceType.ERROR_DETAIL);
- for (Resource resource : resources) {
- ErrorDetailResource errorDetailResource = (ErrorDetailResource) resource;
- errorDetails.add(errorDetailResource);
- }
- return errorDetails;
- }
-
- public TaskDetailResource getTaskDetail(String taskId) throws RegistryException{
- return (TaskDetailResource)get(ResourceType.TASK_DETAIL, taskId);
- }
-
- public String getExecutionUnit() {
- return executionUnit;
- }
-
- public void setExecutionUnit(String executionUnit) {
- this.executionUnit = executionUnit;
- }
-
- public String getExecutionUnitData() {
- return executionUnitData;
- }
-
- public void setExecutionUnitData(String executionUnitData) {
- this.executionUnitData = executionUnitData;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/QueryGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/QueryGenerator.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/QueryGenerator.java
deleted file mode 100644
index b0ebe45..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/QueryGenerator.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- *
- * 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.utils;
-
-import org.apache.airavata.registry.cpi.ResultOrderType;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.HashMap;
-import java.util.Map;
-
-public class QueryGenerator {
- private String tableName;
- private Map<String,Object> matches=new HashMap<String, Object>();
- private static final String SELECT_OBJ="p";
- private static final String DELETE_OBJ="p";
- private static final String TABLE_OBJ="p";
-//
-// public QueryGenerator(String tableName) {
-// setTableName(tableName);
-// }
-
- public QueryGenerator(String tableName, Object[]...params) {
- setTableName(tableName);
- for (Object[] param : params) {
- addMatch(param[0].toString(), param[1]);
- }
- }
-
- public String getTableName() {
- return tableName;
- }
- public void setTableName(String tableName) {
- this.tableName = tableName;
- }
- public void addMatch(String colName, Object matchValue){
- matches.put(colName, matchValue);
- }
-
- public void setParameter(String colName, Object matchValue){
- addMatch(colName, matchValue);
- }
-
- /**
- * Select query
- * @param entityManager
- * @return
- */
- public Query selectQuery(EntityManager entityManager){
- String queryString="SELECT "+ SELECT_OBJ + " FROM " +getTableName()+" "+TABLE_OBJ;
- return generateQueryWithParameters(entityManager, queryString);
- }
-
- /**
- * Select query with pagination
- * @param entityManager
- * @param orderByColumn
- * @param resultOrderType
- * @return
- */
- public Query selectQuery(EntityManager entityManager, String orderByColumn,
- ResultOrderType resultOrderType){
- String order = (resultOrderType == ResultOrderType.ASC) ? "ASC" : "DESC";
- String orderByClause = " ORDER BY " + SELECT_OBJ + "." + orderByColumn + " " + order;
- String queryString="SELECT "+ SELECT_OBJ + " FROM " +getTableName()+" "+TABLE_OBJ;
- return generateQueryWithParameters(entityManager, queryString, orderByClause);
- }
-
-// public Query countQuery(EntityManager entityManager){
-// SELECT COUNT(p.host_descriptor_ID) FROM Host_Descriptor p WHERE p.gateway_name =:gate_ID and p.host_descriptor_ID =:host_desc_name")
-// String queryString="SELECT COUNT("+ SELECT_OBJ + " FROM " +getTableName()+" "+TABLE_OBJ;
-// return generateQueryWithParameters(entityManager, queryString);
-// }
-
- public Query deleteQuery(EntityManager entityManager){
- String queryString="Delete FROM "+getTableName()+" "+TABLE_OBJ;
- return generateQueryWithParameters(entityManager, queryString);
- }
-
- private Query generateQueryWithParameters(EntityManager entityManager,
- String queryString) {
- return generateQueryWithParameters(entityManager, queryString, "");
- }
-
- private Query generateQueryWithParameters(EntityManager entityManager,
- String queryString, String orderByClause) {
- Map<String,Object> queryParameters=new HashMap<String, Object>();
- if (matches.size()>0){
- String matchString = "";
- int paramCount=0;
- for (String colName : matches.keySet()) {
- String paramName="param"+paramCount;
- queryParameters.put(paramName, matches.get(colName));
- if (!matchString.equals("")){
- matchString+=" AND ";
- }
- matchString+=TABLE_OBJ+"."+colName+" =:"+paramName;
- paramCount++;
- }
- queryString+=" WHERE "+matchString;
- }
- queryString += orderByClause;
- Query query = entityManager.createQuery(queryString);
- for (String paramName : queryParameters.keySet()) {
- query.setParameter(paramName, queryParameters.get(paramName));
- }
- return query;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
deleted file mode 100644
index 28c5604..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
+++ /dev/null
@@ -1,686 +0,0 @@
-/*
-*
-* 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.utils;
-
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.model.appcatalog.appinterface.DataType;
-import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
-import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
-import org.apache.airavata.model.workspace.Gateway;
-import org.apache.airavata.model.workspace.Project;
-import org.apache.airavata.model.workspace.experiment.*;
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.resources.*;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ThriftDataModelConversion {
- private final static Logger logger = LoggerFactory.getLogger(ThriftDataModelConversion.class);
-
- public static Project getProject (ProjectResource pr) throws RegistryException {
- if (pr != null) {
- Project project = new Project();
- project.setProjectID(pr.getId());
- project.setName(pr.getName());
- if (pr.getCreationTime()!=null) {
- project.setCreationTime(pr.getCreationTime().getTime());
- }
- project.setDescription(pr.getDescription());
- project.setOwner(pr.getWorker().getUser());
- List<ProjectUserResource> projectUserList = pr.getProjectUserList();
- List<String> sharedUsers = new ArrayList<String>();
- if (projectUserList != null && !projectUserList.isEmpty()){
- for (ProjectUserResource resource : projectUserList){
- sharedUsers.add(resource.getUserName());
- }
- }
- project.setSharedUsers(sharedUsers);
- return project;
- }
- return null;
- }
-
- public static Gateway getGateway (GatewayResource resource){
- Gateway gateway = new Gateway();
- gateway.setGatewayId(resource.getGatewayId());
- gateway.setGatewayName(resource.getGatewayName());
- gateway.setDomain(resource.getDomain());
- gateway.setEmailAddress(resource.getEmailAddress());
- return gateway;
- }
-
- public static List<Gateway> getAllGateways (List<Resource> gatewayList){
- List<Gateway> gateways = new ArrayList<Gateway>();
- for (Resource resource : gatewayList){
- gateways.add(getGateway((GatewayResource)resource));
- }
- return gateways;
- }
-
-
- public static Experiment getExperiment(ExperimentResource experimentResource) throws RegistryException {
- if (experimentResource != null){
- Experiment experiment = new Experiment();
- experiment.setProjectID(experimentResource.getProjectId());
- experiment.setExperimentID(experimentResource.getExpID());
- experiment.setCreationTime(experimentResource.getCreationTime().getTime());
- experiment.setUserName(experimentResource.getExecutionUser());
- experiment.setName(experimentResource.getExpName());
- experiment.setDescription(experimentResource.getDescription());
- experiment.setApplicationId(experimentResource.getApplicationId());
- experiment.setApplicationVersion(experimentResource.getApplicationVersion());
- experiment.setWorkflowTemplateId(experimentResource.getWorkflowTemplateId());
- experiment.setEnableEmailNotification(experimentResource.isEnableEmailNotifications());
- experiment.setGatewayExecutionId(experimentResource.getGatewayExecutionId());
- if (experiment.isEnableEmailNotification()){
- List<NotificationEmailResource> notificationEmails = experimentResource.getNotificationEmails();
- experiment.setEmailAddresses(getEmailAddresses(notificationEmails));
- }
- experiment.setWorkflowTemplateVersion(experimentResource.getWorkflowTemplateVersion());
- experiment.setWorkflowExecutionInstanceId(experimentResource.getWorkflowExecutionId());
- List<ExperimentInputResource> experimentInputs = experimentResource.getExperimentInputs();
- experiment.setExperimentInputs(getExpInputs(experimentInputs));
- List<ExperimentOutputResource> experimentOutputs = experimentResource.getExperimentOutputs();
- experiment.setExperimentOutputs(getExpOutputs(experimentOutputs));
- StatusResource experimentStatus = experimentResource.getExperimentStatus();
- if (experimentStatus != null){
- experiment.setExperimentStatus(getExperimentStatus(experimentStatus));
- }
- List<StatusResource> changeList = experimentResource.getWorkflowNodeStatuses();
- if (changeList != null && !changeList.isEmpty()){
- experiment.setStateChangeList(getWorkflowNodeStatusList(changeList));
- }
-
- List<WorkflowNodeDetailResource> workflowNodeDetails = experimentResource.getWorkflowNodeDetails();
- if (workflowNodeDetails != null && !workflowNodeDetails.isEmpty()){
- experiment.setWorkflowNodeDetailsList(getWfNodeList(workflowNodeDetails));
- }
- List<ErrorDetailResource> errorDetails = experimentResource.getErrorDetails();
- if (errorDetails!= null && !errorDetails.isEmpty()){
- experiment.setErrors(getErrorDetailList(errorDetails));
- }
- if (experimentResource.isExists(ResourceType.CONFIG_DATA, experimentResource.getExpID())){
- ConfigDataResource userConfigData = experimentResource.getUserConfigData(experimentResource.getExpID());
- experiment.setUserConfigurationData(getUserConfigData(userConfigData));
- }
- return experiment;
- }
- return null;
- }
-
- public static ExperimentSummary getExperimentSummary(ExperimentSummaryResource experimentSummaryResource) throws RegistryException {
- if (experimentSummaryResource != null){
- ExperimentSummary experimentSummary = new ExperimentSummary();
- experimentSummary.setProjectID(experimentSummaryResource.getProjectID());
- experimentSummary.setExperimentID(experimentSummaryResource.getExpID());
- experimentSummary.setCreationTime(experimentSummaryResource.getCreationTime().getTime());
- experimentSummary.setUserName(experimentSummaryResource.getExecutionUser());
- experimentSummary.setName(experimentSummaryResource.getExpName());
- experimentSummary.setDescription(experimentSummaryResource.getDescription());
- experimentSummary.setApplicationId(experimentSummaryResource.getApplicationId());
- StatusResource experimentStatus = experimentSummaryResource.getStatus();
- if (experimentStatus != null){
- experimentSummary.setExperimentStatus(getExperimentStatus(experimentStatus));
- }
- return experimentSummary;
- }
- return null;
- }
-
- public static InputDataObjectType getInput(Object object){
- if (object != null){
- InputDataObjectType dataObjectType = new InputDataObjectType();
- if (object instanceof ExperimentInputResource){
- ExperimentInputResource expInput = (ExperimentInputResource) object;
- dataObjectType.setName(expInput.getExperimentKey());
- dataObjectType.setValue(expInput.getValue());
- if (expInput.getDataType() != null){
- dataObjectType.setType(DataType.valueOf(expInput.getDataType()));
- }
- dataObjectType.setMetaData(expInput.getMetadata());
- dataObjectType.setApplicationArgument(expInput.getAppArgument());
- dataObjectType.setStandardInput(expInput.isStandardInput());
- dataObjectType.setUserFriendlyDescription(expInput.getUserFriendlyDesc());
- dataObjectType.setInputOrder(expInput.getInputOrder());
- dataObjectType.setIsRequired(expInput.getRequired());
- dataObjectType.setRequiredToAddedToCommandLine(expInput.getRequiredToCMD());
- dataObjectType.setDataStaged(expInput.isDataStaged());
- return dataObjectType;
- }else if (object instanceof NodeInputResource){
- NodeInputResource nodeInputResource = (NodeInputResource)object;
- dataObjectType.setName(nodeInputResource.getInputKey());
- dataObjectType.setValue(nodeInputResource.getValue());
- if (nodeInputResource.getDataType() != null){
- dataObjectType.setType(DataType.valueOf(nodeInputResource.getDataType()));
- }
- dataObjectType.setMetaData(nodeInputResource.getMetadata());
- dataObjectType.setApplicationArgument(nodeInputResource.getAppArgument());
- dataObjectType.setStandardInput(nodeInputResource.isStandardInput());
- dataObjectType.setUserFriendlyDescription(nodeInputResource.getUserFriendlyDesc());
- dataObjectType.setInputOrder(nodeInputResource.getInputOrder());
- dataObjectType.setIsRequired(nodeInputResource.getRequired());
- dataObjectType.setRequiredToAddedToCommandLine(nodeInputResource.getRequiredToCMD());
- dataObjectType.setDataStaged(nodeInputResource.isDataStaged());
- return dataObjectType;
- }else if (object instanceof ApplicationInputResource){
- ApplicationInputResource inputResource = (ApplicationInputResource)object;
- dataObjectType.setName(inputResource.getInputKey());
- dataObjectType.setValue(inputResource.getValue());
- if (inputResource.getDataType() != null){
- dataObjectType.setType(DataType.valueOf(inputResource.getDataType()));
- }
- dataObjectType.setMetaData(inputResource.getMetadata());
- dataObjectType.setApplicationArgument(inputResource.getAppArgument());
- dataObjectType.setStandardInput(inputResource.isStandardInput());
- dataObjectType.setUserFriendlyDescription(inputResource.getUserFriendlyDesc());
- dataObjectType.setInputOrder(inputResource.getInputOrder());
- dataObjectType.setIsRequired(inputResource.isRequired());
- dataObjectType.setRequiredToAddedToCommandLine(inputResource.isRequiredToCMD());
- dataObjectType.setDataStaged(inputResource.isDataStaged());
- return dataObjectType;
- }else {
- return null;
- }
- }
- return null;
- }
-
- public static OutputDataObjectType getOutput(Object object){
- if (object != null){
- OutputDataObjectType dataObjectType = new OutputDataObjectType();
- if (object instanceof ExperimentOutputResource){
- ExperimentOutputResource expOutput = (ExperimentOutputResource)object;
- dataObjectType.setName(expOutput.getExperimentKey());
- dataObjectType.setValue(expOutput.getValue());
- if (expOutput.getDataType() != null){
- dataObjectType.setType(DataType.valueOf(expOutput.getDataType()));
- }
- dataObjectType.setIsRequired(expOutput.getRequired());
- dataObjectType.setRequiredToAddedToCommandLine(expOutput.getRequiredToCMD());
- dataObjectType.setDataMovement(expOutput.isDataMovement());
- dataObjectType.setLocation(expOutput.getDataNameLocation());
- dataObjectType.setSearchQuery(expOutput.getSearchQuery());
- dataObjectType.setApplicationArgument(expOutput.getAppArgument());
- return dataObjectType;
- }else if (object instanceof NodeOutputResource){
- NodeOutputResource nodeOutputResource = (NodeOutputResource)object;
- dataObjectType.setName(nodeOutputResource.getOutputKey());
- dataObjectType.setValue(nodeOutputResource.getValue());
- if (nodeOutputResource.getDataType() != null){
- dataObjectType.setType(DataType.valueOf(nodeOutputResource.getDataType()));
- }
- dataObjectType.setIsRequired(nodeOutputResource.getRequired());
- dataObjectType.setRequiredToAddedToCommandLine(nodeOutputResource.getRequiredToCMD());
- dataObjectType.setDataMovement(nodeOutputResource.isDataMovement());
- dataObjectType.setLocation(nodeOutputResource.getDataNameLocation());
- dataObjectType.setSearchQuery(nodeOutputResource.getSearchQuery());
- dataObjectType.setApplicationArgument(nodeOutputResource.getAppArgument());
- return dataObjectType;
- }else if (object instanceof ApplicationOutputResource){
- ApplicationOutputResource outputResource = (ApplicationOutputResource)object;
- dataObjectType.setName(outputResource.getOutputKey());
- dataObjectType.setValue(outputResource.getValue());
- dataObjectType.setIsRequired(outputResource.isRequired());
- dataObjectType.setRequiredToAddedToCommandLine(outputResource.isRequiredToCMD());
- if (outputResource.getDataType() != null){
- dataObjectType.setType(DataType.valueOf(outputResource.getDataType()));
- }
- dataObjectType.setDataMovement(outputResource.isDataMovement());
- dataObjectType.setLocation(outputResource.getDataNameLocation());
- dataObjectType.setSearchQuery(outputResource.getSearchQuery());
- dataObjectType.setApplicationArgument(outputResource.getAppArgument());
- return dataObjectType;
- }else {
- return null;
- }
- }
- return null;
- }
-
- public static List<String> getEmailAddresses (List<NotificationEmailResource> resourceList){
- List<String> emailAddresses = new ArrayList<String>();
- if (resourceList != null && !resourceList.isEmpty()){
- for (NotificationEmailResource emailResource : resourceList){
- emailAddresses.add(emailResource.getEmailAddress());
- }
- }
- return emailAddresses;
- }
-
- public static List<InputDataObjectType> getExpInputs (List<ExperimentInputResource> exInputList){
- List<InputDataObjectType> expInputs = new ArrayList<InputDataObjectType>();
- if (exInputList != null && !exInputList.isEmpty()){
- for (ExperimentInputResource inputResource : exInputList){
- InputDataObjectType exInput = getInput(inputResource);
- expInputs.add(exInput);
- }
- }
- return expInputs;
- }
-
- public static List<OutputDataObjectType> getExpOutputs (List<ExperimentOutputResource> experimentOutputResourceList){
- List<OutputDataObjectType> exOutputs = new ArrayList<OutputDataObjectType>();
- if (experimentOutputResourceList != null && !experimentOutputResourceList.isEmpty()){
- for (ExperimentOutputResource outputResource : experimentOutputResourceList){
- OutputDataObjectType output = getOutput(outputResource);
- exOutputs.add(output);
- }
- }
- return exOutputs;
- }
-
- public static List<InputDataObjectType> getNodeInputs (List<NodeInputResource> nodeInputResources){
- List<InputDataObjectType> nodeInputs = new ArrayList<InputDataObjectType>();
- if (nodeInputResources != null && !nodeInputResources.isEmpty()){
- for (NodeInputResource inputResource : nodeInputResources){
- InputDataObjectType nodeInput = getInput(inputResource);
- nodeInputs.add(nodeInput);
- }
- }
- return nodeInputs;
- }
-
- public static List<OutputDataObjectType> getNodeOutputs (List<NodeOutputResource> nodeOutputResourceList){
- List<OutputDataObjectType> nodeOutputs = new ArrayList<OutputDataObjectType>();
- if (nodeOutputResourceList != null && !nodeOutputResourceList.isEmpty()){
- for (NodeOutputResource outputResource : nodeOutputResourceList){
- OutputDataObjectType output = getOutput(outputResource);
- nodeOutputs.add(output);
- }
- }
- return nodeOutputs;
- }
-
- public static List<InputDataObjectType> getApplicationInputs (List<ApplicationInputResource> applicationInputResources){
- List<InputDataObjectType> appInputs = new ArrayList<InputDataObjectType>();
- if (applicationInputResources != null && !applicationInputResources.isEmpty()){
- for (ApplicationInputResource inputResource : applicationInputResources){
- InputDataObjectType appInput = getInput(inputResource);
- appInputs.add(appInput);
- }
- }
- return appInputs;
- }
-
- public static List<OutputDataObjectType> getApplicationOutputs (List<ApplicationOutputResource> outputResources){
- List<OutputDataObjectType> appOutputs = new ArrayList<OutputDataObjectType>();
- if (outputResources != null && !outputResources.isEmpty()){
- for (ApplicationOutputResource outputResource : outputResources){
- OutputDataObjectType output = getOutput(outputResource);
- appOutputs.add(output);
- }
- }
- return appOutputs;
- }
-
- public static ExperimentStatus getExperimentStatus(StatusResource status){
- if (status != null){
- ExperimentStatus experimentStatus = new ExperimentStatus();
- if (status.getState() == null || status.getState().equals("")){
- status.setState("UNKNOWN");
- }
- experimentStatus.setExperimentState(ExperimentState.valueOf(status.getState()));
- experimentStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
- return experimentStatus;
- }
- return null;
- }
-
- public static WorkflowNodeStatus getWorkflowNodeStatus (StatusResource status){
- if (status != null){
- WorkflowNodeStatus workflowNodeStatus = new WorkflowNodeStatus();
- if (status.getState() == null || status.getState().equals("")){
- status.setState("UNKNOWN");
- }
- workflowNodeStatus.setWorkflowNodeState(WorkflowNodeState.valueOf(status.getState()));
- workflowNodeStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
- return workflowNodeStatus;
- }
- return null;
- }
-
- public static TaskStatus getTaskStatus (StatusResource status){
- if (status != null){
- TaskStatus taskStatus = new TaskStatus();
- if (status.getState() == null || status.getState().equals("")){
- status.setState("UNKNOWN");
- }
- taskStatus.setExecutionState(TaskState.valueOf(status.getState()));
- taskStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
- return taskStatus;
- }
- return null;
- }
-
- public static JobStatus getJobStatus (StatusResource status){
- if (status != null){
- JobStatus jobStatus = new JobStatus();
- if (status.getState() == null || status.getState().equals("")){
- status.setState("UNKNOWN");
- }
- jobStatus.setJobState(JobState.valueOf(status.getState()));
- if (status.getStatusUpdateTime() == null){
- jobStatus.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
- }else {
- jobStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
- }
- return jobStatus;
- }
- return null;
- }
-
- public static TransferStatus getTransferStatus (StatusResource status){
- if (status != null){
- TransferStatus transferStatus = new TransferStatus();
- if (status.getState() == null || status.getState().equals("")){
- status.setState("UNKNOWN");
- }
- transferStatus.setTransferState(TransferState.valueOf(status.getState()));
- transferStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
- return transferStatus;
- }
- return null;
- }
-
- public static ApplicationStatus getApplicationStatus (StatusResource status){
- if (status != null){
- ApplicationStatus applicationStatus = new ApplicationStatus();
- if (status.getState() == null || status.getState().equals("")){
- status.setState("UNKNOWN");
- }
- applicationStatus.setApplicationState(status.getState());
- applicationStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
- return applicationStatus;
- }
- return null;
- }
-
- public static List<WorkflowNodeStatus> getWorkflowNodeStatusList(List<StatusResource> statuses){
- List<WorkflowNodeStatus> wfNodeStatuses = new ArrayList<WorkflowNodeStatus>();
- if (statuses != null && !statuses.isEmpty()){
- for (StatusResource statusResource : statuses){
- wfNodeStatuses.add(getWorkflowNodeStatus(statusResource));
- }
- }
- return wfNodeStatuses;
- }
-
- public static WorkflowNodeDetails getWorkflowNodeDetails(WorkflowNodeDetailResource nodeDetailResource) throws RegistryException {
- if (nodeDetailResource != null){
- WorkflowNodeDetails wfNode = new WorkflowNodeDetails();
- wfNode.setNodeInstanceId(nodeDetailResource.getNodeInstanceId());
- wfNode.setCreationTime(nodeDetailResource.getCreationTime().getTime());
- wfNode.setNodeName(nodeDetailResource.getNodeName());
- List<NodeInputResource> nodeInputs = nodeDetailResource.getNodeInputs();
- wfNode.setNodeInputs(getNodeInputs(nodeInputs));
- List<NodeOutputResource> nodeOutputs = nodeDetailResource.getNodeOutputs();
- wfNode.setNodeOutputs(getNodeOutputs(nodeOutputs));
- List<TaskDetailResource> taskDetails = nodeDetailResource.getTaskDetails();
- wfNode.setTaskDetailsList(getTaskDetailsList(taskDetails));
- wfNode.setWorkflowNodeStatus(getWorkflowNodeStatus(nodeDetailResource.getWorkflowNodeStatus()));
- List<ErrorDetailResource> errorDetails = nodeDetailResource.getErrorDetails();
- wfNode.setErrors(getErrorDetailList(errorDetails));
- wfNode.setExecutionUnit(ExecutionUnit.valueOf(nodeDetailResource.getExecutionUnit()));
- wfNode.setExecutionUnitData(nodeDetailResource.getExecutionUnitData());
- return wfNode;
- }
- return null;
- }
-
- public static List<WorkflowNodeDetails> getWfNodeList (List<WorkflowNodeDetailResource> resources) throws RegistryException {
- List<WorkflowNodeDetails> workflowNodeDetailsList = new ArrayList<WorkflowNodeDetails>();
- if (resources != null && !resources.isEmpty()){
- for (WorkflowNodeDetailResource resource : resources){
- workflowNodeDetailsList.add(getWorkflowNodeDetails(resource));
- }
- }
- return workflowNodeDetailsList;
- }
-
- public static TaskDetails getTaskDetail (TaskDetailResource taskDetailResource) throws RegistryException {
- if (taskDetailResource != null){
- TaskDetails taskDetails = new TaskDetails();
- String taskId = taskDetailResource.getTaskId();
- taskDetails.setTaskID(taskId);
- taskDetails.setApplicationId(taskDetailResource.getApplicationId());
- taskDetails.setApplicationVersion(taskDetailResource.getApplicationVersion());
- List<ApplicationInputResource> applicationInputs = taskDetailResource.getApplicationInputs();
- taskDetails.setApplicationInputs(getApplicationInputs(applicationInputs));
- List<ApplicationOutputResource> applicationOutputs = taskDetailResource.getApplicationOutputs();
- taskDetails.setApplicationOutputs(getApplicationOutputs(applicationOutputs));
- taskDetails.setEnableEmailNotification(taskDetailResource.isEnableEmailNotifications());
- if (taskDetails.isEnableEmailNotification()){
- List<NotificationEmailResource> notificationEmails = taskDetailResource.getNotificationEmails();
- taskDetails.setEmailAddresses(getEmailAddresses(notificationEmails));
- }
- taskDetails.setApplicationDeploymentId(taskDetailResource.getApplicationDeploymentId());
- if (taskDetailResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, taskId)){
- ComputationSchedulingResource computationScheduling = taskDetailResource.getComputationScheduling(taskId);
- taskDetails.setTaskScheduling(getComputationalResourceScheduling(computationScheduling));
- }
-
- if (taskDetailResource.isExists(ResourceType.ADVANCE_INPUT_DATA_HANDLING, taskId)){
- AdvanceInputDataHandlingResource inputDataHandling = taskDetailResource.getInputDataHandling(taskId);
- taskDetails.setAdvancedInputDataHandling(getAdvanceInputDataHandling(inputDataHandling));
- }
-
- if (taskDetailResource.isExists(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, taskId)){
- AdvancedOutputDataHandlingResource outputDataHandling = taskDetailResource.getOutputDataHandling(taskId);
- taskDetails.setAdvancedOutputDataHandling(getAdvanceOutputDataHandling(outputDataHandling));
- }
-
- taskDetails.setTaskStatus(getTaskStatus(taskDetailResource.getTaskStatus()));
- List<JobDetailResource> jobDetailList = taskDetailResource.getJobDetailList();
- taskDetails.setJobDetailsList(getJobDetailsList(jobDetailList));
- taskDetails.setErrors(getErrorDetailList(taskDetailResource.getErrorDetailList()));
- taskDetails.setDataTransferDetailsList(getDataTransferlList(taskDetailResource.getDataTransferDetailList()));
- return taskDetails;
- }
- return null;
- }
-
- public static List<TaskDetails> getTaskDetailsList (List<TaskDetailResource> resources) throws RegistryException {
- List<TaskDetails> taskDetailsList = new ArrayList<TaskDetails>();
- if (resources != null && !resources.isEmpty()){
- for (TaskDetailResource resource : resources){
- taskDetailsList.add(getTaskDetail(resource));
- }
- }
- return taskDetailsList;
- }
-
- public static List<JobDetails> getJobDetailsList(List<JobDetailResource> jobs) throws RegistryException {
- List<JobDetails> jobDetailsList = new ArrayList<JobDetails>();
- if (jobs != null && !jobs.isEmpty()){
- for (JobDetailResource resource : jobs){
- jobDetailsList.add(getJobDetail(resource));
- }
- }
- return jobDetailsList;
- }
-
-
- public static JobDetails getJobDetail(JobDetailResource jobDetailResource) throws RegistryException {
- if (jobDetailResource != null){
- JobDetails jobDetails = new JobDetails();
- jobDetails.setJobID(jobDetailResource.getJobId());
- jobDetails.setJobDescription(jobDetailResource.getJobDescription());
- jobDetails.setCreationTime(jobDetailResource.getCreationTime().getTime());
- StatusResource jobStatus = jobDetailResource.getJobStatus();
- jobDetails.setJobStatus(getJobStatus(jobStatus));
- jobDetails.setJobName(jobDetailResource.getJobName());
- jobDetails.setWorkingDir(jobDetailResource.getWorkingDir());
- StatusResource applicationStatus = jobDetailResource.getApplicationStatus();
- jobDetails.setApplicationStatus(getApplicationStatus(applicationStatus));
- List<ErrorDetailResource> errorDetails = jobDetailResource.getErrorDetails();
- jobDetails.setErrors(getErrorDetailList(errorDetails));
- jobDetails.setComputeResourceConsumed(jobDetailResource.getComputeResourceConsumed());
- return jobDetails;
- }
- return null;
- }
-
- public static ErrorDetails getErrorDetails (ErrorDetailResource resource){
- if (resource != null){
- ErrorDetails errorDetails = new ErrorDetails();
- errorDetails.setErrorID(String.valueOf(resource.getErrorId()));
- errorDetails.setCreationTime(resource.getCreationTime().getTime());
- errorDetails.setActualErrorMessage(resource.getActualErrorMsg());
- errorDetails.setUserFriendlyMessage(resource.getUserFriendlyErrorMsg());
- errorDetails.setErrorCategory(ErrorCategory.valueOf(resource.getErrorCategory()));
- errorDetails.setTransientOrPersistent(resource.isTransientPersistent());
- errorDetails.setCorrectiveAction(CorrectiveAction.valueOf(resource.getCorrectiveAction()));
- errorDetails.setActionableGroup(ActionableGroup.valueOf(resource.getActionableGroup()));
- return errorDetails;
- }
- return null;
- }
-
- public static List<ErrorDetails> getErrorDetailList (List<ErrorDetailResource> errorDetailResources){
- List<ErrorDetails> errorDetailsList = new ArrayList<ErrorDetails>();
- if (errorDetailResources != null && !errorDetailResources.isEmpty()){
- for (ErrorDetailResource errorDetailResource : errorDetailResources){
- errorDetailsList.add(getErrorDetails(errorDetailResource));
- }
- }
- return errorDetailsList;
- }
-
- public static DataTransferDetails getDataTransferDetail (DataTransferDetailResource resource) throws RegistryException {
- if (resource != null){
- DataTransferDetails details = new DataTransferDetails();
- details.setTransferID(resource.getTransferId());
- details.setCreationTime(resource.getCreationTime().getTime());
- details.setTransferDescription(resource.getTransferDescription());
- details.setTransferStatus(getTransferStatus(resource.getDataTransferStatus()));
- return details;
- }
- return null;
- }
-
- public static List<DataTransferDetails> getDataTransferlList (List<DataTransferDetailResource> resources) throws RegistryException {
- List<DataTransferDetails> transferDetailsList = new ArrayList<DataTransferDetails>();
- if (resources != null && !resources.isEmpty()){
- for (DataTransferDetailResource resource : resources){
- transferDetailsList.add(getDataTransferDetail(resource));
- }
- }
- return transferDetailsList;
- }
-
-
- public static UserConfigurationData getUserConfigData (ConfigDataResource resource) throws RegistryException {
- if (resource != null){
- UserConfigurationData data = new UserConfigurationData();
- data.setAiravataAutoSchedule(resource.isAiravataAutoSchedule());
- data.setOverrideManualScheduledParams(resource.isOverrideManualParams());
- data.setShareExperimentPublicly(resource.isShareExp());
- data.setUserDN(resource.getUserDn());
- data.setGenerateCert(resource.isGenerateCert());
- String expID = resource.getExperimentId();
- ExperimentResource experimentResource = new ExperimentResource();
- experimentResource.setExpID(expID);
- if (experimentResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, expID)){
- ComputationSchedulingResource computationScheduling = experimentResource.getComputationScheduling(expID);
- data.setComputationalResourceScheduling(getComputationalResourceScheduling(computationScheduling));
- }
-
- if (experimentResource.isExists(ResourceType.ADVANCE_INPUT_DATA_HANDLING, expID)){
- AdvanceInputDataHandlingResource inputDataHandling = experimentResource.getInputDataHandling(expID);
- data.setAdvanceInputDataHandling(getAdvanceInputDataHandling(inputDataHandling));
- }
-
- if (experimentResource.isExists(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, expID)){
- AdvancedOutputDataHandlingResource outputDataHandling = experimentResource.getOutputDataHandling(expID);
- data.setAdvanceOutputDataHandling(getAdvanceOutputDataHandling(outputDataHandling));
- }
-
- if (experimentResource.isExists(ResourceType.QOS_PARAM, expID)){
- QosParamResource qoSparams = experimentResource.getQOSparams(expID);
- data.setQosParams(getQOSParams(qoSparams));
- }
- return data;
- }
- return null;
- }
-
-
- public static ComputationalResourceScheduling getComputationalResourceScheduling (ComputationSchedulingResource csr){
- if (csr != null){
- ComputationalResourceScheduling scheduling = new ComputationalResourceScheduling();
- scheduling.setResourceHostId(csr.getResourceHostId());
- scheduling.setTotalCPUCount(csr.getCpuCount());
- scheduling.setNodeCount(csr.getNodeCount());
- scheduling.setNumberOfThreads(csr.getNumberOfThreads());
- scheduling.setQueueName(csr.getQueueName());
- scheduling.setWallTimeLimit(csr.getWalltimeLimit());
- scheduling.setJobStartTime((int)csr.getJobStartTime().getTime());
- scheduling.setTotalPhysicalMemory(csr.getPhysicalMemory());
- scheduling.setComputationalProjectAccount(csr.getProjectName());
- scheduling.setChassisName(csr.getChessisName());
- return scheduling;
- }
- return null;
- }
-
- public static AdvancedInputDataHandling getAdvanceInputDataHandling(AdvanceInputDataHandlingResource adhr){
- if (adhr != null){
- AdvancedInputDataHandling adih = new AdvancedInputDataHandling();
- adih.setStageInputFilesToWorkingDir(adhr.isStageInputFiles());
- adih.setParentWorkingDirectory(adhr.getWorkingDirParent());
- adih.setUniqueWorkingDirectory(adhr.getWorkingDir());
- adih.setCleanUpWorkingDirAfterJob(adhr.isCleanAfterJob());
- return adih;
- }
- return null;
- }
-
- public static AdvancedOutputDataHandling getAdvanceOutputDataHandling(AdvancedOutputDataHandlingResource adodh){
- if (adodh != null){
- AdvancedOutputDataHandling outputDataHandling = new AdvancedOutputDataHandling();
- outputDataHandling.setOutputDataDir(adodh.getOutputDataDir());
- outputDataHandling.setDataRegistryURL(adodh.getDataRegUrl());
- outputDataHandling.setPersistOutputData(adodh.isPersistOutputData());
- return outputDataHandling;
- }
- return null;
- }
-
- public static QualityOfServiceParams getQOSParams (QosParamResource qos){
- if (qos != null){
- QualityOfServiceParams qosParams = new QualityOfServiceParams();
- qosParams.setStartExecutionAt(qos.getStartExecutionAt());
- qosParams.setExecuteBefore(qos.getExecuteBefore());
- qosParams.setNumberofRetries(qos.getNoOfRetries());
- return qosParams;
- }
- return null;
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml b/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
deleted file mode 100644
index 9055d3d..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0"?>
-<!--*
- *
- * 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.
- *
-* -->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
- <persistence-unit name="airavata_data">
- <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
- <class>org.apache.airavata.persistance.registry.jpa.model.Gateway</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.Configuration</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.Users</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.Gateway_Worker</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.Project</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.ProjectUser</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.Experiment</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.Notification_Email</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.Experiment_Input</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.Experiment_Output</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.WorkflowNodeDetail</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.TaskDetail</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.ErrorDetail</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.ApplicationInput</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.ApplicationOutput</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.NodeInput</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.NodeOutput</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.JobDetail</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.DataTransferDetail</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.Status</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.ExperimentConfigData</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.Computational_Resource_Scheduling</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.AdvancedInputDataHandling</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.AdvancedOutputDataHandling</class>
- <class>org.apache.airavata.persistance.registry.jpa.model.QosParam</class>
- <exclude-unlisted-classes>true</exclude-unlisted-classes>
- <!--properties>
- <property name="openjpa.ConnectionURL"
- value="jdbc:mysql://localhost:3306/persitant_data" />
- <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" />
- <property name="openjpa.ConnectionUserName" value="airavata" />
- <property name="openjpa.ConnectionPassword" value="airavata" />
- <property name="openjpa.DynamicEnhancementAgent" value="true" />
- <property name="openjpa.RuntimeUnenhancedClasses" value="supported" />
- <property name="openjpa.Log" value="SQL=TRACE" />
- <property name="openjpa.ConnectionFactoryProperties"
- value="PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=60000" />
- </properties-->
- </persistence-unit>
-</persistence>
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql b/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql
deleted file mode 100644
index 7ab3755..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- *
- * 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.
- *
- */
-CREATE TABLE GATEWAY
-(
- GATEWAY_ID VARCHAR (255),
- GATEWAY_NAME VARCHAR(255),
- DOMAIN VARCHAR(255),
- EMAIL_ADDRESS VARCHAR(255),
- PRIMARY KEY (GATEWAY_ID)
-);
-
-CREATE TABLE CONFIGURATION
-(
- CONFIG_KEY VARCHAR(255),
- CONFIG_VAL VARCHAR(255),
- EXPIRE_DATE TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- CATEGORY_ID VARCHAR (255),
- PRIMARY KEY(CONFIG_KEY, CONFIG_VAL, CATEGORY_ID)
-);
-
-INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL, EXPIRE_DATE, CATEGORY_ID) VALUES('registry.version', '0.15', CURRENT_TIMESTAMP ,'SYSTEM');
-
-CREATE TABLE USERS
-(
- USER_NAME VARCHAR(255),
- PASSWORD VARCHAR(255),
- PRIMARY KEY(USER_NAME)
-);
-
-CREATE TABLE GATEWAY_WORKER
-(
- GATEWAY_ID VARCHAR(255),
- USER_NAME VARCHAR(255),
- PRIMARY KEY (GATEWAY_ID, USER_NAME),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE PROJECT
-(
- GATEWAY_ID VARCHAR(255),
- USER_NAME VARCHAR(255) NOT NULL,
- PROJECT_ID VARCHAR(255),
- PROJECT_NAME VARCHAR(255) NOT NULL,
- DESCRIPTION VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (PROJECT_ID),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE PROJECT_USER
-(
- PROJECT_ID VARCHAR(255),
- USER_NAME VARCHAR(255),
- PRIMARY KEY (PROJECT_ID,USER_NAME),
- FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT
-(
- EXPERIMENT_ID VARCHAR(255),
- GATEWAY_ID VARCHAR(255),
- EXECUTION_USER VARCHAR(255) NOT NULL,
- PROJECT_ID VARCHAR(255) NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- EXPERIMENT_NAME VARCHAR(255) NOT NULL,
- EXPERIMENT_DESCRIPTION VARCHAR(255),
- APPLICATION_ID VARCHAR(255),
- APPLICATION_VERSION VARCHAR(255),
- WORKFLOW_TEMPLATE_ID VARCHAR(255),
- WORKFLOW_TEMPLATE_VERSION VARCHAR(255),
- WORKFLOW_EXECUTION_ID VARCHAR(255),
- ALLOW_NOTIFICATION SMALLINT,
- GATEWAY_EXECUTION_ID VARCHAR(255),
- PRIMARY KEY(EXPERIMENT_ID),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (EXECUTION_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE,
- FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT_INPUT
-(
- EXPERIMENT_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- VALUE CLOB,
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(EXPERIMENT_ID,INPUT_KEY),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT_OUTPUT
-(
- EXPERIMENT_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE CLOB,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(EXPERIMENT_ID,OUTPUT_KEY),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-
-CREATE TABLE WORKFLOW_NODE_DETAIL
-(
- EXPERIMENT_ID VARCHAR(255) NOT NULL,
- NODE_INSTANCE_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- NODE_NAME VARCHAR(255) NOT NULL,
- EXECUTION_UNIT VARCHAR(255) NOT NULL,
- EXECUTION_UNIT_DATA VARCHAR(255),
- PRIMARY KEY(NODE_INSTANCE_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE TASK_DETAIL
-(
- TASK_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- APPLICATION_ID VARCHAR(255),
- APPLICATION_VERSION VARCHAR(255),
- APPLICATION_DEPLOYMENT_ID VARCHAR(255),
- ALLOW_NOTIFICATION SMALLINT,
- PRIMARY KEY(TASK_ID),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NOTIFICATION_EMAIL
-(
- EMAIL_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- EMAIL_ADDRESS VARCHAR(255),
- PRIMARY KEY(EMAIL_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ERROR_DETAIL
-(
- ERROR_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- JOB_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- ACTUAL_ERROR_MESSAGE CLOB,
- USER_FRIEDNLY_ERROR_MSG VARCHAR(255),
- TRANSIENT_OR_PERSISTENT SMALLINT,
- ERROR_CATEGORY VARCHAR(255),
- CORRECTIVE_ACTION VARCHAR(255),
- ACTIONABLE_GROUP VARCHAR(255),
- PRIMARY KEY(ERROR_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_INPUT
-(
- TASK_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- VALUE CLOB,
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(TASK_ID,INPUT_KEY),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_OUTPUT
-(
- TASK_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE CLOB,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(TASK_ID,OUTPUT_KEY),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NODE_INPUT
-(
- NODE_INSTANCE_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- METADATA VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- VALUE VARCHAR(255),
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(NODE_INSTANCE_ID,INPUT_KEY),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NODE_OUTPUT
-(
- NODE_INSTANCE_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE VARCHAR(255),
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(NODE_INSTANCE_ID,OUTPUT_KEY),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE JOB_DETAIL
-(
- JOB_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- JOB_DESCRIPTION CLOB NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- COMPUTE_RESOURCE_CONSUMED VARCHAR(255),
- JOBNAME VARCHAR (255),
- WORKING_DIR VARCHAR(255),
- PRIMARY KEY (TASK_ID, JOB_ID),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE DATA_TRANSFER_DETAIL
-(
- TRANSFER_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- TRANSFER_DESC VARCHAR(255) NOT NULL,
- PRIMARY KEY(TRANSFER_ID),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE STATUS
-(
- STATUS_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- TRANSFER_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- JOB_ID VARCHAR(255),
- STATE VARCHAR(255),
- STATUS_UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- STATUS_TYPE VARCHAR(255),
- PRIMARY KEY(STATUS_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE,
- FOREIGN KEY (TRANSFER_ID) REFERENCES DATA_TRANSFER_DETAIL(TRANSFER_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE CONFIG_DATA
-(
- EXPERIMENT_ID VARCHAR(255),
- AIRAVATA_AUTO_SCHEDULE SMALLINT NOT NULL,
- OVERRIDE_MANUAL_SCHEDULE_PARAMS SMALLINT NOT NULL,
- SHARE_EXPERIMENT SMALLINT,
- USER_DN VARCHAR(255),
- GENERATE_CERT SMALLINT,
- PRIMARY KEY(EXPERIMENT_ID)
-);
-
-CREATE TABLE COMPUTATIONAL_RESOURCE_SCHEDULING
-(
- RESOURCE_SCHEDULING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- RESOURCE_HOST_ID VARCHAR(255),
- CPU_COUNT INTEGER,
- NODE_COUNT INTEGER,
- NO_OF_THREADS INTEGER,
- QUEUE_NAME VARCHAR(255),
- WALLTIME_LIMIT INTEGER,
- JOB_START_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- TOTAL_PHYSICAL_MEMORY INTEGER,
- COMPUTATIONAL_PROJECT_ACCOUNT VARCHAR(255),
- CHESSIS_NAME VARCHAR(255),
- PRIMARY KEY(RESOURCE_SCHEDULING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ADVANCE_INPUT_DATA_HANDLING
-(
- INPUT_DATA_HANDLING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- WORKING_DIR_PARENT VARCHAR(255),
- UNIQUE_WORKING_DIR VARCHAR(255),
- STAGE_INPUT_FILES_TO_WORKING_DIR SMALLINT,
- CLEAN_AFTER_JOB SMALLINT,
- PRIMARY KEY(INPUT_DATA_HANDLING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ADVANCE_OUTPUT_DATA_HANDLING
-(
- OUTPUT_DATA_HANDLING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- OUTPUT_DATA_DIR VARCHAR(255),
- DATA_REG_URL VARCHAR (255),
- PERSIST_OUTPUT_DATA SMALLINT,
- PRIMARY KEY(OUTPUT_DATA_HANDLING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE QOS_PARAM
-(
- QOS_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- START_EXECUTION_AT VARCHAR(255),
- EXECUTE_BEFORE VARCHAR(255),
- NO_OF_RETRIES INTEGER,
- PRIMARY KEY(QOS_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE COMMUNITY_USER
-(
- GATEWAY_ID VARCHAR(256) NOT NULL,
- COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
- TOKEN_ID VARCHAR(256) NOT NULL,
- COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
- PRIMARY KEY (GATEWAY_ID, COMMUNITY_USER_NAME, TOKEN_ID)
-);
-
-CREATE TABLE CREDENTIALS
-(
- GATEWAY_ID VARCHAR(256) NOT NULL,
- TOKEN_ID VARCHAR(256) NOT NULL,
- CREDENTIAL BLOB NOT NULL,
- PORTAL_USER_ID VARCHAR(256) NOT NULL,
- TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
-);
-
-
[25/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
rename airavata-jpa-registry module to experiment-catalog
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/22bcbb40
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/22bcbb40
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/22bcbb40
Branch: refs/heads/master
Commit: 22bcbb40ccdd7b11cb31fd28050ea772c057a46a
Parents: 6a6657a
Author: Chathuri Wimalasena <ch...@apache.org>
Authored: Tue Jun 2 16:40:44 2015 -0400
Committer: Chathuri Wimalasena <ch...@apache.org>
Committed: Tue Jun 2 16:40:44 2015 -0400
----------------------------------------------------------------------
airavata-api/airavata-api-server/pom.xml | 2 +-
.../server/handler/AiravataServerHandler.java | 4 +-
.../api/server/util/AppCatalogInitUtil.java | 6 -
.../api/server/util/RegistryInitUtil.java | 12 +-
.../client/samples/CreateLaunchExperiment.java | 4 +-
.../main/resources/airavata-client.properties | 14 +-
modules/distribution/server/pom.xml | 2 +-
modules/gfac/airavata-gfac-service/pom.xml | 2 +-
.../airavata/gfac/server/GfacServerHandler.java | 2 +-
.../gfac/client/GfacClientFactoryTest.java | 11 -
.../airavata/gfac/client/util/Initialize.java | 5 +-
modules/gfac/gfac-core/pom.xml | 2 +-
.../gfac/core/handler/AbstractHandler.java | 3 +-
.../gfac/core/provider/AbstractProvider.java | 4 +-
.../airavata/gfac/core/utils/GFacUtils.java | 2 +-
.../impl/GSISSHProviderTestWithMyProxyAuth.java | 2 +-
.../gfac/services/impl/LocalProviderTest.java | 2 +-
.../gfac/gfac-monitor/gfac-hpc-monitor/pom.xml | 2 +-
.../services/impl/BigRed2TestWithSSHAuth.java | 2 +-
modules/integration-tests/pom.xml | 2 +-
.../server/OrchestratorServerHandler.java | 2 +-
.../client/OrchestratorClientFactoryTest.java | 13 -
.../orchestrator/client/util/Initialize.java | 5 +-
modules/orchestrator/orchestrator-core/pom.xml | 2 +-
.../validator/impl/BatchQueueValidator.java | 2 +-
.../cpi/impl/AbstractOrchestrator.java | 2 +-
.../core/OrchestratorTestWithGRAM.java | 15 -
.../core/OrchestratorTestWithMyProxyAuth.java | 16 -
.../orchestrator/core/ValidatorTest.java | 2 +-
.../orchestrator/core/util/Initialize.java | 5 +-
modules/registry/airavata-jpa-registry/pom.xml | 151 -
.../persistance/registry/jpa/JPAConstants.java | 33 -
.../persistance/registry/jpa/Resource.java | 71 -
.../persistance/registry/jpa/ResourceType.java | 50 -
.../persistance/registry/jpa/ResourceUtils.java | 525 ---
.../registry/jpa/impl/ExperimentRegistry.java | 2983 ------------------
.../registry/jpa/impl/GatewayRegistry.java | 115 -
.../registry/jpa/impl/LoggingRegistryImpl.java | 97 -
.../registry/jpa/impl/ProjectRegistry.java | 303 --
.../registry/jpa/impl/RegistryFactory.java | 80 -
.../registry/jpa/impl/RegistryImpl.java | 735 -----
.../persistance/registry/jpa/impl/UserReg.java | 42 -
.../jpa/model/AdvancedInputDataHandling.java | 113 -
.../jpa/model/AdvancedOutputDataHandling.java | 104 -
.../registry/jpa/model/ApplicationInput.java | 165 -
.../registry/jpa/model/ApplicationInput_PK.java | 65 -
.../registry/jpa/model/ApplicationOutput.java | 142 -
.../jpa/model/ApplicationOutput_PK.java | 64 -
.../Computational_Resource_Scheduling.java | 174 -
.../registry/jpa/model/Configuration.java | 80 -
.../registry/jpa/model/Configuration_PK.java | 74 -
.../registry/jpa/model/DataTransferDetail.java | 92 -
.../registry/jpa/model/ErrorDetail.java | 176 --
.../registry/jpa/model/Experiment.java | 300 --
.../jpa/model/ExperimentConfigData.java | 143 -
.../registry/jpa/model/Experiment_Input.java | 170 -
.../registry/jpa/model/Experiment_Input_PK.java | 64 -
.../registry/jpa/model/Experiment_Output.java | 143 -
.../jpa/model/Experiment_Output_PK.java | 64 -
.../persistance/registry/jpa/model/Gateway.java | 76 -
.../registry/jpa/model/Gateway_Worker.java | 82 -
.../registry/jpa/model/Gateway_Worker_PK.java | 64 -
.../registry/jpa/model/JobDetail.java | 136 -
.../registry/jpa/model/JobDetails_PK.java | 64 -
.../registry/jpa/model/NodeInput.java | 163 -
.../registry/jpa/model/NodeInput_PK.java | 64 -
.../registry/jpa/model/NodeOutput.java | 140 -
.../registry/jpa/model/NodeOutput_PK.java | 64 -
.../registry/jpa/model/Notification_Email.java | 81 -
.../persistance/registry/jpa/model/Project.java | 125 -
.../registry/jpa/model/ProjectUser.java | 81 -
.../registry/jpa/model/ProjectUser_PK.java | 64 -
.../registry/jpa/model/QosParam.java | 103 -
.../persistance/registry/jpa/model/Status.java | 146 -
.../registry/jpa/model/TaskDetail.java | 223 --
.../persistance/registry/jpa/model/Users.java | 55 -
.../registry/jpa/model/WorkflowNodeDetail.java | 157 -
.../jpa/resources/AbstractResource.java | 317 --
.../AdvanceInputDataHandlingResource.java | 162 -
.../AdvancedOutputDataHandlingResource.java | 152 -
.../jpa/resources/ApplicationInputResource.java | 231 --
.../resources/ApplicationOutputResource.java | 209 --
.../ComputationSchedulingResource.java | 223 --
.../jpa/resources/ConfigDataResource.java | 195 --
.../jpa/resources/ConfigurationResource.java | 208 --
.../resources/DataTransferDetailResource.java | 276 --
.../jpa/resources/ErrorDetailResource.java | 218 --
.../jpa/resources/ExperimentInputResource.java | 226 --
.../jpa/resources/ExperimentOutputResource.java | 205 --
.../jpa/resources/ExperimentResource.java | 831 -----
.../resources/ExperimentSummaryResource.java | 134 -
.../registry/jpa/resources/GatewayResource.java | 437 ---
.../jpa/resources/JobDetailResource.java | 376 ---
.../jpa/resources/NodeInputResource.java | 228 --
.../jpa/resources/NodeOutputResource.java | 208 --
.../resources/NotificationEmailResource.java | 119 -
.../registry/jpa/resources/ProjectResource.java | 508 ---
.../jpa/resources/ProjectUserResource.java | 123 -
.../jpa/resources/QosParamResource.java | 146 -
.../registry/jpa/resources/StatusResource.java | 181 --
.../jpa/resources/TaskDetailResource.java | 748 -----
.../registry/jpa/resources/UserResource.java | 186 --
.../registry/jpa/resources/Utils.java | 1014 ------
.../registry/jpa/resources/WorkerResource.java | 727 -----
.../resources/WorkflowNodeDetailResource.java | 515 ---
.../registry/jpa/utils/QueryGenerator.java | 128 -
.../jpa/utils/ThriftDataModelConversion.java | 686 ----
.../src/main/resources/META-INF/persistence.xml | 65 -
.../src/main/resources/registry-derby.sql | 391 ---
.../src/main/resources/registry-mysql.sql | 392 ---
.../registry/jpa/AbstractResourceTest.java | 91 -
.../jpa/ComputationalSchedulingTest.java | 84 -
.../registry/jpa/ConfigurationResourceTest.java | 58 -
.../jpa/ExecutionErrorResourceTest.java | 95 -
.../jpa/ExperimentDataResourceTest.java | 107 -
.../jpa/ExperimentInputResourceTest.java | 75 -
.../jpa/ExperimentMetadataResourceTest.java | 87 -
.../jpa/ExperimentOutputResourceTest.java | 76 -
.../registry/jpa/ExperimentResourceTest.java | 78 -
.../registry/jpa/GFacJobDataResourceTest.java | 77 -
.../registry/jpa/GFacJobStatusResourceTest.java | 87 -
.../registry/jpa/GatewayResourceTest.java | 120 -
.../registry/jpa/GramDataResourceTest.java | 72 -
.../registry/jpa/NodeDataResourceTest.java | 72 -
.../jpa/OrchestratorDataResourceTest.java | 69 -
.../registry/jpa/RegistryUseCaseTest.java | 296 --
.../registry/jpa/TaskDetailResourceTest.java | 93 -
.../registry/jpa/UserResourceTest.java | 54 -
.../registry/jpa/WorkerResourceTest.java | 122 -
.../registry/jpa/WorkflowDataResourceTest.java | 106 -
.../jpa/WorkflowNodeDetailResourceTest.java | 85 -
.../registry/jpa/util/Initialize.java | 334 --
.../airavata/provenance/test/JpaTest.java | 151 -
.../src/test/resources/registry-derby.sql | 391 ---
modules/registry/experiment-catalog/pom.xml | 151 +
.../experiment/catalog/JPAConstants.java | 33 +
.../airavata/experiment/catalog/Resource.java | 71 +
.../experiment/catalog/ResourceType.java | 50 +
.../experiment/catalog/ResourceUtils.java | 525 +++
.../catalog/impl/ExperimentRegistry.java | 2983 ++++++++++++++++++
.../catalog/impl/GatewayRegistry.java | 115 +
.../catalog/impl/LoggingRegistryImpl.java | 97 +
.../catalog/impl/ProjectRegistry.java | 303 ++
.../catalog/impl/RegistryFactory.java | 80 +
.../experiment/catalog/impl/RegistryImpl.java | 735 +++++
.../experiment/catalog/impl/UserReg.java | 41 +
.../model/AdvancedInputDataHandling.java | 113 +
.../model/AdvancedOutputDataHandling.java | 104 +
.../catalog/model/ApplicationInput.java | 165 +
.../catalog/model/ApplicationInput_PK.java | 65 +
.../catalog/model/ApplicationOutput.java | 142 +
.../catalog/model/ApplicationOutput_PK.java | 64 +
.../Computational_Resource_Scheduling.java | 174 +
.../experiment/catalog/model/Configuration.java | 80 +
.../catalog/model/Configuration_PK.java | 74 +
.../catalog/model/DataTransferDetail.java | 91 +
.../experiment/catalog/model/ErrorDetail.java | 176 ++
.../experiment/catalog/model/Experiment.java | 299 ++
.../catalog/model/ExperimentConfigData.java | 142 +
.../catalog/model/Experiment_Input.java | 170 +
.../catalog/model/Experiment_Input_PK.java | 64 +
.../catalog/model/Experiment_Output.java | 143 +
.../catalog/model/Experiment_Output_PK.java | 64 +
.../experiment/catalog/model/Gateway.java | 76 +
.../catalog/model/Gateway_Worker.java | 82 +
.../catalog/model/Gateway_Worker_PK.java | 64 +
.../experiment/catalog/model/JobDetail.java | 135 +
.../experiment/catalog/model/JobDetails_PK.java | 64 +
.../experiment/catalog/model/NodeInput.java | 163 +
.../experiment/catalog/model/NodeInput_PK.java | 64 +
.../experiment/catalog/model/NodeOutput.java | 140 +
.../experiment/catalog/model/NodeOutput_PK.java | 64 +
.../catalog/model/Notification_Email.java | 81 +
.../experiment/catalog/model/Project.java | 125 +
.../experiment/catalog/model/ProjectUser.java | 81 +
.../catalog/model/ProjectUser_PK.java | 64 +
.../experiment/catalog/model/QosParam.java | 103 +
.../experiment/catalog/model/Status.java | 146 +
.../experiment/catalog/model/TaskDetail.java | 221 ++
.../experiment/catalog/model/Users.java | 55 +
.../catalog/model/WorkflowNodeDetail.java | 155 +
.../catalog/resources/AbstractResource.java | 317 ++
.../AdvanceInputDataHandlingResource.java | 160 +
.../AdvancedOutputDataHandlingResource.java | 150 +
.../resources/ApplicationInputResource.java | 230 ++
.../resources/ApplicationOutputResource.java | 208 ++
.../ComputationSchedulingResource.java | 221 ++
.../catalog/resources/ConfigDataResource.java | 194 ++
.../resources/ConfigurationResource.java | 204 ++
.../resources/DataTransferDetailResource.java | 276 ++
.../catalog/resources/ErrorDetailResource.java | 215 ++
.../resources/ExperimentInputResource.java | 225 ++
.../resources/ExperimentOutputResource.java | 204 ++
.../catalog/resources/ExperimentResource.java | 831 +++++
.../resources/ExperimentSummaryResource.java | 134 +
.../catalog/resources/GatewayResource.java | 437 +++
.../catalog/resources/JobDetailResource.java | 376 +++
.../catalog/resources/NodeInputResource.java | 227 ++
.../catalog/resources/NodeOutputResource.java | 207 ++
.../resources/NotificationEmailResource.java | 119 +
.../catalog/resources/ProjectResource.java | 508 +++
.../catalog/resources/ProjectUserResource.java | 123 +
.../catalog/resources/QosParamResource.java | 144 +
.../catalog/resources/StatusResource.java | 181 ++
.../catalog/resources/TaskDetailResource.java | 748 +++++
.../catalog/resources/UserResource.java | 186 ++
.../experiment/catalog/resources/Utils.java | 1011 ++++++
.../catalog/resources/WorkerResource.java | 727 +++++
.../resources/WorkflowNodeDetailResource.java | 515 +++
.../catalog/utils/QueryGenerator.java | 128 +
.../utils/ThriftDataModelConversion.java | 686 ++++
.../src/main/resources/META-INF/persistence.xml | 65 +
.../src/main/resources/registry-derby.sql | 391 +++
.../src/main/resources/registry-mysql.sql | 392 +++
.../catalog/AbstractResourceTest.java | 91 +
.../catalog/ComputationalSchedulingTest.java | 84 +
.../catalog/ConfigurationResourceTest.java | 58 +
.../catalog/ExecutionErrorResourceTest.java | 95 +
.../catalog/ExperimentDataResourceTest.java | 107 +
.../catalog/ExperimentInputResourceTest.java | 75 +
.../catalog/ExperimentMetadataResourceTest.java | 87 +
.../catalog/ExperimentOutputResourceTest.java | 76 +
.../catalog/ExperimentResourceTest.java | 77 +
.../catalog/GFacJobDataResourceTest.java | 77 +
.../catalog/GFacJobStatusResourceTest.java | 87 +
.../experiment/catalog/GatewayResourceTest.java | 120 +
.../catalog/GramDataResourceTest.java | 72 +
.../catalog/NodeDataResourceTest.java | 72 +
.../catalog/OrchestratorDataResourceTest.java | 69 +
.../experiment/catalog/RegistryUseCaseTest.java | 296 ++
.../catalog/TaskDetailResourceTest.java | 93 +
.../experiment/catalog/UserResourceTest.java | 54 +
.../experiment/catalog/WorkerResourceTest.java | 122 +
.../catalog/WorkflowDataResourceTest.java | 106 +
.../catalog/WorkflowNodeDetailResourceTest.java | 85 +
.../experiment/catalog/util/Initialize.java | 333 ++
.../src/test/resources/registry-derby.sql | 391 +++
modules/registry/pom.xml | 2 +-
modules/workflow-model/workflow-engine/pom.xml | 2 +-
.../workflow/engine/WorkflowEngineImpl.java | 2 +-
.../engine/interpretor/WorkflowInterpreter.java | 3 +-
modules/workflow/workflow-core/pom.xml | 2 +-
.../core/SimpleWorkflowInterpreter.java | 2 +-
.../core/parser/AiravataWorkflowParser.java | 2 +-
modules/xbaya-gui/pom.xml | 2 +-
.../dialogs/registry/NewRegistryUserDialog.java | 10 +-
pom.xml | 2 +-
247 files changed, 22719 insertions(+), 22974 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/airavata-api/airavata-api-server/pom.xml
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/pom.xml b/airavata-api/airavata-api-server/pom.xml
index 64b436b..47934e9 100644
--- a/airavata-api/airavata-api-server/pom.xml
+++ b/airavata-api/airavata-api-server/pom.xml
@@ -48,7 +48,7 @@
</dependency>
<dependency>
<groupId>org.apache.airavata</groupId>
- <artifactId>airavata-jpa-registry</artifactId>
+ <artifactId>airavata-experiment-catalog</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 05ac575..7953c1a 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -56,8 +56,8 @@ import org.apache.airavata.model.workspace.experiment.*;
import org.apache.airavata.orchestrator.client.OrchestratorClientFactory;
import org.apache.airavata.orchestrator.cpi.OrchestratorService;
import org.apache.airavata.orchestrator.cpi.OrchestratorService.Client;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.*;
import org.apache.airavata.registry.cpi.utils.Constants;
import org.apache.thrift.TException;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/AppCatalogInitUtil.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/AppCatalogInitUtil.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/AppCatalogInitUtil.java
index 870898b..d0fb5cd 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/AppCatalogInitUtil.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/AppCatalogInitUtil.java
@@ -23,12 +23,6 @@ package org.apache.airavata.api.server.util;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-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.UserResource;
-import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
import org.apache.derby.drda.NetworkServerControl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java
index da6f87b..d7c100b 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/RegistryInitUtil.java
@@ -29,12 +29,12 @@ import java.sql.SQLException;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-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.UserResource;
-import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.resources.GatewayResource;
+import org.apache.airavata.experiment.catalog.resources.ProjectResource;
+import org.apache.airavata.experiment.catalog.resources.UserResource;
+import org.apache.airavata.experiment.catalog.resources.WorkerResource;
import org.apache.derby.drda.NetworkServerControl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
index 4ee1724..1597ced 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
@@ -81,8 +81,8 @@ public class CreateLaunchExperiment {
public static void main(String[] args) throws Exception {
airavataClient = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT);
System.out.println("API version is " + airavataClient.getAPIVersion(null));
-// registerApplications(); // run this only the first time
- createAndLaunchExp();
+ registerApplications(); // run this only the first time
+// createAndLaunchExp();
}
private static String fsdResourceId;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/configuration/client/src/main/resources/airavata-client.properties
----------------------------------------------------------------------
diff --git a/modules/configuration/client/src/main/resources/airavata-client.properties b/modules/configuration/client/src/main/resources/airavata-client.properties
index 70f2bae..14d37c7 100644
--- a/modules/configuration/client/src/main/resources/airavata-client.properties
+++ b/modules/configuration/client/src/main/resources/airavata-client.properties
@@ -27,7 +27,7 @@
###---------------------------REGISTRY API IMPLEMENTATION---------------------------###
-#class.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.registry.accessor=org.apache.airavata.experimentregistry.impl.AiravataJPARegistry
#class.registry.accessor=org.apache.airavata.rest.client.RegistryClient
###---------------------REGISTRY API IMPLEMENTATION - CUSTOM SETTINGS----------------------###
@@ -67,12 +67,12 @@ appcatalog.jdbc.password=airavata
appcatalog.validationQuery=SELECT 1 from COMPUTE_RESOURCE
#user defined registry accessor classes
-#class.provenance.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
-#class.configuration.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
-#class.descriptor.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
-#class.project.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
-#class.user.workflow.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
-#class.published.workflow.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.provenance.registry.accessor=org.apache.airavata.experimentregistry.jpa.impl.AiravataJPARegistry
+#class.configuration.registry.accessor=org.apache.airavata.experimentregistry.jpa.impl.AiravataJPARegistry
+#class.descriptor.registry.accessor=org.apache.airavata.experimentregistry.jpa.impl.AiravataJPARegistry
+#class.project.registry.accessor=org.apache.airavata.experimentregistry.jpa.impl.AiravataJPARegistry
+#class.user.workflow.registry.accessor=org.apache.airavata.experimentregistry.jpa.impl.AiravataJPARegistry
+#class.published.workflow.registry.accessor=org.apache.airavata.experimentregistry.jpa.impl.AiravataJPARegistry
########################Registry Rest Implementation Settings########################
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/distribution/server/pom.xml
----------------------------------------------------------------------
diff --git a/modules/distribution/server/pom.xml b/modules/distribution/server/pom.xml
index 4aa09f8..8d645df 100644
--- a/modules/distribution/server/pom.xml
+++ b/modules/distribution/server/pom.xml
@@ -283,7 +283,7 @@
</dependency>
<dependency>
<groupId>org.apache.airavata</groupId>
- <artifactId>airavata-jpa-registry</artifactId>
+ <artifactId>airavata-experiment-catalog</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/gfac/airavata-gfac-service/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/pom.xml b/modules/gfac/airavata-gfac-service/pom.xml
index 224537f..3cb4556 100644
--- a/modules/gfac/airavata-gfac-service/pom.xml
+++ b/modules/gfac/airavata-gfac-service/pom.xml
@@ -52,7 +52,7 @@
</dependency>
<dependency>
<groupId>org.apache.airavata</groupId>
- <artifactId>airavata-jpa-registry</artifactId>
+ <artifactId>airavata-experiment-catalog</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
index 961e46d..936b694 100644
--- a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
+++ b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
@@ -56,7 +56,7 @@ import org.apache.airavata.model.messaging.event.TaskSubmitEvent;
import org.apache.airavata.model.messaging.event.TaskTerminateEvent;
import org.apache.airavata.model.workspace.experiment.ExperimentState;
import org.apache.airavata.model.workspace.experiment.ExperimentStatus;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.Registry;
import org.apache.airavata.registry.cpi.RegistryException;
import org.apache.airavata.registry.cpi.RegistryModelType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/GfacClientFactoryTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/GfacClientFactoryTest.java b/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/GfacClientFactoryTest.java
index 21c137f..2cf5aad 100644
--- a/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/GfacClientFactoryTest.java
+++ b/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/GfacClientFactoryTest.java
@@ -25,25 +25,14 @@ package org.apache.airavata.gfac.client;
//import org.apache.airavata.client.api.AiravataAPI;
//import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
//import org.apache.airavata.client.tools.DocumentCreator;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.common.utils.AiravataZKUtils;
-import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.gfac.client.util.Initialize;
import org.apache.airavata.gfac.cpi.GfacService;
import org.apache.airavata.gfac.server.GfacServer;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.Registry;
import org.apache.zookeeper.server.ServerCnxnFactory;
-import org.apache.zookeeper.server.ServerConfig;
-import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
-import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.IOException;
-import java.net.URL;
-
public class GfacClientFactoryTest {
private final static Logger logger = LoggerFactory.getLogger(GfacClientFactoryTest.class);
// private DocumentCreator documentCreator;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java b/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java
index 651f414..15d384c 100644
--- a/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java
+++ b/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java
@@ -22,10 +22,9 @@
package org.apache.airavata.gfac.client.util;
import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.resources.*;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.resources.*;
import org.apache.airavata.registry.cpi.RegistryException;
import org.apache.derby.drda.NetworkServerControl;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/gfac/gfac-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/pom.xml b/modules/gfac/gfac-core/pom.xml
index 2169734..037cef6 100644
--- a/modules/gfac/gfac-core/pom.xml
+++ b/modules/gfac/gfac-core/pom.xml
@@ -47,7 +47,7 @@
</dependency>
<dependency>
<groupId>org.apache.airavata</groupId>
- <artifactId>airavata-jpa-registry</artifactId>
+ <artifactId>airavata-experiment-catalog</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Credential Store -->
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java
index ecf826d..9076b94 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java
@@ -22,13 +22,12 @@ package org.apache.airavata.gfac.core.handler;
import org.apache.airavata.common.utils.MonitorPublisher;
import org.apache.airavata.gfac.core.context.JobExecutionContext;
-import org.apache.airavata.gfac.core.cpi.BetterGfacImpl;
import org.apache.airavata.gfac.core.states.GfacHandlerState;
import org.apache.airavata.gfac.core.utils.GFacUtils;
import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
import org.apache.airavata.model.messaging.event.TaskIdentifier;
import org.apache.airavata.model.messaging.event.TaskOutputChangeEvent;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.Registry;
import org.apache.airavata.registry.cpi.RegistryException;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java
index dc4582a..c531cb2 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/provider/AbstractProvider.java
@@ -21,13 +21,11 @@
package org.apache.airavata.gfac.core.provider;
-import org.apache.airavata.common.utils.MonitorPublisher;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.core.context.JobExecutionContext;
-import org.apache.airavata.gfac.core.cpi.BetterGfacImpl;
import org.apache.airavata.model.workspace.experiment.JobDetails;
import org.apache.airavata.model.workspace.experiment.JobStatus;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.Registry;
import org.apache.airavata.registry.cpi.RegistryException;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
index 09724d5..0878c5b 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
@@ -57,7 +57,7 @@ import org.apache.airavata.model.workspace.experiment.JobDetails;
import org.apache.airavata.model.workspace.experiment.JobState;
import org.apache.airavata.model.workspace.experiment.JobStatus;
import org.apache.airavata.model.workspace.experiment.TaskState;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.ChildDataType;
import org.apache.airavata.registry.cpi.CompositeIdentifier;
import org.apache.airavata.registry.cpi.Registry;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/gfac/gfac-gsissh/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java b/modules/gfac/gfac-gsissh/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
index 630cd5c..2c8febe 100644
--- a/modules/gfac/gfac-gsissh/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
+++ b/modules/gfac/gfac-gsissh/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
@@ -49,7 +49,7 @@
//import org.apache.airavata.gsi.ssh.util.CommonUtils;
//import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
//import org.apache.airavata.model.workspace.experiment.TaskDetails;
-//import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+//import org.apache.airavata.experiment.registry.jpa.impl.RegistryFactory;
//import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
//import org.apache.airavata.schemas.gfac.GsisshHostType;
//import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/gfac/gfac-local/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-local/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java b/modules/gfac/gfac-local/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java
index aeb8158..b3974d2 100644
--- a/modules/gfac/gfac-local/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java
+++ b/modules/gfac/gfac-local/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java
@@ -42,7 +42,7 @@
//import org.apache.airavata.model.workspace.experiment.Experiment;
//import org.apache.airavata.model.workspace.experiment.TaskDetails;
//import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
-//import org.apache.airavata.persistance.registry.jpa.impl.LoggingRegistryImpl;
+//import org.apache.airavata.experiment.registry.jpa.impl.LoggingRegistryImpl;
//import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
//import org.apache.airavata.schemas.gfac.InputParameterType;
//import org.apache.airavata.schemas.gfac.OutputParameterType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/gfac/gfac-monitor/gfac-hpc-monitor/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/pom.xml b/modules/gfac/gfac-monitor/gfac-hpc-monitor/pom.xml
index 3a98baa..c051783 100644
--- a/modules/gfac/gfac-monitor/gfac-hpc-monitor/pom.xml
+++ b/modules/gfac/gfac-monitor/gfac-hpc-monitor/pom.xml
@@ -42,7 +42,7 @@
</dependency>
<dependency>
<groupId>org.apache.airavata</groupId>
- <artifactId>airavata-jpa-registry</artifactId>
+ <artifactId>airavata-experiment-catalog</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Workflow Tracking -->
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java b/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
index c65f386..660b4c6 100644
--- a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
+++ b/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
@@ -42,7 +42,7 @@
//import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPublicKeyFileAuthentication;
//import org.apache.airavata.gsi.ssh.util.CommonUtils;
//import org.apache.airavata.model.workspace.experiment.TaskDetails;
-//import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+//import org.apache.airavata.experiment.registry.jpa.impl.RegistryFactory;
//import org.apache.airavata.schemas.gfac.*;
//import org.testng.annotations.BeforeClass;
//import org.testng.annotations.Test;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/modules/integration-tests/pom.xml b/modules/integration-tests/pom.xml
index 770c511..7dc520a 100644
--- a/modules/integration-tests/pom.xml
+++ b/modules/integration-tests/pom.xml
@@ -182,7 +182,7 @@
<dependency>
<groupId>org.apache.airavata</groupId>
- <artifactId>airavata-jpa-registry</artifactId>
+ <artifactId>airavata-experiment-catalog</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
index 4ef9dbc..b858059 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
+++ b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
@@ -67,7 +67,7 @@ import org.apache.airavata.orchestrator.cpi.impl.SimpleOrchestratorImpl;
import org.apache.airavata.orchestrator.cpi.orchestrator_cpi_serviceConstants;
import org.apache.airavata.orchestrator.util.DataModelUtils;
import org.apache.airavata.orchestrator.util.OrchestratorServerThreadPoolExecutor;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.Registry;
import org.apache.airavata.registry.cpi.RegistryException;
import org.apache.airavata.registry.cpi.RegistryModelType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java b/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java
index 18168c7..3902c9d 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java
+++ b/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java
@@ -25,19 +25,6 @@ package org.apache.airavata.orchestrator.client;
//import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
//import org.apache.airavata.client.tools.DocumentCreator;
//import org.apache.airavata.client.tools.DocumentCreatorNew;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.common.utils.AiravataZKUtils;
-import org.apache.airavata.common.utils.Constants;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.model.error.AiravataClientConnectException;
-import org.apache.airavata.orchestrator.client.util.Initialize;
-import org.apache.airavata.orchestrator.cpi.OrchestratorService;
-import org.apache.airavata.orchestrator.server.OrchestratorServer;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.Registry;
-import org.apache.zookeeper.server.ServerCnxnFactory;
-import org.junit.Test;
public class OrchestratorClientFactoryTest {
/* private DocumentCreatorNew documentCreator;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java b/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java
index c827fc4..7fe8ff3 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java
+++ b/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java
@@ -22,10 +22,9 @@
package org.apache.airavata.orchestrator.client.util;
import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.resources.*;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.resources.*;
import org.apache.airavata.registry.cpi.RegistryException;
import org.apache.derby.drda.NetworkServerControl;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/orchestrator/orchestrator-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/pom.xml b/modules/orchestrator/orchestrator-core/pom.xml
index e7984b4..4082f66 100644
--- a/modules/orchestrator/orchestrator-core/pom.xml
+++ b/modules/orchestrator/orchestrator-core/pom.xml
@@ -36,7 +36,7 @@ the License. -->
</dependency>
<dependency>
<groupId>org.apache.airavata</groupId>
- <artifactId>airavata-jpa-registry</artifactId>
+ <artifactId>airavata-experiment-catalog</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/BatchQueueValidator.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/BatchQueueValidator.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/BatchQueueValidator.java
index b72815f..a0d6ce5 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/BatchQueueValidator.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/validator/impl/BatchQueueValidator.java
@@ -29,7 +29,7 @@ import org.apache.airavata.model.error.ValidationResults;
import org.apache.airavata.model.error.ValidatorResult;
import org.apache.airavata.model.workspace.experiment.*;
import org.apache.airavata.orchestrator.core.validator.JobMetadataValidator;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+import org.apache.airavata.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.Registry;
import org.apache.airavata.registry.cpi.RegistryException;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java
index dd3647a..87e862b 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java
@@ -27,7 +27,7 @@ import org.apache.airavata.orchestrator.core.context.OrchestratorContext;
import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
import org.apache.airavata.orchestrator.core.utils.OrchestratorUtils;
import org.apache.airavata.orchestrator.cpi.Orchestrator;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryImpl;
+import org.apache.airavata.experiment.catalog.impl.RegistryImpl;
import org.apache.airavata.registry.cpi.RegistryException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGRAM.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGRAM.java b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGRAM.java
index 7fa678b..d9007ed 100644
--- a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGRAM.java
+++ b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGRAM.java
@@ -20,21 +20,6 @@
*/
package org.apache.airavata.orchestrator.core;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.orchestrator.cpi.Orchestrator;
-import org.apache.airavata.orchestrator.cpi.impl.SimpleOrchestratorImpl;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryImpl;
-import org.apache.airavata.registry.cpi.ChildDataType;
-import org.apache.airavata.registry.cpi.ParentDataType;
-import org.apache.airavata.registry.cpi.Registry;
-import org.junit.Assert;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
-import java.util.*;
-
public class OrchestratorTestWithGRAM extends BaseOrchestratorTest {
// private static final Logger log = LoggerFactory.getLogger(OrchestratorTestWithGRAM.class);
//
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithMyProxyAuth.java b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithMyProxyAuth.java
index c155f9c..9c39b3f 100644
--- a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithMyProxyAuth.java
+++ b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithMyProxyAuth.java
@@ -20,22 +20,6 @@
*/
package org.apache.airavata.orchestrator.core;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.model.util.ExperimentModelUtil;
-import org.apache.airavata.model.workspace.experiment.*;
-import org.apache.airavata.orchestrator.cpi.Orchestrator;
-import org.apache.airavata.orchestrator.cpi.impl.SimpleOrchestratorImpl;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
-import org.apache.airavata.registry.cpi.ParentDataType;
-import org.apache.airavata.registry.cpi.Registry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
public class OrchestratorTestWithMyProxyAuth extends BaseOrchestratorTest {
// private static final Logger log = LoggerFactory.getLogger(NewOrchestratorTest.class);
//
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/ValidatorTest.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/ValidatorTest.java b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/ValidatorTest.java
index dcf1c6e..2b3e935 100644
--- a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/ValidatorTest.java
+++ b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/ValidatorTest.java
@@ -27,7 +27,7 @@
//import org.apache.airavata.orchestrator.core.utils.OrchestratorConstants;
//import org.apache.airavata.orchestrator.cpi.Orchestrator;
//import org.apache.airavata.orchestrator.cpi.impl.SimpleOrchestratorImpl;
-//import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
+//import org.apache.airavata.experiment.registry.jpa.impl.RegistryFactory;
//import org.apache.airavata.registry.cpi.ParentDataType;
//import org.apache.airavata.registry.cpi.Registry;
//import org.junit.Assert;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/Initialize.java b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/Initialize.java
index e6230d8..ff2b0c6 100644
--- a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/Initialize.java
+++ b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/Initialize.java
@@ -22,10 +22,9 @@
package org.apache.airavata.orchestrator.core.util;
import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.resources.*;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.resources.*;
import org.apache.airavata.registry.cpi.RegistryException;
import org.apache.derby.drda.NetworkServerControl;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/pom.xml
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/pom.xml b/modules/registry/airavata-jpa-registry/pom.xml
deleted file mode 100644
index ed6d410..0000000
--- a/modules/registry/airavata-jpa-registry/pom.xml
+++ /dev/null
@@ -1,151 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--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. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.apache.airavata</groupId>
- <artifactId>registry</artifactId>
- <version>0.16-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>airavata-jpa-registry</artifactId>
- <packaging>jar</packaging>
- <name>Airavata JPA Registry</name>
- <url>http://airavata.apache.org/</url>
-
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <!--dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-common-utils</artifactId>
- <version>${project.version}</version>
- </dependency-->
- <!-- Test -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-all</artifactId>
- <version>2.2.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-credential-store</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-data-models</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-registry-cpi</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!--dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>${mysql.connector.version}</version>
- </dependency-->
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>${derby.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbyclient</artifactId>
- <version>${derby.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbynet</artifactId>
- <version>${derby.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbytools</artifactId>
- <version>${derby.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-server-configuration</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>${antrun.version}</version>
- <executions>
- <execution>
- <phase>process-classes</phase>
- <configuration>
- <tasks>
- <taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask" classpathref="maven.compile.classpath" />
- <openjpac>
- <classpath refid="maven.compile.classpath" />
- </openjpac>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>${surefire.version}</version>
- <inherited>true</inherited>
- <configuration>
- <failIfNoTests>false</failIfNoTests>
- <skipTests>${skipTests}</skipTests>
- <workingDirectory>${project.build.testOutputDirectory}</workingDirectory>
- <!-- making sure that the sure-fire plugin doesn't run the integration tests-->
- <!-- Integration tests are run using the fail-safe plugin in the module pom-->
- <excludes>
- <exclude>**/TaskDetailResourceTest.java</exclude>
- <exclude>**/WorkflowNodeDetailResourceTest.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAConstants.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAConstants.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAConstants.java
deleted file mode 100644
index deb3ba2..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/JPAConstants.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- * 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;
-
-public class JPAConstants {
- public static final String KEY_JDBC_URL = "registry.jdbc.url";
- public static final String KEY_JDBC_USER = "registry.jdbc.user";
- public static final String KEY_JDBC_PASSWORD = "registry.jdbc.password";
- public static final String KEY_JDBC_DRIVER = "registry.jdbc.driver";
- public static final String KEY_DERBY_START_ENABLE = "start.derby.server.mode";
- public static final String VALIDATION_QUERY = "validationQuery";
- public static final String JPA_CACHE_SIZE = "jpa.cache.size";
- public static final String ENABLE_CACHING = "cache.enable";
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java
deleted file mode 100644
index 26b7371..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/Resource.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * 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.registry.cpi.RegistryException;
-
-import java.util.List;
-
-public interface Resource {
- /**
- * This method will create associate resource objects for the given resource type.
- * @param type child resource type
- * @return associate child resource
- */
- Resource create(ResourceType type) throws RegistryException, RegistryException;
-
- /**
- * This method will remove the given child resource from the database
- * @param type child resource type
- * @param name child resource name
- */
- void remove(ResourceType type, Object name) throws RegistryException;
-
- /**
- * This method will return the given child resource from the database
- * @param type child resource type
- * @param name child resource name
- * @return associate child resource
- */
- Resource get(ResourceType type, Object name) throws RegistryException;
-
- /**
- * This method will list all the child resources for the given resource type
- * @param type child resource type
- * @return list of child resources of the given child resource type
- */
- List<Resource> get(ResourceType type) throws RegistryException;
-
- /**
- * This method will save the resource to the database.
- */
- void save() throws RegistryException;
-
- /**
- * This method will check whether an entry from the given resource type and resource name
- * exists in the database
- * @param type child resource type
- * @param name child resource name
- * @return whether the entry exists in the database or not
- */
- boolean isExists(ResourceType type, Object name) throws RegistryException;
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
deleted file mode 100644
index 55a4d0f..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * 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;
-
-public enum ResourceType {
- GATEWAY,
- PROJECT,
- USER,
- PROJECT_USER,
- CONFIGURATION,
- GATEWAY_WORKER,
- EXPERIMENT,
- EXPERIMENT_SUMMARY,
- NOTIFICATION_EMAIL,
- EXPERIMENT_INPUT,
- EXPERIMENT_OUTPUT,
- WORKFLOW_NODE_DETAIL,
- TASK_DETAIL,
- ERROR_DETAIL,
- APPLICATION_INPUT,
- APPLICATION_OUTPUT,
- NODE_INPUT,
- NODE_OUTPUT,
- JOB_DETAIL,
- DATA_TRANSFER_DETAIL,
- STATUS,
- CONFIG_DATA,
- COMPUTATIONAL_RESOURCE_SCHEDULING,
- ADVANCE_INPUT_DATA_HANDLING,
- ADVANCE_OUTPUT_DATA_HANDLING,
- QOS_PARAM
-}
[08/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Project.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Project.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Project.java
new file mode 100644
index 0000000..96bbf54
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Project.java
@@ -0,0 +1,125 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+@DataCache
+@Entity
+@Table(name ="PROJECT")
+public class Project implements Serializable {
+ @Id
+ @Column(name = "PROJECT_ID")
+ private String project_id;
+
+ @Column(name = "GATEWAY_ID")
+ private String gateway_id;
+
+ @Column(name = "PROJECT_NAME")
+ private String project_name;
+
+ @Column(name = "DESCRIPTION")
+ private String description;
+
+ @Column(name = "USER_NAME")
+ private String user_name;
+
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+
+ @ManyToOne(cascade=CascadeType.MERGE)
+ @JoinColumn(name = "GATEWAY_ID")
+ private Gateway gateway;
+
+ @ManyToOne(cascade=CascadeType.MERGE)
+ @JoinColumn(name = "USER_NAME")
+ private Users users;
+
+
+ public String getProject_name() {
+ return project_name;
+ }
+
+ public Gateway getGateway() {
+ return gateway;
+ }
+
+ public void setProject_name(String project_name) {
+ this.project_name = project_name;
+ }
+
+ public void setGateway(Gateway gateway) {
+ this.gateway = gateway;
+ }
+
+ public Users getUsers() {
+ return users;
+ }
+
+ public void setUsers(Users users) {
+ this.users = users;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public void setProject_id(String project_id) {
+ this.project_id = project_id;
+ }
+
+ public String getProject_id() {
+ return project_id;
+ }
+
+ public String getUser_name() {
+ return user_name;
+ }
+
+ public void setUser_name(String user_name) {
+ this.user_name = user_name;
+ }
+
+ public String getGateway_id() {
+ return gateway_id;
+ }
+
+ public void setGateway_id(String gateway_id) {
+ this.gateway_id = gateway_id;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ProjectUser.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ProjectUser.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ProjectUser.java
new file mode 100644
index 0000000..5bb8804
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ProjectUser.java
@@ -0,0 +1,81 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@IdClass(ProjectUser_PK.class)
+@Table(name = "PROJECT_USER")
+public class ProjectUser implements Serializable {
+ @Id
+ @Column(name = "PROJECT_ID")
+ private String projectID;
+ @Id
+ @Column(name = "USER_NAME")
+ private String userName;
+
+ @ManyToOne(cascade=CascadeType.MERGE)
+ @JoinColumn(name = "PROJECT_ID")
+ private Project project;
+
+ @ManyToOne(cascade=CascadeType.MERGE)
+ @JoinColumn(name = "USER_NAME")
+ private Users user;
+
+ public String getProjectID() {
+ return projectID;
+ }
+
+ public void setProjectID(String projectID) {
+ this.projectID = projectID;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public Project getProject() {
+ return project;
+ }
+
+ public void setProject(Project project) {
+ this.project = project;
+ }
+
+ public Users getUser() {
+ return user;
+ }
+
+ public void setUser(Users user) {
+ this.user = user;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ProjectUser_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ProjectUser_PK.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ProjectUser_PK.java
new file mode 100644
index 0000000..0d0fb40
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/ProjectUser_PK.java
@@ -0,0 +1,64 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import java.io.Serializable;
+
+public class ProjectUser_PK implements Serializable {
+ private String projectID;
+ private String userName;
+
+ public ProjectUser_PK(String projectID, String userName) {
+ this.projectID = projectID;
+ this.userName = userName;
+ }
+
+ public ProjectUser_PK() {
+ ;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return 1;
+ }
+
+ public String getProjectID() {
+ return projectID;
+ }
+
+ public void setProjectID(String projectID) {
+ this.projectID = projectID;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/QosParam.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/QosParam.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/QosParam.java
new file mode 100644
index 0000000..9b3f081
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/QosParam.java
@@ -0,0 +1,103 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name = "QOS_PARAMS")
+public class QosParam implements Serializable {
+ @Id
+ @GeneratedValue
+ @Column(name = "QOS_ID")
+ private int qosId;
+ @Column(name = "EXPERIMENT_ID")
+ private String expId;
+ @Column(name = "TASK_ID")
+ private String taskId;
+ @Column(name = "START_EXECUTION_AT")
+ private String startExecutionAt;
+ @Column(name = "EXECUTE_BEFORE")
+ private String executeBefore;
+ @Column(name = "NO_OF_RETRIES")
+ private int noOfRetries;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "EXPERIMENT_ID")
+ private Experiment experiment;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "TASK_ID")
+ private TaskDetail task;
+
+ public int getQosId() {
+ return qosId;
+ }
+
+ public void setQosId(int qosId) {
+ this.qosId = qosId;
+ }
+
+ public String getExpId() {
+ return expId;
+ }
+
+ public void setExpId(String expId) {
+ this.expId = expId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getStartExecutionAt() {
+ return startExecutionAt;
+ }
+
+ public void setStartExecutionAt(String startExecutionAt) {
+ this.startExecutionAt = startExecutionAt;
+ }
+
+ public String getExecuteBefore() {
+ return executeBefore;
+ }
+
+ public void setExecuteBefore(String executeBefore) {
+ this.executeBefore = executeBefore;
+ }
+
+ public int getNoOfRetries() {
+ return noOfRetries;
+ }
+
+ public void setNoOfRetries(int noOfRetries) {
+ this.noOfRetries = noOfRetries;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Status.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Status.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Status.java
new file mode 100644
index 0000000..52e088a
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Status.java
@@ -0,0 +1,146 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+@DataCache
+@Entity
+@Table(name = "STATUS")
+public class Status implements Serializable {
+ @Id
+ @GeneratedValue
+ @Column(name = "STATUS_ID")
+ private int statusId;
+ @Column(name = "EXPERIMENT_ID")
+ private String expId;
+ @Column(name = "NODE_INSTANCE_ID")
+ private String nodeId;
+ @Column(name = "TRANSFER_ID")
+ private String transferId;
+ @Column(name = "TASK_ID")
+ private String taskId;
+ @Column(name = "JOB_ID")
+ private String jobId;
+ @Column(name = "STATE")
+ private String state;
+ @Column(name = "STATUS_UPDATE_TIME")
+ private Timestamp statusUpdateTime;
+ @Column(name = "STATUS_TYPE")
+ private String statusType;
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
+ @JoinColumn(name = "EXPERIMENT_ID")
+ private Experiment experiment;
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
+ @JoinColumn(name = "TASK_ID")
+ private TaskDetail task;
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
+ @JoinColumn(name = "NODE_INSTANCE_ID")
+ private WorkflowNodeDetail nodeDetail;
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
+ @JoinColumn(name = "TRANSFER_ID")
+ private DataTransferDetail transferDetail;
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.MERGE)
+ @JoinColumn(name = "JOB_ID")
+ private JobDetail jobDetail;
+
+ public int getStatusId() {
+ return statusId;
+ }
+
+ public void setStatusId(int statusId) {
+ this.statusId = statusId;
+ }
+
+ public String getExpId() {
+ return expId;
+ }
+
+ public void setExpId(String expId) {
+ this.expId = expId;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public String getTransferId() {
+ return transferId;
+ }
+
+ public void setTransferId(String transferId) {
+ this.transferId = transferId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public Timestamp getStatusUpdateTime() {
+ return statusUpdateTime;
+ }
+
+ public void setStatusUpdateTime(Timestamp statusUpdateTime) {
+ this.statusUpdateTime = statusUpdateTime;
+ }
+
+ public String getStatusType() {
+ return statusType;
+ }
+
+ public void setStatusType(String statusType) {
+ this.statusType = statusType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/TaskDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/TaskDetail.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/TaskDetail.java
new file mode 100644
index 0000000..423b189
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/TaskDetail.java
@@ -0,0 +1,221 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.util.List;
+
+@DataCache
+@Entity
+@Table(name = "TASK_DETAIL")
+public class TaskDetail implements Serializable {
+ @Id
+ @Column(name = "TASK_ID")
+ private String taskId;
+ @Column(name = "NODE_INSTANCE_ID")
+ private String nodeId;
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+ @Column(name = "APPLICATION_ID")
+ private String appId;
+ @Column(name = "APPLICATION_VERSION")
+ private String appVersion;
+ @Column(name = "ALLOW_NOTIFICATION")
+ private boolean allowNotification;
+
+ @Column(name = "APPLICATION_DEPLOYMENT_ID")
+ private String applicationDeploymentId;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "NODE_INSTANCE_ID")
+ private WorkflowNodeDetail nodeDetail;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
+ private List<ApplicationOutput> applicationOutputs;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
+ private List<ApplicationInput> applicationInputs;
+
+ @OneToOne (fetch = FetchType.LAZY, mappedBy = "task")
+ private Computational_Resource_Scheduling resourceScheduling;
+
+ @OneToOne (fetch = FetchType.LAZY, mappedBy = "task")
+ private AdvancedInputDataHandling inputDataHandling;
+
+ @OneToOne (fetch = FetchType.LAZY, mappedBy = "task")
+ private AdvancedOutputDataHandling outputDataHandling;
+
+ @OneToOne (fetch = FetchType.LAZY, mappedBy = "task")
+ private Status taskStatus;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
+ private List<JobDetail> jobDetails;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
+ private List<DataTransferDetail> dataTransferDetails;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
+ private List<Notification_Email> notificationEmails;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "task")
+ private List<ErrorDetail> errorDetails;
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getAppId() {
+ return appId;
+ }
+
+ public void setAppId(String appId) {
+ this.appId = appId;
+ }
+
+ public String getAppVersion() {
+ return appVersion;
+ }
+
+ public void setAppVersion(String appVersion) {
+ this.appVersion = appVersion;
+ }
+
+ public String getApplicationDeploymentId() {
+ return applicationDeploymentId;
+ }
+
+ public void setApplicationDeploymentId(String applicationDeploymentId) {
+ this.applicationDeploymentId = applicationDeploymentId;
+ }
+
+ public boolean isAllowNotification() {
+ return allowNotification;
+ }
+
+ public void setAllowNotification(boolean allowNotification) {
+ this.allowNotification = allowNotification;
+ }
+
+ public List<ApplicationOutput> getApplicationOutputs() {
+ return applicationOutputs;
+ }
+
+ public void setApplicationOutputs(List<ApplicationOutput> applicationOutputs) {
+ this.applicationOutputs = applicationOutputs;
+ }
+
+ public List<ApplicationInput> getApplicationInputs() {
+ return applicationInputs;
+ }
+
+ public void setApplicationInputs(List<ApplicationInput> applicationInputs) {
+ this.applicationInputs = applicationInputs;
+ }
+
+ public Computational_Resource_Scheduling getResourceScheduling() {
+ return resourceScheduling;
+ }
+
+ public void setResourceScheduling(Computational_Resource_Scheduling resourceScheduling) {
+ this.resourceScheduling = resourceScheduling;
+ }
+
+ public AdvancedInputDataHandling getInputDataHandling() {
+ return inputDataHandling;
+ }
+
+ public void setInputDataHandling(AdvancedInputDataHandling inputDataHandling) {
+ this.inputDataHandling = inputDataHandling;
+ }
+
+ public AdvancedOutputDataHandling getOutputDataHandling() {
+ return outputDataHandling;
+ }
+
+ public void setOutputDataHandling(AdvancedOutputDataHandling outputDataHandling) {
+ this.outputDataHandling = outputDataHandling;
+ }
+
+ public List<JobDetail> getJobDetails() {
+ return jobDetails;
+ }
+
+ public void setJobDetails(List<JobDetail> jobDetails) {
+ this.jobDetails = jobDetails;
+ }
+
+ public List<DataTransferDetail> getDataTransferDetails() {
+ return dataTransferDetails;
+ }
+
+ public void setDataTransferDetails(List<DataTransferDetail> dataTransferDetails) {
+ this.dataTransferDetails = dataTransferDetails;
+ }
+
+ public List<Notification_Email> getNotificationEmails() {
+ return notificationEmails;
+ }
+
+ public void setNotificationEmails(List<Notification_Email> notificationEmails) {
+ this.notificationEmails = notificationEmails;
+ }
+
+ public Status getTaskStatus() {
+ return taskStatus;
+ }
+
+ public void setTaskStatus(Status taskStatus) {
+ this.taskStatus = taskStatus;
+ }
+
+ public List<ErrorDetail> getErrorDetails() {
+ return errorDetails;
+ }
+
+ public void setErrorDetails(List<ErrorDetail> errorDetails) {
+ this.errorDetails = errorDetails;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Users.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Users.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Users.java
new file mode 100644
index 0000000..f0b9b49
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/Users.java
@@ -0,0 +1,55 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@DataCache
+@Entity
+@Table(name ="USERS")
+public class Users implements Serializable {
+
+ @Id
+ @Column(name = "USER_NAME")
+ private String user_name;
+ @Column(name = "PASSWORD")
+ private String password;
+
+
+ public String getUser_name() {
+ return user_name;
+ }
+
+ public void setUser_name(String user_name) {
+ this.user_name = user_name;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/WorkflowNodeDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/WorkflowNodeDetail.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/WorkflowNodeDetail.java
new file mode 100644
index 0000000..7d38322
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/model/WorkflowNodeDetail.java
@@ -0,0 +1,155 @@
+/*
+ *
+ * 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.experiment.catalog.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.util.List;
+
+@DataCache
+@Entity
+@Table(name = "WORKFLOW_NODE_DETAIL")
+public class WorkflowNodeDetail implements Serializable {
+ @Column(name = "EXPERIMENT_ID")
+ private String expId;
+ @Id
+ @Column(name = "NODE_INSTANCE_ID")
+ private String nodeId;
+ @Column(name = "EXECUTION_UNIT")
+ private String executionUnit;
+ @Column(name = "EXECUTION_UNIT_DATA")
+ private String executionUnitData;
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+ @Column(name = "NODE_NAME")
+ private String nodeName;
+
+ @ManyToOne(cascade= CascadeType.MERGE)
+ @JoinColumn(name = "EXPERIMENT_ID")
+ private Experiment experiment;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "nodeDetail")
+ private List<TaskDetail> taskDetails;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "nodeDetail")
+ private List<NodeInput> nodeInputs;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "nodeDetail")
+ private List<NodeOutput> nodeOutputs;
+
+ @OneToOne (fetch = FetchType.LAZY, mappedBy = "nodeDetail")
+ private Status nodeStatus;
+
+ @OneToMany (fetch = FetchType.LAZY, mappedBy = "nodeDetail")
+ private List<ErrorDetail> errorDetails;
+
+ public String getExpId() {
+ return expId;
+ }
+
+ public void setExpId(String expId) {
+ this.expId = expId;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getNodeName() {
+ return nodeName;
+ }
+
+ public void setNodeName(String nodeName) {
+ this.nodeName = nodeName;
+ }
+
+ public String getExecutionUnitData() {
+ return executionUnitData;
+ }
+
+ public void setExecutionUnitData(String executionUnitData) {
+ this.executionUnitData = executionUnitData;
+ }
+
+ public String getExecutionUnit() {
+ return executionUnit;
+ }
+
+ public void setExecutionUnit(String executionUnit) {
+ this.executionUnit = executionUnit;
+ }
+
+ public List<TaskDetail> getTaskDetails() {
+ return taskDetails;
+ }
+
+ public void setTaskDetails(List<TaskDetail> taskDetails) {
+ this.taskDetails = taskDetails;
+ }
+
+ public List<NodeInput> getNodeInputs() {
+ return nodeInputs;
+ }
+
+ public void setNodeInputs(List<NodeInput> nodeInputs) {
+ this.nodeInputs = nodeInputs;
+ }
+
+ public List<NodeOutput> getNodeOutputs() {
+ return nodeOutputs;
+ }
+
+ public void setNodeOutputs(List<NodeOutput> nodeOutputs) {
+ this.nodeOutputs = nodeOutputs;
+ }
+
+ public Status getNodeStatus() {
+ return nodeStatus;
+ }
+
+ public void setNodeStatus(Status nodeStatus) {
+ this.nodeStatus = nodeStatus;
+ }
+
+ public List<ErrorDetail> getErrorDetails() {
+ return errorDetails;
+ }
+
+ public void setErrorDetails(List<ErrorDetail> errorDetails) {
+ this.errorDetails = errorDetails;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AbstractResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AbstractResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AbstractResource.java
new file mode 100644
index 0000000..86ae071
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AbstractResource.java
@@ -0,0 +1,317 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.cpi.RegistryException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class AbstractResource implements Resource {
+ // table names
+ public static final String GATEWAY = "Gateway";
+ public static final String CONFIGURATION = "Configuration";
+ public static final String USERS = "Users";
+ public static final String GATEWAY_WORKER = "Gateway_Worker";
+ public static final String PROJECT = "Project";
+ public static final String PROJECT_USER = "ProjectUser";
+ public static final String EXPERIMENT = "Experiment";
+ public static final String NOTIFICATION_EMAIL = "Notification_Email";
+ public static final String EXPERIMENT_CONFIG_DATA = "ExperimentConfigData";
+ public static final String EXPERIMENT_INPUT = "Experiment_Input";
+ public static final String EXPERIMENT_OUTPUT = "Experiment_Output";
+ public static final String WORKFLOW_NODE_DETAIL = "WorkflowNodeDetail";
+ public static final String TASK_DETAIL = "TaskDetail";
+ public static final String ERROR_DETAIL = "ErrorDetail";
+ public static final String APPLICATION_INPUT = "ApplicationInput";
+ public static final String APPLICATION_OUTPUT = "ApplicationOutput";
+ public static final String NODE_INPUT = "NodeInput";
+ public static final String NODE_OUTPUT = "NodeOutput";
+ public static final String JOB_DETAIL = "JobDetail";
+ public static final String DATA_TRANSFER_DETAIL = "DataTransferDetail";
+ public static final String STATUS = "Status";
+ public static final String CONFIG_DATA = "ExperimentConfigData";
+ public static final String COMPUTATIONAL_RESOURCE_SCHEDULING = "Computational_Resource_Scheduling";
+ public static final String ADVANCE_INPUT_DATA_HANDLING = "AdvancedInputDataHandling";
+ public static final String ADVANCE_OUTPUT_DATA_HANDLING = "AdvancedOutputDataHandling";
+ public static final String QOS_PARAMS = "QosParam";
+
+
+ // Gateway Table
+ public final class GatewayConstants {
+ public static final String GATEWAY_ID = "gateway_id";
+ public static final String GATEWAY_NAME = "gateway_name";
+ public static final String DOMAIN = "domain";
+ public static final String EMAIL_ADDRESS = "emailAddress";
+ }
+
+ // Configuration Table
+ public final class ConfigurationConstants {
+ // public static final String CONFIG_ID = "config_ID";
+ public static final String CONFIG_KEY = "config_key";
+ public static final String CONFIG_VAL = "config_val";
+ public static final String EXPIRE_DATE = "expire_date";
+ public static final String CATEGORY_ID = "category_id";
+ public static final String CATEGORY_ID_DEFAULT_VALUE = "SYSTEM";
+ }
+
+ // Users table
+ public final class UserConstants {
+ public static final String USERNAME = "user_name";
+ public static final String PASSWORD = "password";
+ }
+
+ // Gateway_Worker table
+ public final class GatewayWorkerConstants {
+ public static final String USERNAME = "user_name";
+ public static final String GATEWAY_ID = "gateway_id";
+ }
+
+ // Project table
+ public final class ProjectConstants {
+ public static final String GATEWAY_ID = "gateway_id";
+ public static final String USERNAME = "user_name";
+ public static final String PROJECT_NAME = "project_name";
+ public static final String PROJECT_ID = "project_id";
+ public static final String DESCRIPTION = "description";
+ public static final String CREATION_TIME = "creationTime";
+ }
+
+ // Project table
+ public final class ProjectUserConstants {
+ public static final String USERNAME = "userName";
+ public static final String PROJECT_ID = "projectID";
+ }
+
+ // Experiment table
+ public final class ExperimentConstants {
+ public static final String PROJECT_ID = "projectID";
+ public static final String EXECUTION_USER = "executionUser";
+ public static final String GATEWAY_ID = "gatewayId";
+ public static final String EXPERIMENT_ID = "expId";
+ public static final String EXPERIMENT_NAME = "expName";
+ public static final String DESCRIPTION = "expDesc";
+ public static final String CREATION_TIME = "creationTime";
+ public static final String APPLICATION_ID = "applicationId";
+ public static final String APPLICATION_VERSION = "appVersion";
+ public static final String WORKFLOW_TEMPLATE_ID = "workflowTemplateId";
+ public static final String WORKFLOW_TEMPLATE_VERSION = "workflowTemplateVersion";
+ public static final String WORKFLOW_EXECUTION_ID = "workflowExecutionId";
+ }
+
+ // Experiment Configuration Data table
+ public final class ExperimentConfigurationDataConstants {
+ public static final String EXPERIMENT_ID = "expId";
+ public static final String AIRAVATA_AUTO_SCHEDULE = "airavataAutoSchedule";
+ public static final String OVERRIDE_MANUAL_SCHEDULE = "overrideManualParams";
+ public static final String SHARE_EXPERIMENT = "shareExp";
+ }
+
+ public final class NotificationEmailConstants {
+ public static final String EXPERIMENT_ID = "experiment_id";
+ public static final String TASK_ID = "taskId";
+ public static final String EMAIL_ADDRESS = "emailAddress";
+ }
+
+ //Experiment Input table
+ public final class ExperimentInputConstants {
+ public static final String EXPERIMENT_ID = "experiment_id";
+ public static final String EXPERIMENT_INPUT_KEY = "ex_key";
+ public static final String EXPERIMENT_INPUT_VAL = "value";
+ public static final String INPUT_TYPE = "inputType";
+ public static final String METADATA = "metadata";
+ }
+
+ //Experiment Output table
+ public final class ExperimentOutputConstants {
+ public static final String EXPERIMENT_ID = "experiment_id";
+ public static final String EXPERIMENT_OUTPUT_KEY = "ex_key";
+ public static final String EXPERIMENT_OUTPUT_VAL = "value";
+ public static final String OUTPUT_TYPE = "outputKeyType";
+ public static final String METADATA = "metadata";
+ }
+
+ // Workflow_Data table
+ public final class WorkflowNodeDetailsConstants {
+ public static final String EXPERIMENT_ID = "expId";
+ public static final String NODE_INSTANCE_ID = "nodeId";
+ public static final String CREATION_TIME = "creationTime";
+ public static final String NODE_NAME = "nodeName";
+ }
+
+ // TaskDetail table
+ public final class TaskDetailConstants {
+ public static final String TASK_ID = "taskId";
+ public static final String NODE_INSTANCE_ID = "nodeId";
+ public static final String CREATION_TIME = "creationTime";
+ public static final String APPLICATION_ID = "appId";
+ public static final String APPLICATION_VERSION = "appVersion";
+ }
+
+ // ErrorDetails table
+ public final class ErrorDetailConstants {
+ public static final String ERROR_ID = "errorID";
+ public static final String EXPERIMENT_ID = "expId";
+ public static final String TASK_ID = "taskId";
+ public static final String JOB_ID = "jobId";
+ public static final String NODE_INSTANCE_ID = "nodeId";
+ public static final String CREATION_TIME = "creationTime";
+ public static final String ACTUAL_ERROR_MESSAGE = "actualErrorMsg";
+ public static final String USER_FRIEDNLY_ERROR_MSG = "userFriendlyErrorMsg";
+ public static final String TRANSIENT_OR_PERSISTENT = "transientPersistent";
+ public static final String ERROR_CATEGORY = "errorCategory";
+ public static final String CORRECTIVE_ACTION = "correctiveAction";
+ public static final String ACTIONABLE_GROUP = "actionableGroup";
+ }
+
+ // ApplicationInput table
+ public final class ApplicationInputConstants {
+ public static final String TASK_ID = "taskId";
+ public static final String INPUT_KEY = "inputKey";
+ public static final String INPUT_KEY_TYPE = "inputKeyType";
+ public static final String METADATA = "metadata";
+ public static final String VALUE = "value";
+ }
+
+ // ApplicationOutput table
+ public final class ApplicationOutputConstants {
+ public static final String TASK_ID = "taskId";
+ public static final String OUTPUT_KEY = "outputKey";
+ public static final String OUTPUT_KEY_TYPE = "outputKeyType";
+ public static final String METADATA = "metadata";
+ public static final String VALUE = "value";
+ }
+
+ // NodeInput table
+ public final class NodeInputConstants {
+ public static final String NODE_INSTANCE_ID = "nodeId";
+ public static final String INPUT_KEY = "inputKey";
+ public static final String INPUT_KEY_TYPE = "inputKeyType";
+ public static final String METADATA = "metadata";
+ public static final String VALUE = "value";
+ }
+
+ // NodeOutput table
+ public final class NodeOutputConstants {
+ public static final String NODE_INSTANCE_ID = "nodeId";
+ public static final String OUTPUT_KEY = "outputKey";
+ public static final String OUTPUT_KEY_TYPE = "outputKeyType";
+ public static final String METADATA = "metadata";
+ public static final String VALUE = "value";
+ }
+
+ // Job Details table constants
+ public final class JobDetailConstants{
+ public static final String JOB_ID = "jobId";
+ public static final String TASK_ID = "taskId";
+ public static final String JOB_DESCRIPTION = "jobDescription";
+ public static final String CREATION_TIME = "jobDescription";
+ }
+
+ // Data transfer Details table constants
+ public final class DataTransferDetailConstants{
+ public static final String TRANSFER_ID = "transferId";
+ public static final String TASK_ID = "taskId";
+ public static final String TRANSFER_DESC = "transferDesc";
+ public static final String CREATION_TIME = "creationTime";
+ }
+
+ // Status table constants
+ public final class StatusConstants {
+ public static final String STATUS_ID = "statusId";
+ public static final String EXPERIMENT_ID = "expId";
+ public static final String NODE_INSTANCE_ID = "nodeId";
+ public static final String TRANSFER_ID = "transferId";
+ public static final String TASK_ID = "taskId";
+ public static final String JOB_ID = "jobId";
+ public static final String STATE = "state";
+ public static final String STATUS_UPDATE_TIME = "statusUpdateTime";
+ public static final String STATUS_TYPE = "statusType";
+ }
+
+ public static final class ComputationalResourceSchedulingConstants{
+ public static final String RESOURCE_SCHEDULING_ID = "schedulingId";
+ public static final String EXPERIMENT_ID = "expId";
+ public static final String TASK_ID = "taskId";
+ public static final String RESOURCE_HOST_ID = "resourceHostId";
+ public static final String CPU_COUNT = "cpuCount";
+ public static final String NODE_COUNT = "nodeCount";
+ public static final String NO_OF_THREADS = "numberOfThreads";
+ public static final String QUEUE_NAME = "queueName";
+ public static final String WALLTIME_LIMIT = "wallTimeLimit";
+ public static final String JOB_START_TIME = "jobStartTime";
+ public static final String TOTAL_PHYSICAL_MEMORY = "totalPhysicalmemory";
+ public static final String COMPUTATIONAL_PROJECT_ACCOUNT = "projectName";
+ }
+
+ public static final class AdvancedInputDataHandlingConstants {
+ public static final String INPUT_DATA_HANDLING_ID = "dataHandlingId";
+ public static final String EXPERIMENT_ID = "expId";
+ public static final String TASK_ID = "taskId";
+ public static final String WORKING_DIR_PARENT = "parentWorkingDir";
+ public static final String UNIQUE_WORKING_DIR = "workingDir";
+ public static final String STAGE_INPUT_FILES_TO_WORKING_DIR = "stageInputsToWorkingDir";
+ public static final String CLEAN_AFTER_JOB = "cleanAfterJob";
+ }
+
+ public static final class AdvancedOutputDataHandlingConstants {
+ public static final String OUTPUT_DATA_HANDLING_ID = "outputDataHandlingId";
+ public static final String EXPERIMENT_ID = "expId";
+ public static final String TASK_ID = "taskId";
+ public static final String OUTPUT_DATA_DIR = "outputDataDir";
+ public static final String DATA_REG_URL = "dataRegUrl";
+ public static final String PERSIST_OUTPUT_DATA = "persistOutputData";
+ }
+
+ public static final class QosParamsConstants {
+ public static final String QOS_ID = "qosId";
+ public static final String EXPERIMENT_ID = "expId";
+ public static final String TASK_ID = "taskId";
+ public static final String START_EXECUTION_AT = "startExecutionAt";
+ public static final String EXECUTE_BEFORE = "executeBefore";
+ public static final String NO_OF_RETRIES = "noOfRetries";
+ }
+
+
+ protected AbstractResource() {
+ }
+
+ public boolean isExists(ResourceType type, Object name) throws RegistryException {
+ try {
+ return get(type, name) != null;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> List<T> getResourceList(List<Resource> resources,
+ Class<?> T) {
+ List<T> list = new ArrayList<T>();
+ for (Resource o : resources) {
+ list.add((T) o);
+ }
+ return list;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AdvanceInputDataHandlingResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AdvanceInputDataHandlingResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AdvanceInputDataHandlingResource.java
new file mode 100644
index 0000000..b2995dd
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AdvanceInputDataHandlingResource.java
@@ -0,0 +1,160 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.AdvancedInputDataHandling;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import java.util.List;
+
+public class AdvanceInputDataHandlingResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(AdvanceInputDataHandlingResource.class);
+ private int dataHandlingId = 0;
+ private String workingDirParent;
+ private String workingDir;
+ private boolean stageInputFiles;
+ private boolean cleanAfterJob;
+ private String experimentId;
+ private String taskId;
+
+ public String getExperimentId() {
+ return experimentId;
+ }
+
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public int getDataHandlingId() {
+ return dataHandlingId;
+ }
+
+ public void setDataHandlingId(int dataHandlingId) {
+ this.dataHandlingId = dataHandlingId;
+ }
+
+ public String getWorkingDirParent() {
+ return workingDirParent;
+ }
+
+ public void setWorkingDirParent(String workingDirParent) {
+ this.workingDirParent = workingDirParent;
+ }
+
+ public String getWorkingDir() {
+ return workingDir;
+ }
+
+ public void setWorkingDir(String workingDir) {
+ this.workingDir = workingDir;
+ }
+
+ public boolean isStageInputFiles() {
+ return stageInputFiles;
+ }
+
+ public void setStageInputFiles(boolean stageInputFiles) {
+ this.stageInputFiles = stageInputFiles;
+ }
+
+ public boolean isCleanAfterJob() {
+ return cleanAfterJob;
+ }
+
+ public void setCleanAfterJob(boolean cleanAfterJob) {
+ this.cleanAfterJob = cleanAfterJob;
+ }
+
+
+ public Resource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for input data handling resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for input data handling resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public Resource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for input data handling resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<Resource> get(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for input data handling resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ AdvancedInputDataHandling dataHandling;
+ if (dataHandlingId != 0) {
+ dataHandling = em.find(AdvancedInputDataHandling.class, dataHandlingId);
+ dataHandling.setDataHandlingId(dataHandlingId);
+ } else {
+ dataHandling = new AdvancedInputDataHandling();
+ }
+ dataHandling.setWorkingDir(workingDir);
+ dataHandling.setParentWorkingDir(workingDirParent);
+ dataHandling.setStageInputsToWorkingDir(stageInputFiles);
+ dataHandling.setCleanAfterJob(cleanAfterJob);
+ dataHandling.setExpId(experimentId);
+ dataHandling.setTaskId(taskId);
+ em.persist(dataHandling);
+ dataHandlingId = dataHandling.getDataHandlingId();
+ em.getTransaction().commit();
+ em.close();
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AdvancedOutputDataHandlingResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AdvancedOutputDataHandlingResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AdvancedOutputDataHandlingResource.java
new file mode 100644
index 0000000..fc6b049
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/AdvancedOutputDataHandlingResource.java
@@ -0,0 +1,150 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.AdvancedOutputDataHandling;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import java.util.List;
+
+public class AdvancedOutputDataHandlingResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(AdvancedOutputDataHandlingResource.class);
+ private int outputDataHandlingId = 0;
+ private String outputDataDir;
+ private String dataRegUrl;
+ private boolean persistOutputData;
+ private String experimentId;
+ private String taskId;
+
+ public String getExperimentId() {
+ return experimentId;
+ }
+
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public int getOutputDataHandlingId() {
+ return outputDataHandlingId;
+ }
+
+ public void setOutputDataHandlingId(int outputDataHandlingId) {
+ this.outputDataHandlingId = outputDataHandlingId;
+ }
+
+ public String getOutputDataDir() {
+ return outputDataDir;
+ }
+
+ public void setOutputDataDir(String outputDataDir) {
+ this.outputDataDir = outputDataDir;
+ }
+
+ public String getDataRegUrl() {
+ return dataRegUrl;
+ }
+
+ public void setDataRegUrl(String dataRegUrl) {
+ this.dataRegUrl = dataRegUrl;
+ }
+
+ public boolean isPersistOutputData() {
+ return persistOutputData;
+ }
+
+ public void setPersistOutputData(boolean persistOutputData) {
+ this.persistOutputData = persistOutputData;
+ }
+
+
+ public Resource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for output data handling resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for output data handling resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public Resource get(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for output data handling resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for output data handling resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException {
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ AdvancedOutputDataHandling dataHandling;
+ if (outputDataHandlingId != 0 ){
+ dataHandling = em.find(AdvancedOutputDataHandling.class, outputDataHandlingId);
+ dataHandling.setOutputDataHandlingId(outputDataHandlingId);
+ }else {
+ dataHandling = new AdvancedOutputDataHandling();
+ }
+ dataHandling.setDataRegUrl(dataRegUrl);
+ dataHandling.setOutputDataDir(outputDataDir);
+ dataHandling.setPersistOutputData(persistOutputData);
+ dataHandling.setExpId(experimentId);
+ dataHandling.setTaskId(taskId);
+ em.persist(dataHandling);
+ outputDataHandlingId = dataHandling.getOutputDataHandlingId();
+ em.getTransaction().commit();
+ em.close();
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ApplicationInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ApplicationInputResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ApplicationInputResource.java
new file mode 100644
index 0000000..b694d38
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ApplicationInputResource.java
@@ -0,0 +1,230 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.ApplicationInput;
+import org.apache.airavata.experiment.catalog.model.ApplicationInput_PK;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ApplicationInputResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(ApplicationInputResource.class);
+ private String inputKey;
+ private String dataType;
+ private String metadata;
+ private String value;
+ private String appArgument;
+ private boolean standardInput;
+ private String userFriendlyDesc;
+ private int inputOrder;
+ private boolean isRequired;
+ private boolean requiredToCMD;
+ private boolean dataStaged;
+ private String taskId;
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public boolean isRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean isRequired) {
+ this.isRequired = isRequired;
+ }
+
+ public boolean isRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean isDataStaged() {
+ return dataStaged;
+ }
+
+ public void setDataStaged(boolean dataStaged) {
+ this.dataStaged = dataStaged;
+ }
+
+ public int getInputOrder() {
+ return inputOrder;
+ }
+
+ public void setInputOrder(int inputOrder) {
+ this.inputOrder = inputOrder;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+
+ public boolean isStandardInput() {
+ return standardInput;
+ }
+
+ public void setStandardInput(boolean standardInput) {
+ this.standardInput = standardInput;
+ }
+
+ public String getUserFriendlyDesc() {
+ return userFriendlyDesc;
+ }
+
+ public void setUserFriendlyDesc(String userFriendlyDesc) {
+ this.userFriendlyDesc = userFriendlyDesc;
+ }
+
+ public String getInputKey() {
+ return inputKey;
+ }
+
+ public void setInputKey(String inputKey) {
+ this.inputKey = inputKey;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(String metadata) {
+ this.metadata = metadata;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public Resource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for application input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for application input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public Resource get(ResourceType type, Object name) throws RegistryException {
+ logger.error("Unsupported resource type for application input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for application input data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException {
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ ApplicationInput existingInput = em.find(ApplicationInput.class, new ApplicationInput_PK(inputKey, taskId));
+ em.close();
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ ApplicationInput applicationInput = new ApplicationInput();
+ applicationInput.setTaskId(taskId);
+ applicationInput.setInputKey(inputKey);
+ applicationInput.setDataType(dataType);
+ applicationInput.setAppArgument(appArgument);
+ applicationInput.setStandardInput(standardInput);
+ applicationInput.setUserFriendlyDesc(userFriendlyDesc);
+ applicationInput.setInputOrder(inputOrder);
+ applicationInput.setRequiredToCMD(requiredToCMD);
+ applicationInput.setRequired(isRequired);
+ applicationInput.setDataStaged(dataStaged);
+ if (value != null) {
+ applicationInput.setValue(value.toCharArray());
+ }
+
+ applicationInput.setMetadata(metadata);
+
+ if (existingInput != null) {
+ existingInput.setTaskId(taskId);
+ existingInput.setInputKey(inputKey);
+ existingInput.setDataType(dataType);
+ existingInput.setAppArgument(appArgument);
+ existingInput.setStandardInput(standardInput);
+ existingInput.setUserFriendlyDesc(userFriendlyDesc);
+ existingInput.setInputOrder(inputOrder);
+ existingInput.setRequiredToCMD(requiredToCMD);
+ existingInput.setRequired(isRequired);
+ existingInput.setDataStaged(dataStaged);
+ if (value != null) {
+ existingInput.setValue(value.toCharArray());
+ }
+ existingInput.setMetadata(metadata);
+ applicationInput = em.merge(existingInput);
+ } else {
+ em.persist(applicationInput);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ throw new RegistryException(e.getMessage());
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ApplicationOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ApplicationOutputResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ApplicationOutputResource.java
new file mode 100644
index 0000000..a1c3b5a
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ApplicationOutputResource.java
@@ -0,0 +1,208 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.ApplicationOutput;
+import org.apache.airavata.experiment.catalog.model.ApplicationOutput_PK;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ApplicationOutputResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(ApplicationOutputResource.class);
+ private String taskId;
+ private String outputKey;
+ private String dataType;
+ private String value;
+ private boolean isRequired;
+ private boolean dataMovement;
+ private String dataNameLocation;
+ private boolean requiredToCMD;
+ private String searchQuery;
+ private String appArgument;
+
+ public String getSearchQuery() {
+ return searchQuery;
+ }
+
+ public void setSearchQuery(String searchQuery) {
+ this.searchQuery = searchQuery;
+ }
+
+ public String getAppArgument() {
+ return appArgument;
+ }
+
+ public void setAppArgument(String appArgument) {
+ this.appArgument = appArgument;
+ }
+
+ public boolean isRequired() {
+ return isRequired;
+ }
+
+ public void setRequired(boolean isRequired) {
+ this.isRequired = isRequired;
+ }
+
+ public boolean isRequiredToCMD() {
+ return requiredToCMD;
+ }
+
+ public void setRequiredToCMD(boolean requiredToCMD) {
+ this.requiredToCMD = requiredToCMD;
+ }
+
+ public boolean isDataMovement() {
+ return dataMovement;
+ }
+
+ public void setDataMovement(boolean dataMovement) {
+ this.dataMovement = dataMovement;
+ }
+
+ public String getDataNameLocation() {
+ return dataNameLocation;
+ }
+
+ public void setDataNameLocation(String dataNameLocation) {
+ this.dataNameLocation = dataNameLocation;
+ }
+
+ public String getOutputKey() {
+ return outputKey;
+ }
+
+ public void setOutputKey(String outputKey) {
+ this.outputKey = outputKey;
+ }
+
+ public String getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(String dataType) {
+ this.dataType = dataType;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public Resource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for application output data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for application output data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public Resource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for application output data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for application output data resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException {
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ ApplicationOutput existingOutput = em.find(ApplicationOutput.class, new ApplicationOutput_PK(outputKey, taskId));
+ em.close();
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ ApplicationOutput applicationOutput = new ApplicationOutput();
+ applicationOutput.setTaskId(taskId);
+ applicationOutput.setOutputKey(outputKey);
+ applicationOutput.setDataType(dataType);
+ applicationOutput.setRequired(isRequired);
+ applicationOutput.setAddedToCmd(requiredToCMD);
+ applicationOutput.setDataMovement(dataMovement);
+ applicationOutput.setDataNameLocation(dataNameLocation);
+ applicationOutput.setSearchQuery(searchQuery);
+ applicationOutput.setApplicationArgument(appArgument);
+ if (value != null){
+ applicationOutput.setValue(value.toCharArray());
+ }
+
+ if (existingOutput != null) {
+ existingOutput.setTaskId(taskId);
+ existingOutput.setOutputKey(outputKey);
+ existingOutput.setDataType(dataType);
+ existingOutput.setRequired(isRequired);
+ existingOutput.setAddedToCmd(requiredToCMD);
+ existingOutput.setDataMovement(dataMovement);
+ existingOutput.setDataNameLocation(dataNameLocation);
+ existingOutput.setSearchQuery(searchQuery);
+ existingOutput.setApplicationArgument(appArgument);
+ if (value != null){
+ existingOutput.setValue(value.toCharArray());
+ }
+ applicationOutput = em.merge(existingOutput);
+ } else {
+ em.persist(applicationOutput);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e.getMessage());
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ComputationSchedulingResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ComputationSchedulingResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ComputationSchedulingResource.java
new file mode 100644
index 0000000..506e603
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/ComputationSchedulingResource.java
@@ -0,0 +1,221 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.Computational_Resource_Scheduling;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import java.sql.Timestamp;
+import java.util.List;
+
+public class ComputationSchedulingResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(ComputationSchedulingResource.class);
+ private int schedulingId = 0;
+ private String experimentId;
+ private String taskId;
+ private String resourceHostId;
+ private int cpuCount;
+ private int nodeCount;
+ private int numberOfThreads;
+ private String queueName;
+ private int walltimeLimit;
+ private Timestamp jobStartTime;
+ private int physicalMemory;
+ private String projectName;
+ private String chessisName;
+
+ public String getChessisName() {
+ return chessisName;
+ }
+
+ public void setChessisName(String chessisName) {
+ this.chessisName = chessisName;
+ }
+
+ public int getSchedulingId() {
+ return schedulingId;
+ }
+
+ public void setSchedulingId(int schedulingId) {
+ this.schedulingId = schedulingId;
+ }
+
+ public String getExperimentId() {
+ return experimentId;
+ }
+
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
+ }
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getResourceHostId() {
+ return resourceHostId;
+ }
+
+ public void setResourceHostId(String resourceHostId) {
+ this.resourceHostId = resourceHostId;
+ }
+
+ public int getCpuCount() {
+ return cpuCount;
+ }
+
+ public void setCpuCount(int cpuCount) {
+ this.cpuCount = cpuCount;
+ }
+
+ public int getNodeCount() {
+ return nodeCount;
+ }
+
+ public void setNodeCount(int nodeCount) {
+ this.nodeCount = nodeCount;
+ }
+
+ public int getNumberOfThreads() {
+ return numberOfThreads;
+ }
+
+ public void setNumberOfThreads(int numberOfThreads) {
+ this.numberOfThreads = numberOfThreads;
+ }
+
+ public String getQueueName() {
+ return queueName;
+ }
+
+ public void setQueueName(String queueName) {
+ this.queueName = queueName;
+ }
+
+ public int getWalltimeLimit() {
+ return walltimeLimit;
+ }
+
+ public void setWalltimeLimit(int walltimeLimit) {
+ this.walltimeLimit = walltimeLimit;
+ }
+
+ public Timestamp getJobStartTime() {
+ return jobStartTime;
+ }
+
+ public void setJobStartTime(Timestamp jobStartTime) {
+ this.jobStartTime = jobStartTime;
+ }
+
+ public int getPhysicalMemory() {
+ return physicalMemory;
+ }
+
+ public void setPhysicalMemory(int physicalMemory) {
+ this.physicalMemory = physicalMemory;
+ }
+
+ public String getProjectName() {
+ return projectName;
+ }
+
+ public void setProjectName(String projectName) {
+ this.projectName = projectName;
+ }
+
+
+ public Resource create(ResourceType type) throws RegistryException {
+ logger.error("Unsupported resource type for computational scheduling resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for computational scheduling resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public Resource get(ResourceType type, Object name) throws RegistryException{
+ logger.error("Unsupported resource type for computational scheduling resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ logger.error("Unsupported resource type for computational scheduling resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Computational_Resource_Scheduling scheduling;
+ if (schedulingId != 0) {
+ scheduling = em.find(Computational_Resource_Scheduling.class, schedulingId);
+ scheduling.setSchedulingId(schedulingId);
+ } else {
+ scheduling = new Computational_Resource_Scheduling();
+ }
+ scheduling.setExpId(experimentId);
+ scheduling.setTaskId(taskId);
+ scheduling.setResourceHostId(resourceHostId);
+ scheduling.setCpuCount(cpuCount);
+ scheduling.setNodeCount(nodeCount);
+ scheduling.setNumberOfThreads(numberOfThreads);
+ scheduling.setQueueName(queueName);
+ scheduling.setWallTimeLimit(walltimeLimit);
+ scheduling.setJobStartTime(jobStartTime);
+ scheduling.setTotalPhysicalmemory(physicalMemory);
+ scheduling.setProjectName(projectName);
+ scheduling.setChessisName(chessisName);
+ em.persist(scheduling);
+ schedulingId = scheduling.getSchedulingId();
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
[19/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigDataResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigDataResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigDataResource.java
deleted file mode 100644
index 25a1c5b..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigDataResource.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.Experiment;
-import org.apache.airavata.persistance.registry.jpa.model.ExperimentConfigData;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class ConfigDataResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(ConfigDataResource.class);
- private String experimentId;
- private boolean airavataAutoSchedule;
- private boolean overrideManualParams;
- private boolean shareExp;
- private String userDn;
- private boolean generateCert;
- private ComputationSchedulingResource computationSchedulingResource;
- private AdvanceInputDataHandlingResource advanceInputDataHandlingResource;
- private AdvancedOutputDataHandlingResource advancedOutputDataHandlingResource;
- private QosParamResource qosParamResource;
-
- public ComputationSchedulingResource getComputationSchedulingResource() {
- return computationSchedulingResource;
- }
-
- public void setComputationSchedulingResource(ComputationSchedulingResource computationSchedulingResource) {
- this.computationSchedulingResource = computationSchedulingResource;
- }
-
- public AdvanceInputDataHandlingResource getAdvanceInputDataHandlingResource() {
- return advanceInputDataHandlingResource;
- }
-
- public void setAdvanceInputDataHandlingResource(AdvanceInputDataHandlingResource advanceInputDataHandlingResource) {
- this.advanceInputDataHandlingResource = advanceInputDataHandlingResource;
- }
-
- public AdvancedOutputDataHandlingResource getAdvancedOutputDataHandlingResource() {
- return advancedOutputDataHandlingResource;
- }
-
- public void setAdvancedOutputDataHandlingResource(AdvancedOutputDataHandlingResource advancedOutputDataHandlingResource) {
- this.advancedOutputDataHandlingResource = advancedOutputDataHandlingResource;
- }
-
- public QosParamResource getQosParamResource() {
- return qosParamResource;
- }
-
- public void setQosParamResource(QosParamResource qosParamResource) {
- this.qosParamResource = qosParamResource;
- }
-
- public String getUserDn() {
- return userDn;
- }
-
- public void setUserDn(String userDn) {
- this.userDn = userDn;
- }
-
- public boolean isGenerateCert() {
- return generateCert;
- }
-
- public void setGenerateCert(boolean generateCert) {
- this.generateCert = generateCert;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public boolean isAiravataAutoSchedule() {
- return airavataAutoSchedule;
- }
-
- public void setAiravataAutoSchedule(boolean airavataAutoSchedule) {
- this.airavataAutoSchedule = airavataAutoSchedule;
- }
-
- public boolean isOverrideManualParams() {
- return overrideManualParams;
- }
-
- public void setOverrideManualParams(boolean overrideManualParams) {
- this.overrideManualParams = overrideManualParams;
- }
-
- public boolean isShareExp() {
- return shareExp;
- }
-
- public void setShareExp(boolean shareExp) {
- this.shareExp = shareExp;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for config data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for config data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for config data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for config data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- ExperimentConfigData existingConfig = em.find(ExperimentConfigData.class, experimentId);
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- ExperimentConfigData configData = new ExperimentConfigData();
- configData.setExpId(experimentId);
- configData.setAiravataAutoSchedule(airavataAutoSchedule);
- configData.setOverrideManualParams(overrideManualParams);
- configData.setShareExp(shareExp);
- configData.setUserDn(userDn);
- configData.setGenerateCert(generateCert);
- if (existingConfig != null) {
- existingConfig.setExpId(experimentId);
- existingConfig.setAiravataAutoSchedule(airavataAutoSchedule);
- existingConfig.setOverrideManualParams(overrideManualParams);
- existingConfig.setShareExp(shareExp);
- existingConfig.setUserDn(userDn);
- existingConfig.setGenerateCert(generateCert);
- configData = em.merge(existingConfig);
- } else {
- em.persist(configData);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java
deleted file mode 100644
index ef84988..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- *
- * 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.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.locks.Lock;
-
-import javax.persistence.EntityManager;
-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.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.Configuration;
-import org.apache.airavata.persistance.registry.jpa.model.Configuration_PK;
-import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConfigurationResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ConfigurationResource.class);
- private String configKey;
- private String configVal;
- private Timestamp expireDate;
- private String categoryID = ConfigurationConstants.CATEGORY_ID_DEFAULT_VALUE;
-
- public ConfigurationResource() {
- }
-
- /**
- * @param configKey configuration key
- * @param configVal configuration value
- */
- public ConfigurationResource(String configKey, String configVal) {
- this.configKey = configKey;
- this.configVal = configVal;
- }
-
- /**
- * Since Configuration does not depend on any other data structures at the
- * system, this method is not valid
- *
- * @param type child resource types
- * @return UnsupportedOperationException
- */
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported operation for configuration resource " +
- "since there are no child resources generated by configuration resource.. ",
- new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * Since Configuration does not depend on any other data structures at the
- * system, this method is not valid
- *
- * @param type child resource types
- * @param name name of the child resource
- * throws UnsupportedOperationException
- */
- public void remove(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported operation for configuration resource " +
- "since there are no child resources generated by configuration resource.. ",
- new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- /**
- * Since Configuration does not depend on any other data structures at the
- * system, this method is not valid
- *
- * @param type child resource types
- * @param name name of the child resource
- * @return UnsupportedOperationException
- */
- public Resource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported operation for configuration resource " +
- "since there are no child resources generated by configuration resource.. ",
- new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * Since Configuration does not depend on any other data structures at the
- * system, this method is not valid
- *
- * @param type child resource types
- * @return UnsupportedOperationException
- */
- public List<Resource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported operation for configuration resource " +
- "since there are no child resources generated by configuration resource.. ",
- new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * @param expireDate expire date of the configuration
- */
- public void setExpireDate(Timestamp expireDate) {
- this.expireDate = expireDate;
- }
-
- /**
- * save configuration to database
- */
- public synchronized void save() throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- //whether existing
- Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey, configVal, categoryID));
- em.close();
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Configuration configuration = new Configuration();
- configuration.setConfig_key(configKey);
- configuration.setConfig_val(configVal);
- configuration.setExpire_date(expireDate);
- configuration.setCategory_id(categoryID);
- if (existing != null) {
- existing.setExpire_date(expireDate);
- existing.setCategory_id(categoryID);
- configuration = em.merge(existing);
- } else {
- em.persist(configuration);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- * Since Configuration does not depend on any other data structures at the
- * system, this method is not valid
- *
- * @param type child resource types
- * @param name of the child resource
- * @return UnsupportedOperationException
- */
- public boolean isExists(ResourceType type, Object name) {
- logger.error("Unsupported operation for configuration resource " +
- "since there are no child resources generated by configuration resource.. ",
- new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * @return configuration value
- */
- public String getConfigVal() {
- return configVal;
- }
-
- /**
- * @param configKey configuration key
- */
- public void setConfigKey(String configKey) {
- this.configKey = configKey;
- }
-
- /**
- * @param configVal configuration value
- */
- public void setConfigVal(String configVal) {
- this.configVal = configVal;
- }
-
- public String getCategoryID() {
- return categoryID;
- }
-
- public void setCategoryID(String categoryID) {
- this.categoryID = categoryID;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/DataTransferDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/DataTransferDetailResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/DataTransferDetailResource.java
deleted file mode 100644
index 9ecfd91..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/DataTransferDetailResource.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.DataTransferDetail;
-import org.apache.airavata.persistance.registry.jpa.model.Status;
-import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.utils.StatusType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class DataTransferDetailResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(DataTransferDetailResource.class);
- private String transferId;
- private String taskId;
- private Timestamp creationTime;
- private String transferDescription;
- private StatusResource datatransferStatus;
-
- public StatusResource getDatatransferStatus() {
- return datatransferStatus;
- }
-
- public void setDatatransferStatus(StatusResource datatransferStatus) {
- this.datatransferStatus = datatransferStatus;
- }
-
- public String getTransferId() {
- return transferId;
- }
-
- public void setTransferId(String transferId) {
- this.transferId = transferId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getTransferDescription() {
- return transferDescription;
- }
-
- public void setTransferDescription(String transferDescription) {
- this.transferDescription = transferDescription;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public Resource create(ResourceType type) throws RegistryException {
- switch (type){
- case STATUS:
- StatusResource statusResource = new StatusResource();
- statusResource.setTransferId(transferId);
- return statusResource;
- default:
- logger.error("Unsupported resource type for data transfer details data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- switch (type) {
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.TRANSFER_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.DATA_TRANSFER);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- default:
- logger.error("Unsupported resource type for data transfer details resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.TRANSFER_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.DATA_TRANSFER);
- q = generator.selectQuery(em);
- Status status = (Status) q.getSingleResult();
- StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- em.getTransaction().commit();
- em.close();
- return statusResource;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for data transfer details resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for data transfer details resource.");
- }
- } catch (Exception e) {
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- List results;
- switch (type) {
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.TRANSFER_ID, transferId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Status status = (Status) result;
- StatusResource statusResource =
- (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- resourceList.add(statusResource);
- }
- }
- break;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for workflow node details resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- DataTransferDetail existingDF = em.find(DataTransferDetail.class, transferId);
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- DataTransferDetail dataTransferDetail = new DataTransferDetail();
- dataTransferDetail.setTransferId(transferId);
- dataTransferDetail.setTaskId(taskId);
- dataTransferDetail.setCreationTime(creationTime);
- if (transferDescription != null) {
- dataTransferDetail.setTransferDesc(transferDescription.toCharArray());
- }
- if (existingDF != null) {
- existingDF.setTransferId(transferId);
- existingDF.setTaskId(taskId);
- existingDF.setCreationTime(creationTime);
- if (transferDescription != null) {
- existingDF.setTransferDesc(transferDescription.toCharArray());
- }
- dataTransferDetail = em.merge(existingDF);
- } else {
- em.persist(dataTransferDetail);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public StatusResource getDataTransferStatus () throws RegistryException{
- List<Resource> resources = get(ResourceType.STATUS);
- for (Resource resource : resources) {
- StatusResource dataTransferStatus = (StatusResource) resource;
- if(dataTransferStatus.getStatusType().equals(StatusType.DATA_TRANSFER.toString())){
- if (dataTransferStatus.getState() == null || dataTransferStatus.getState().equals("") ){
- dataTransferStatus.setState("UNKNOWN");
- }
- return dataTransferStatus;
- }
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ErrorDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ErrorDetailResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ErrorDetailResource.java
deleted file mode 100644
index 799ebcf..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ErrorDetailResource.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.ErrorDetail;
-import org.apache.airavata.persistance.registry.jpa.model.Experiment;
-import org.apache.airavata.persistance.registry.jpa.model.TaskDetail;
-import org.apache.airavata.persistance.registry.jpa.model.WorkflowNodeDetail;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.sql.Timestamp;
-import java.util.List;
-
-public class ErrorDetailResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(ErrorDetailResource.class);
- private int errorId;
- private String experimentId;
- private String taskId;
- private String nodeId;
- private Timestamp creationTime;
- private String actualErrorMsg;
- private String userFriendlyErrorMsg;
- private boolean transientPersistent;
- private String errorCategory;
- private String correctiveAction;
- private String actionableGroup;
- private String jobId;
-
- public int getErrorId() {
- return errorId;
- }
-
- public void setErrorId(int errorId) {
- this.errorId = errorId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getActualErrorMsg() {
- return actualErrorMsg;
- }
-
- public void setActualErrorMsg(String actualErrorMsg) {
- this.actualErrorMsg = actualErrorMsg;
- }
-
- public String getUserFriendlyErrorMsg() {
- return userFriendlyErrorMsg;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public void setUserFriendlyErrorMsg(String userFriendlyErrorMsg) {
- this.userFriendlyErrorMsg = userFriendlyErrorMsg;
- }
-
- public boolean isTransientPersistent() {
- return transientPersistent;
- }
-
- public void setTransientPersistent(boolean transientPersistent) {
- this.transientPersistent = transientPersistent;
- }
-
- public String getErrorCategory() {
- return errorCategory;
- }
-
- public void setErrorCategory(String errorCategory) {
- this.errorCategory = errorCategory;
- }
-
- public String getCorrectiveAction() {
- return correctiveAction;
- }
-
- public void setCorrectiveAction(String correctiveAction) {
- this.correctiveAction = correctiveAction;
- }
-
- public String getActionableGroup() {
- return actionableGroup;
- }
-
- public void setActionableGroup(String actionableGroup) {
- this.actionableGroup = actionableGroup;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for error details data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- ErrorDetail errorDetail;
- if (errorId != 0) {
- errorDetail = em.find(ErrorDetail.class, errorId);
- errorDetail.setErrorID(errorId);
- } else {
- errorDetail = new ErrorDetail();
- }
- errorDetail.setErrorID(errorId);
- errorDetail.setExpId(experimentId);
- errorDetail.setTaskId(taskId);
- errorDetail.setNodeId(nodeId);
- errorDetail.setCreationTime(creationTime);
- if (actualErrorMsg != null){
- errorDetail.setActualErrorMsg(actualErrorMsg.toCharArray());
- }
-
- errorDetail.setUserFriendlyErrorMsg(userFriendlyErrorMsg);
- errorDetail.setTransientPersistent(transientPersistent);
- errorDetail.setErrorCategory(errorCategory);
- errorDetail.setCorrectiveAction(correctiveAction);
- errorDetail.setActionableGroup(actionableGroup);
- errorDetail.setJobId(jobId);
- em.persist(errorDetail);
- errorId = errorDetail.getErrorID();
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentInputResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentInputResource.java
deleted file mode 100644
index c70f84a..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentInputResource.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
-*
-* 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.Experiment;
-import org.apache.airavata.persistance.registry.jpa.model.Experiment_Input;
-import org.apache.airavata.persistance.registry.jpa.model.Experiment_Input_PK;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class ExperimentInputResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(ExperimentInputResource.class);
-
- private String experimentId;
- private String experimentKey;
- private String value;
- private String metadata;
- private String dataType;
- private String appArgument;
- private boolean standardInput;
- private String userFriendlyDesc;
- private int inputOrder;
- private boolean isRequired;
- private boolean requiredToCMD;
- private boolean dataStaged;
-
- public boolean getRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean required) {
- this.isRequired = required;
- }
-
- public boolean getRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataStaged() {
- return dataStaged;
- }
-
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
- }
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public String getExperimentKey() {
- return experimentKey;
- }
-
- public void setExperimentKey(String experimentKey) {
- this.experimentKey = experimentKey;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public Resource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public List<Resource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- Experiment_Input existingInput = em.find(Experiment_Input.class, new Experiment_Input_PK(experimentId, experimentKey));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Experiment_Input exInput = new Experiment_Input();
- exInput.setEx_key(experimentKey);
- exInput.setExperiment_id(experimentId);
- if (value != null){
- exInput.setValue(value.toCharArray());
- }
- exInput.setDataType(dataType);
- exInput.setMetadata(metadata);
- exInput.setAppArgument(appArgument);
- exInput.setStandardInput(standardInput);
- exInput.setUserFriendlyDesc(userFriendlyDesc);
- exInput.setInputOrder(inputOrder);
- exInput.setRequiredToCMD(requiredToCMD);
- exInput.setRequired(isRequired);
- exInput.setDataStaged(dataStaged);
- if (existingInput != null) {
- existingInput.setEx_key(experimentKey);
- existingInput.setExperiment_id(experimentId);
- if (value != null){
- existingInput.setValue(value.toCharArray());
- }
- existingInput.setDataType(dataType);
- existingInput.setMetadata(metadata);
- existingInput.setAppArgument(appArgument);
- existingInput.setStandardInput(standardInput);
- existingInput.setUserFriendlyDesc(userFriendlyDesc);
- existingInput.setInputOrder(inputOrder);
- existingInput.setRequiredToCMD(requiredToCMD);
- existingInput.setRequired(isRequired);
- existingInput.setDataStaged(dataStaged);
- exInput = em.merge(existingInput);
- } else {
- em.persist(exInput);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentOutputResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentOutputResource.java
deleted file mode 100644
index 01a23a7..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentOutputResource.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
-*
-* 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.Experiment;
-import org.apache.airavata.persistance.registry.jpa.model.Experiment_Output;
-import org.apache.airavata.persistance.registry.jpa.model.Experiment_Output_PK;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class ExperimentOutputResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(ExperimentOutputResource.class);
-
- private String experimentId;
- private String experimentKey;
- private String value;
- private String dataType;
- private boolean isRequired;
- private boolean dataMovement;
- private String dataNameLocation;
- private boolean requiredToCMD;
- private String searchQuery;
- private String appArgument;
-
- public String getSearchQuery() {
- return searchQuery;
- }
-
- public void setSearchQuery(String searchQuery) {
- this.searchQuery = searchQuery;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean getRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean getRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean required) {
- this.isRequired = required;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-
- public String getExperimentKey() {
- return experimentKey;
- }
-
- public void setExperimentKey(String experimentKey) {
- this.experimentKey = experimentKey;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public List<Resource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public void save() throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- Experiment_Output existingOutput = em.find(Experiment_Output.class, new Experiment_Output_PK(experimentId, experimentKey));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Experiment_Output exOutput = new Experiment_Output();
- exOutput.setEx_key(experimentKey);
- exOutput.setExperiment_id(experimentId);
- if (value != null){
- exOutput.setValue(value.toCharArray());
- }
- exOutput.setDataType(dataType);
- exOutput.setRequired(isRequired);
- exOutput.setRequiredToCMD(requiredToCMD);
- exOutput.setDataMovement(dataMovement);
- exOutput.setDataNameLocation(dataNameLocation);
- exOutput.setApplicationArgument(appArgument);
- exOutput.setSearchQuery(searchQuery);
-
- if (existingOutput != null) {
- existingOutput.setEx_key(experimentKey);
- existingOutput.setExperiment_id(experimentId);
- if (value != null){
- existingOutput.setValue(value.toCharArray());
- }
- existingOutput.setDataType(dataType);
- existingOutput.setRequired(isRequired);
- existingOutput.setRequiredToCMD(requiredToCMD);
- existingOutput.setDataMovement(dataMovement);
- existingOutput.setDataNameLocation(dataNameLocation);
- existingOutput.setApplicationArgument(appArgument);
- existingOutput.setSearchQuery(searchQuery);
- exOutput = em.merge(existingOutput);
- } else {
- em.persist(exOutput);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
[23/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
deleted file mode 100644
index bc9bfaf..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
+++ /dev/null
@@ -1,2983 +0,0 @@
-/*
- *
- * 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.impl;
-
-import org.apache.airavata.common.logger.AiravataLogger;
-import org.apache.airavata.common.logger.AiravataLoggerFactory;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
-import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
-import org.apache.airavata.model.workspace.experiment.*;
-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.*;
-import org.apache.airavata.persistance.registry.jpa.utils.ThriftDataModelConversion;
-import org.apache.airavata.registry.cpi.CompositeIdentifier;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.RegistryModelType;
-import org.apache.airavata.registry.cpi.ResultOrderType;
-import org.apache.airavata.registry.cpi.utils.Constants;
-import org.apache.airavata.registry.cpi.utils.StatusType;
-
-import java.sql.Timestamp;
-import java.util.*;
-
-public class ExperimentRegistry {
- private GatewayResource gatewayResource;
- private WorkerResource workerResource;
- private final static AiravataLogger logger = AiravataLoggerFactory.getLogger(ExperimentRegistry.class);
-
- public ExperimentRegistry(GatewayResource gateway, UserResource user) throws RegistryException {
- gatewayResource = gateway;
- if (!gatewayResource.isExists(ResourceType.GATEWAY_WORKER, user.getUserName())) {
- workerResource = ResourceUtils.addGatewayWorker(gateway, user);
- } else {
- workerResource = (WorkerResource) ResourceUtils.getWorker(gateway.getGatewayId(), user.getUserName());
- }
-
- }
-
- public String addExperiment(Experiment experiment, String gatewayId) throws RegistryException {
- String experimentID;
- try {
- if (!ResourceUtils.isUserExist(experiment.getUserName())) {
- ResourceUtils.addUser(experiment.getUserName(), null);
- }
-
- experimentID = getExperimentID(experiment.getName());
- experiment.setExperimentID(experimentID);
- ExperimentResource experimentResource = new ExperimentResource();
- experimentResource.setExpID(experimentID);
- experimentResource.setExpName(experiment.getName());
- experimentResource.setExecutionUser(experiment.getUserName());
- experimentResource.setGatewayId(gatewayId);
- experimentResource.setGatewayExecutionId(experiment.getGatewayExecutionId());
- experimentResource.setEnableEmailNotifications(experiment.isEnableEmailNotification());
- if (!workerResource.isProjectExists(experiment.getProjectID())) {
- logger.error("Project does not exist in the system..");
- throw new Exception("Project does not exist in the system, Please create the project first...");
- }
- experimentResource.setProjectId(experiment.getProjectID());
- experimentResource.setCreationTime(AiravataUtils.getTime(experiment.getCreationTime()));
- experimentResource.setDescription(experiment.getDescription());
- experimentResource.setApplicationId(experiment.getApplicationId());
- experimentResource.setApplicationVersion(experiment.getApplicationVersion());
- experimentResource.setWorkflowTemplateId(experiment.getWorkflowTemplateId());
- experimentResource.setWorkflowTemplateVersion(experiment.getWorkflowTemplateVersion());
- experimentResource.setWorkflowExecutionId(experiment.getWorkflowExecutionInstanceId());
- experimentResource.save();
-
- List<String> emailAddresses = experiment.getEmailAddresses();
- if (emailAddresses != null && !emailAddresses.isEmpty()){
- for (String email : emailAddresses){
- NotificationEmailResource emailResource = new NotificationEmailResource();
- emailResource.setExperimentId(experimentID);
- emailResource.setEmailAddress(email);
- emailResource.save();
- }
- }
-
- List<InputDataObjectType> experimentInputs = experiment.getExperimentInputs();
- if (experimentInputs != null) {
- addExpInputs(experimentInputs, experimentResource);
- }
-
- UserConfigurationData userConfigurationData = experiment.getUserConfigurationData();
- if (userConfigurationData != null) {
- addUserConfigData(userConfigurationData, experimentID);
- }
-
- List<OutputDataObjectType> experimentOutputs = experiment.getExperimentOutputs();
- if (experimentOutputs != null && !experimentOutputs.isEmpty()) {
- //TODO: short change.
-// for (DataObjectType output : experimentOutputs){
-// output.setValue("");
-// }
- addExpOutputs(experimentOutputs, experimentID);
- }
-
-// ExperimentStatus experimentStatus = experiment.getExperimentStatus();
-// if (experimentStatus != null){
-// updateExperimentStatus(experimentStatus, experimentID);
-// }else {
- ExperimentStatus experimentStatus = new ExperimentStatus();
- experimentStatus.setExperimentState(ExperimentState.CREATED);
- updateExperimentStatus(experimentStatus, experimentID);
-// }
-
- List<WorkflowNodeDetails> workflowNodeDetailsList = experiment.getWorkflowNodeDetailsList();
- if (workflowNodeDetailsList != null && !workflowNodeDetailsList.isEmpty()) {
- for (WorkflowNodeDetails wf : workflowNodeDetailsList) {
- addWorkflowNodeDetails(wf, experimentID);
- }
- }
- List<ErrorDetails> errors = experiment.getErrors();
- if (errors != null && !errors.isEmpty()) {
- for (ErrorDetails errror : errors) {
- addErrorDetails(errror, experimentID);
- }
- }
- } catch (Exception e) {
- logger.error("Error while saving experiment to registry", e);
- throw new RegistryException(e);
- }
- return experimentID;
- }
-
- public String addUserConfigData(UserConfigurationData configurationData, String experimentID) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment(experimentID);
- ConfigDataResource configData = (ConfigDataResource) experiment.create(ResourceType.CONFIG_DATA);
- configData.setExperimentId(experimentID);
- configData.setAiravataAutoSchedule(configurationData.isAiravataAutoSchedule());
- configData.setOverrideManualParams(configurationData.isOverrideManualScheduledParams());
- configData.setShareExp(configurationData.isShareExperimentPublicly());
- configData.setUserDn(configurationData.getUserDN());
- configData.setGenerateCert(configurationData.isGenerateCert());
- configData.save();
- ComputationalResourceScheduling resourceScheduling = configurationData.getComputationalResourceScheduling();
- if (resourceScheduling != null) {
- addComputationScheduling(resourceScheduling, experiment);
- }
- AdvancedInputDataHandling inputDataHandling = configurationData.getAdvanceInputDataHandling();
- if (inputDataHandling != null) {
- addInputDataHandling(inputDataHandling, experiment);
- }
-
- AdvancedOutputDataHandling outputDataHandling = configurationData.getAdvanceOutputDataHandling();
- if (outputDataHandling != null) {
- addOutputDataHandling(outputDataHandling, experiment);
- }
-
- QualityOfServiceParams qosParams = configurationData.getQosParams();
- if (qosParams != null) {
- addQosParams(qosParams, experiment);
- }
- } catch (Exception e) {
- logger.error("Unable to save user config data", e);
- throw new RegistryException(e);
- }
- return experimentID;
- }
-
- public void addQosParams(QualityOfServiceParams qosParams, Resource resource) throws RegistryException {
- try {
- QosParamResource qosr = new QosParamResource();
- if (resource instanceof ExperimentResource) {
- ExperimentResource experiment = (ExperimentResource) resource;
- qosr.setExperimentId(experiment.getExpID());
- }
- if (resource instanceof TaskDetailResource) {
- TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
- qosr.setTaskId(taskDetailResource.getTaskId());
- String nodeId = taskDetailResource.getNodeId();
- ExperimentResource experimentResource = new ExperimentResource();
- WorkflowNodeDetailResource workflowNode = experimentResource.getWorkflowNode(nodeId);
- qosr.setExperimentId(workflowNode.getExperimentId());
- }
- qosr.setStartExecutionAt(qosParams.getStartExecutionAt());
- qosr.setExecuteBefore(qosParams.getExecuteBefore());
- qosr.setNoOfRetries(qosParams.getNumberofRetries());
- qosr.save();
- } catch (Exception e) {
- logger.error("Unable to save QOS params", e);
- throw new RegistryException(e);
- }
-
- }
-
- public void addOutputDataHandling(AdvancedOutputDataHandling outputDataHandling, Resource resource) throws RegistryException {
- AdvancedOutputDataHandlingResource adodh = new AdvancedOutputDataHandlingResource();
- try {
- if (resource instanceof ExperimentResource) {
- ExperimentResource experiment = (ExperimentResource) resource;
- adodh.setExperimentId(experiment.getExpID());
- }
- if (resource instanceof TaskDetailResource) {
- TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
- String nodeId = taskDetailResource.getNodeId();
- ExperimentResource experimentResource = new ExperimentResource();
- WorkflowNodeDetailResource workflowNode = experimentResource.getWorkflowNode(nodeId);
- adodh.setExperimentId(workflowNode.getExperimentId());
- adodh.setTaskId(taskDetailResource.getTaskId());
- }
- adodh.setOutputDataDir(outputDataHandling.getOutputDataDir());
- adodh.setDataRegUrl(outputDataHandling.getDataRegistryURL());
- adodh.setPersistOutputData(outputDataHandling.isPersistOutputData());
- adodh.save();
- } catch (Exception e) {
- logger.error("Unable to save output data handling data", e);
- throw new RegistryException(e);
- }
-
- }
-
- public void addInputDataHandling(AdvancedInputDataHandling inputDataHandling, Resource resource) throws RegistryException {
- AdvanceInputDataHandlingResource adidh = new AdvanceInputDataHandlingResource();
- try {
- if (resource instanceof ExperimentResource) {
- ExperimentResource experiment = (ExperimentResource) resource;
- adidh.setExperimentId(experiment.getExpID());
- }
- if (resource instanceof TaskDetailResource) {
- TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
- String nodeId = taskDetailResource.getNodeId();
- ExperimentResource experimentResource = new ExperimentResource();
- WorkflowNodeDetailResource workflowNode = experimentResource.getWorkflowNode(nodeId);
- adidh.setExperimentId(workflowNode.getExperimentId());
- adidh.setTaskId(taskDetailResource.getTaskId());
- }
- adidh.setWorkingDir(inputDataHandling.getUniqueWorkingDirectory());
- adidh.setWorkingDirParent(inputDataHandling.getParentWorkingDirectory());
- adidh.setStageInputFiles(inputDataHandling.isSetStageInputFilesToWorkingDir());
- adidh.setCleanAfterJob(inputDataHandling.isCleanUpWorkingDirAfterJob());
- adidh.save();
- } catch (Exception e) {
- logger.error("Unable to save input data handling data", e);
- throw new RegistryException(e);
- }
-
- }
-
- public void addComputationScheduling(ComputationalResourceScheduling resourceScheduling, Resource resource) throws RegistryException {
- ComputationSchedulingResource cmsr = new ComputationSchedulingResource();
- try {
- if (resource instanceof ExperimentResource) {
- ExperimentResource experiment = (ExperimentResource) resource;
- cmsr.setExperimentId(experiment.getExpID());
- }
- if (resource instanceof TaskDetailResource) {
- TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
- String nodeId = taskDetailResource.getNodeId();
- ExperimentResource experimentResource = new ExperimentResource();
- WorkflowNodeDetailResource workflowNode = experimentResource.getWorkflowNode(nodeId);
- cmsr.setExperimentId(workflowNode.getExperimentId());
- cmsr.setTaskId(taskDetailResource.getTaskId());
- }
- cmsr.setResourceHostId(resourceScheduling.getResourceHostId());
- cmsr.setCpuCount(resourceScheduling.getTotalCPUCount());
- cmsr.setNodeCount(resourceScheduling.getNodeCount());
- cmsr.setNumberOfThreads(resourceScheduling.getNumberOfThreads());
- cmsr.setQueueName(resourceScheduling.getQueueName());
- cmsr.setWalltimeLimit(resourceScheduling.getWallTimeLimit());
- cmsr.setJobStartTime(AiravataUtils.getTime(resourceScheduling.getJobStartTime()));
- cmsr.setPhysicalMemory(resourceScheduling.getTotalPhysicalMemory());
- cmsr.setProjectName(resourceScheduling.getComputationalProjectAccount());
- cmsr.save();
- } catch (Exception e) {
- logger.error("Unable to save computational scheduling data", e);
- throw new RegistryException(e);
- }
-
- }
-
- public void addExpInputs(List<InputDataObjectType> exInputs, ExperimentResource experimentResource) throws RegistryException {
- try {
- for (InputDataObjectType input : exInputs) {
- ExperimentInputResource resource = (ExperimentInputResource) experimentResource.create(ResourceType.EXPERIMENT_INPUT);
- resource.setExperimentId(experimentResource.getExpID());
- resource.setExperimentKey(input.getName());
- resource.setValue(input.getValue());
- if (input.getType() != null) {
- resource.setDataType(input.getType().toString());
- }
- resource.setMetadata(input.getMetaData());
- resource.setAppArgument(input.getApplicationArgument());
- resource.setInputOrder(input.getInputOrder());
- resource.setRequired(input.isIsRequired());
- resource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
- resource.save();
- }
- } catch (Exception e) {
- logger.error("Unable to save experiment inputs", e);
- throw new RegistryException(e);
- }
- }
-
- public void updateExpInputs(List<InputDataObjectType> exInputs, ExperimentResource experimentResource) throws RegistryException {
- try {
- List<ExperimentInputResource> experimentInputs = experimentResource.getExperimentInputs();
- for (InputDataObjectType input : exInputs) {
- for (ExperimentInputResource exinput : experimentInputs) {
- if (exinput.getExperimentKey().equals(input.getName())) {
- exinput.setValue(input.getValue());
- if (input.getType() != null) {
- exinput.setDataType(input.getType().toString());
- }
- exinput.setMetadata(input.getMetaData());
- exinput.setAppArgument(input.getApplicationArgument());
- exinput.setInputOrder(input.getInputOrder());
- exinput.setRequired(input.isIsRequired());
- exinput.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
- exinput.save();
- }
- }
- }
- } catch (Exception e) {
- logger.error("Unable to update experiment inputs", e);
- throw new RegistryException(e);
- }
-
- }
-
- public String addExpOutputs(List<OutputDataObjectType> exOutput, String expId) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment(expId);
- for (OutputDataObjectType output : exOutput) {
- ExperimentOutputResource resource = (ExperimentOutputResource) experiment.create(ResourceType.EXPERIMENT_OUTPUT);
- resource.setExperimentId(expId);
- resource.setExperimentKey(output.getName());
- resource.setValue(output.getValue());
- if (output.getType() != null) {
- resource.setDataType(output.getType().toString());
- }
- resource.setRequired(output.isIsRequired());
- resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- resource.setDataMovement(output.isDataMovement());
- resource.setDataNameLocation(output.getLocation());
- resource.setAppArgument(output.getApplicationArgument());
- resource.setSearchQuery(output.getSearchQuery());
-// resource.setMetadata(output.get());
- resource.save();
- }
- } catch (Exception e) {
- logger.error("Error while adding experiment outputs...", e);
- throw new RegistryException(e);
- }
- return expId;
- }
-
- public void updateExpOutputs(List<OutputDataObjectType> exOutput, String expId) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment(expId);
- List<ExperimentOutputResource> existingExpOutputs = experiment.getExperimentOutputs();
- for (OutputDataObjectType output : exOutput) {
- for (ExperimentOutputResource resource : existingExpOutputs) {
- if (resource.getExperimentKey().equals(output.getName())) {
- resource.setExperimentId(expId);
- resource.setExperimentKey(output.getName());
- resource.setValue(output.getValue());
- if (output.getType() != null) {
- resource.setDataType(output.getType().toString());
- }
- resource.setRequired(output.isIsRequired());
- resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- resource.setDataMovement(output.isDataMovement());
- resource.setDataNameLocation(output.getLocation());
- resource.setAppArgument(output.getApplicationArgument());
- resource.setSearchQuery(output.getSearchQuery());
-// resource.setMetadata(output.getMetaData());
- resource.save();
- }
- }
- }
- } catch (Exception e) {
- logger.error("Error while updating experiment outputs", e);
- throw new RegistryException(e);
- }
- }
-
- public String addNodeOutputs(List<OutputDataObjectType> wfOutputs, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
- WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String) ids.getSecondLevelIdentifier());
- for (OutputDataObjectType output : wfOutputs) {
- NodeOutputResource resource = (NodeOutputResource) workflowNode.create(ResourceType.NODE_OUTPUT);
- resource.setNodeId(workflowNode.getNodeInstanceId());
- resource.setOutputKey(output.getName());
- resource.setValue(output.getValue());
- if (output.getType() != null) {
- resource.setDataType(output.getType().toString());
- }
- resource.setRequired(output.isIsRequired());
- resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- resource.setDataMovement(output.isDataMovement());
- resource.setDataNameLocation(output.getLocation());
- resource.setAppArgument(output.getApplicationArgument());
- resource.setSearchQuery(output.getSearchQuery());
-// resource.setMetadata(output.getMetaData());
- resource.save();
- }
- } catch (Exception e) {
- logger.error("Error while adding node outputs...", e);
- throw new RegistryException(e);
- }
- return (String) ids.getSecondLevelIdentifier();
- }
-
- public void updateNodeOutputs(List<OutputDataObjectType> wfOutputs, String nodeId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode(nodeId);
- List<NodeOutputResource> nodeOutputs = workflowNode.getNodeOutputs();
- for (OutputDataObjectType output : wfOutputs) {
- for (NodeOutputResource resource : nodeOutputs) {
- resource.setNodeId(workflowNode.getNodeInstanceId());
- resource.setOutputKey(output.getName());
- resource.setValue(output.getValue());
- if (output.getType() != null) {
- resource.setDataType(output.getType().toString());
- }
- resource.setRequired(output.isIsRequired());
- resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- resource.setDataMovement(output.isDataMovement());
- resource.setDataNameLocation(output.getLocation());
- resource.setAppArgument(output.getApplicationArgument());
- resource.setSearchQuery(output.getSearchQuery());
-// resource.setMetadata(output.getMetaData());
- resource.save();
- }
- }
- } catch (Exception e) {
- logger.error("Error while updating node outputs...", e);
- throw new RegistryException(e);
- }
- }
-
- public String addApplicationOutputs(List<OutputDataObjectType> appOutputs, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String) ids.getTopLevelIdentifier());
- TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getSecondLevelIdentifier());
- for (OutputDataObjectType output : appOutputs) {
- ApplicationOutputResource resource = (ApplicationOutputResource) taskDetail.create(ResourceType.APPLICATION_OUTPUT);
- resource.setTaskId(taskDetail.getTaskId());
- resource.setOutputKey(output.getName());
- resource.setValue(output.getValue());
- if (output.getType() != null) {
- resource.setDataType(output.getType().toString());
- }
- resource.setRequired(output.isIsRequired());
- resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- resource.setDataMovement(output.isDataMovement());
- resource.setDataNameLocation(output.getLocation());
- resource.setAppArgument(output.getApplicationArgument());
- resource.setSearchQuery(output.getSearchQuery());
-// resource.setMetadata(output.getMetaData());
- resource.save();
- }
- } catch (Exception e) {
- logger.error("Error while adding application outputs...", e);
- throw new RegistryException(e);
- }
- return (String) ids.getSecondLevelIdentifier();
- }
-
- public String updateExperimentStatus(ExperimentStatus experimentStatus, String expId) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment(expId);
- StatusResource status = experiment.getExperimentStatus();
- if (status == null) {
- status = (StatusResource) experiment.create(ResourceType.STATUS);
- }
- status.setExperimentId(expId);
- status.setStatusUpdateTime(AiravataUtils.getTime(experimentStatus.getTimeOfStateChange()));
- if (status.getState() == null) {
- status.setState(ExperimentState.UNKNOWN.name());
- }
- if (isValidStatusTransition(ExperimentState.valueOf(status.getState()), experimentStatus.getExperimentState())) {
- status.setState(experimentStatus.getExperimentState().toString());
- status.setStatusType(StatusType.EXPERIMENT.toString());
- status.save();
- logger.debugId(expId, "Updated experiment {} status to {}.", expId, experimentStatus.toString());
- }
- } catch (Exception e) {
- logger.errorId(expId, "Error while updating experiment status...", e);
- throw new RegistryException(e);
- }
- return expId;
- }
-
- public String addWorkflowNodeStatus(WorkflowNodeStatus status, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
- WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String) ids.getSecondLevelIdentifier());
- StatusResource statusResource = (StatusResource) experiment.create(ResourceType.STATUS);
- statusResource.setExperimentId(experiment.getExpID());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- statusResource.setStatusType(StatusType.WORKFLOW_NODE.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- if (status.getWorkflowNodeState() == null) {
- statusResource.setState(WorkflowNodeState.UNKNOWN.toString());
- } else {
- statusResource.setState(status.getWorkflowNodeState().toString());
- }
- statusResource.save();
- return String.valueOf(statusResource.getStatusId());
- } catch (Exception e) {
- logger.error("Error while adding workflow node status...", e);
- throw new RegistryException(e);
- }
- }
-
- public String updateWorkflowNodeStatus(WorkflowNodeStatus status, String nodeId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode(nodeId);
- StatusResource statusResource = workflowNode.getWorkflowNodeStatus();
- if (statusResource == null) {
- statusResource = (StatusResource) workflowNode.create(ResourceType.STATUS);
- }
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(nodeId);
- statusResource.setStatusType(StatusType.WORKFLOW_NODE.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- statusResource.setState(status.getWorkflowNodeState().toString());
- statusResource.save();
- logger.debugId(nodeId, "Updated workflow node {} status to {}.", nodeId, status.toString());
- return String.valueOf(statusResource.getStatusId());
- } catch (Exception e) {
- logger.errorId(nodeId, "Error while updating workflow node status to " + status.toString() + "...", e);
- throw new RegistryException(e);
- }
- }
-
- public String addTaskStatus(TaskStatus status, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode((String) ids.getTopLevelIdentifier());
- TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getSecondLevelIdentifier());
- StatusResource statusResource = (StatusResource) workflowNode.create(ResourceType.STATUS);
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- statusResource.setTaskId(taskDetail.getTaskId());
- statusResource.setStatusType(StatusType.TASK.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- if (status.getExecutionState() == null) {
- statusResource.setState(TaskState.UNKNOWN.toString());
- } else {
- statusResource.setState(status.getExecutionState().toString());
- }
- statusResource.save();
- return String.valueOf(statusResource.getStatusId());
- } catch (Exception e) {
- logger.error("Error while adding task status...", e);
- throw new RegistryException(e);
- }
- }
-
- public void updateTaskStatus(TaskStatus status, String taskId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
- StatusResource statusResource;
- if (taskDetail.isTaskStatusExist(taskId)) {
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- statusResource = workflowNode.getTaskStatus(taskId);
- } else {
- statusResource = (StatusResource) taskDetail.create(ResourceType.STATUS);
- }
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- statusResource.setTaskId(taskId);
- statusResource.setStatusType(StatusType.TASK.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- statusResource.setState(status.getExecutionState().toString());
- statusResource.save();
- logger.infoId(taskId, "Updated task {} status to {}.", taskId, status.toString());
- } catch (Exception e) {
- logger.errorId(taskId, "Error while updating task status to " + status.toString() + "...", e);
- throw new RegistryException(e);
- }
- }
-
- /**
- * @param status job status
- * @param ids composite id will contain taskid and jobid
- * @return status id
- */
- public String addJobStatus(JobStatus status, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- JobDetailResource jobDetail = taskDetail.getJobDetail((String) ids.getSecondLevelIdentifier());
- StatusResource statusResource = (StatusResource) jobDetail.create(ResourceType.STATUS);
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- statusResource.setTaskId(taskDetail.getTaskId());
- statusResource.setStatusType(StatusType.JOB.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- if (status.getJobState() == null) {
- statusResource.setState(JobState.UNKNOWN.toString());
- } else {
- statusResource.setState(status.getJobState().toString());
- }
- statusResource.save();
- return String.valueOf(statusResource.getStatusId());
- } catch (Exception e) {
- logger.error("Error while adding job status...", e);
- throw new RegistryException(e);
- }
- }
-
- public String updateJobStatus(JobStatus status, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
- JobDetailResource jobDetail = taskDetail.getJobDetail((String) ids.getSecondLevelIdentifier());
- StatusResource statusResource = jobDetail.getJobStatus();
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- statusResource.setTaskId(taskDetail.getTaskId());
- statusResource.setStatusType(StatusType.JOB.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- statusResource.setState(status.getJobState().toString());
- statusResource.save();
- logger.infoId(ids.toString(), "Updated job status to {}", status.toString());
- return String.valueOf(statusResource.getStatusId());
- } catch (Exception e) {
- logger.errorId(ids.toString(), "Error while updating job status to " + status.toString() + " ...", e);
- throw new RegistryException(e);
- }
- }
-
- /**
- * @param status application status
- * @param ids composite id will contain taskid and jobid
- * @return status id
- */
- public String addApplicationStatus(ApplicationStatus status, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
- JobDetailResource jobDetail = taskDetail.getJobDetail((String) ids.getSecondLevelIdentifier());
- StatusResource statusResource = (StatusResource) jobDetail.create(ResourceType.STATUS);
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- statusResource.setTaskId(taskDetail.getTaskId());
- statusResource.setStatusType(StatusType.APPLICATION.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- if (status.getApplicationState() == null) {
- statusResource.setState("UNKNOWN");
- } else {
- statusResource.setState(status.getApplicationState());
- }
- statusResource.save();
- return String.valueOf(statusResource.getStatusId());
- } catch (Exception e) {
- logger.error("Unable to read airavata-server properties", e);
- throw new RegistryException(e);
- }
- }
-
- public void updateApplicationStatus(ApplicationStatus status, String jobId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
- JobDetailResource jobDetail = taskDetail.getJobDetail(jobId);
- StatusResource statusResource = jobDetail.getApplicationStatus();
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- statusResource.setTaskId(taskDetail.getTaskId());
- statusResource.setStatusType(StatusType.APPLICATION.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- statusResource.setState(status.getApplicationState());
- statusResource.save();
- } catch (Exception e) {
- logger.error("Error while updating application status...", e);
- throw new RegistryException(e);
- }
- }
-
-
- /**
- * @param status data transfer status
- * @param ids contains taskId and transfer id
- * @return status id
- */
- public String addTransferStatus(TransferStatus status, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
- DataTransferDetailResource dataTransferDetail = taskDetail.getDataTransferDetail((String) ids.getSecondLevelIdentifier());
- StatusResource statusResource = (StatusResource) dataTransferDetail.create(ResourceType.STATUS);
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- statusResource.setTaskId(taskDetail.getTaskId());
- statusResource.setTransferId(dataTransferDetail.getTransferId());
- statusResource.setStatusType(StatusType.DATA_TRANSFER.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- if (status.getTransferState() == null) {
- statusResource.setState(TransferState.UNKNOWN.toString());
- } else {
- statusResource.setState(status.getTransferState().toString());
- }
- statusResource.save();
- return String.valueOf(statusResource.getStatusId());
- } catch (Exception e) {
- logger.error("Error while adding transfer status...", e);
- throw new RegistryException(e);
- }
- }
-
- public void updateTransferStatus(TransferStatus status, String transferId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
- DataTransferDetailResource dataTransferDetail = taskDetail.getDataTransferDetail(transferId);
- StatusResource statusResource = dataTransferDetail.getDataTransferStatus();
-
- String taskId = dataTransferDetail.getTaskId();
- taskDetail = workflowNode.getTaskDetail(taskId);
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- if (workflowNode != null) {
- statusResource.setExperimentId(workflowNode.getExperimentId());
- statusResource.setNodeId(workflowNode.getNodeInstanceId());
- }
- statusResource.setTaskId(taskId);
- statusResource.setTransferId(transferId);
- statusResource.setStatusType(StatusType.DATA_TRANSFER.toString());
- statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
- statusResource.setState(status.getTransferState().toString());
- statusResource.save();
- } catch (Exception e) {
- logger.error("Error while updating transfer status...", e);
- throw new RegistryException(e);
- }
- }
-
- public String addWorkflowNodeDetails(WorkflowNodeDetails nodeDetails, String expId) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment(expId);
- WorkflowNodeDetailResource resource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- resource.setExperimentId(expId);
- resource.setNodeName(nodeDetails.getNodeName());
- resource.setExecutionUnit(nodeDetails.getExecutionUnit().toString());
- resource.setExecutionUnitData(nodeDetails.getExecutionUnitData());
- resource.setCreationTime(AiravataUtils.getTime(nodeDetails.getCreationTime()));
- resource.setNodeInstanceId(getNodeInstanceID(nodeDetails.getNodeName()));
- resource.save();
- String nodeId = resource.getNodeInstanceId();
- List<InputDataObjectType> nodeInputs = nodeDetails.getNodeInputs();
- if (nodeInputs != null) {
- addWorkflowInputs(nodeDetails.getNodeInputs(), resource);
- }
- List<OutputDataObjectType> nodeOutputs = nodeDetails.getNodeOutputs();
- if (nodeOutputs != null && !nodeOutputs.isEmpty()) {
- CompositeIdentifier ids = new CompositeIdentifier(expId, nodeId);
- addNodeOutputs(nodeOutputs, ids);
- }
- WorkflowNodeStatus workflowNodeStatus = nodeDetails.getWorkflowNodeStatus();
- CompositeIdentifier ids = new CompositeIdentifier(expId, nodeId);
- if (workflowNodeStatus == null) {
- workflowNodeStatus = new WorkflowNodeStatus();
- }
-// if (workflowNodeStatus.getWorkflowNodeState() != null){
-// WorkflowNodeStatus status = getWorkflowNodeStatus(nodeId);
-// if (status != null){
-// updateWorkflowNodeStatus(workflowNodeStatus, nodeId);
-// }else {
-// addWorkflowNodeStatus(workflowNodeStatus,ids);
-// }
-// }else {
-// workflowNodeStatus.setWorkflowNodeState(WorkflowNodeState.UNKNOWN);
-// addWorkflowNodeStatus(workflowNodeStatus, ids);
-// }
- workflowNodeStatus.setWorkflowNodeState(WorkflowNodeState.UNKNOWN);
- addWorkflowNodeStatus(workflowNodeStatus, ids);
- List<TaskDetails> taskDetails = nodeDetails.getTaskDetailsList();
- if (taskDetails != null && !taskDetails.isEmpty()) {
- for (TaskDetails task : taskDetails) {
- addTaskDetails(task, nodeId);
- }
- }
- List<ErrorDetails> errors = nodeDetails.getErrors();
- if (errors != null && !errors.isEmpty()) {
- for (ErrorDetails error : errors) {
- addErrorDetails(error, nodeId);
- }
- }
- return nodeId;
- } catch (Exception e) {
- logger.error("Error while adding workflow node details...", e);
- throw new RegistryException(e);
- }
- }
-
- public void updateWorkflowNodeDetails(WorkflowNodeDetails nodeDetails, String nodeId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode(nodeId);
- workflowNode.setNodeName(nodeDetails.getNodeName());
- workflowNode.setExecutionUnit(nodeDetails.getExecutionUnit().toString());
- workflowNode.setExecutionUnitData(nodeDetails.getExecutionUnitData());
- workflowNode.setCreationTime(AiravataUtils.getTime(nodeDetails.getCreationTime()));
- workflowNode.setNodeInstanceId(nodeId);
- workflowNode.save();
- String expID = workflowNode.getExperimentId();
- List<InputDataObjectType> nodeInputs = nodeDetails.getNodeInputs();
- if (nodeInputs != null) {
- updateWorkflowInputs(nodeDetails.getNodeInputs(), workflowNode);
- }
- List<OutputDataObjectType> nodeOutputs = nodeDetails.getNodeOutputs();
- if (nodeOutputs != null && !nodeOutputs.isEmpty()) {
- updateNodeOutputs(nodeOutputs, nodeId);
- }
- WorkflowNodeStatus workflowNodeStatus = nodeDetails.getWorkflowNodeStatus();
- if (workflowNodeStatus != null) {
- if (isWFNodeExist(nodeId)) {
- updateWorkflowNodeStatus(workflowNodeStatus, nodeId);
- } else {
- CompositeIdentifier ids = new CompositeIdentifier(expID, nodeId);
- addWorkflowNodeStatus(workflowNodeStatus, ids);
- }
- }
- List<TaskDetails> taskDetails = nodeDetails.getTaskDetailsList();
- if (taskDetails != null && !taskDetails.isEmpty()) {
- for (TaskDetails task : taskDetails) {
- String taskID = task.getTaskID();
- if (isTaskDetailExist(taskID)) {
- updateTaskDetails(task, taskID);
- } else {
- addTaskDetails(task, nodeId);
- }
- }
- }
- List<ErrorDetails> errors = nodeDetails.getErrors();
- if (errors != null && !errors.isEmpty()) {
- for (ErrorDetails error : errors) {
- addErrorDetails(error, nodeId);
- }
- }
- } catch (Exception e) {
- logger.error("Error while updating workflow node details...", e);
- throw new RegistryException(e);
- }
- }
-
-
- public void addWorkflowInputs(List<InputDataObjectType> wfInputs, WorkflowNodeDetailResource nodeDetailResource) throws RegistryException {
- try {
- for (InputDataObjectType input : wfInputs) {
- NodeInputResource resource = (NodeInputResource) nodeDetailResource.create(ResourceType.NODE_INPUT);
- resource.setNodeId(nodeDetailResource.getNodeInstanceId());
- resource.setInputKey(input.getName());
- resource.setValue(input.getValue());
- if (input.getType() != null) {
- resource.setDataType(input.getType().toString());
- }
- resource.setMetadata(input.getMetaData());
- resource.setAppArgument(input.getApplicationArgument());
- resource.setInputOrder(input.getInputOrder());
- resource.setRequired(input.isIsRequired());
- resource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
- resource.save();
- }
- } catch (Exception e) {
- logger.error("Error while adding workflow inputs...", e);
- throw new RegistryException(e);
- }
-
- }
-
- public void updateWorkflowInputs(List<InputDataObjectType> wfInputs, WorkflowNodeDetailResource nodeDetailResource) throws RegistryException {
- try {
- List<NodeInputResource> nodeInputs = nodeDetailResource.getNodeInputs();
- for (InputDataObjectType input : wfInputs) {
- for (NodeInputResource resource : nodeInputs) {
- resource.setNodeId(nodeDetailResource.getNodeInstanceId());
- resource.setInputKey(input.getName());
- resource.setValue(input.getValue());
- if (input.getType() != null) {
- resource.setDataType(input.getType().toString());
- }
- resource.setMetadata(input.getMetaData());
- resource.setAppArgument(input.getApplicationArgument());
- resource.setInputOrder(input.getInputOrder());
- resource.setRequired(input.isIsRequired());
- resource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
- resource.save();
- }
- }
- } catch (Exception e) {
- logger.error("Error while updating workflow inputs...", e);
- throw new RegistryException(e);
- }
-
- }
-
- public String addTaskDetails(TaskDetails taskDetails, String nodeId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = experiment.getWorkflowNode(nodeId);
- TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
- taskDetail.setNodeId(nodeId);
- taskDetail.setTaskId(getTaskID(workflowNode.getNodeName()));
- taskDetail.setApplicationId(taskDetails.getApplicationId());
- taskDetail.setApplicationVersion(taskDetails.getApplicationVersion());
- taskDetail.setCreationTime(AiravataUtils.getTime(taskDetails.getCreationTime()));
- taskDetail.setEnableEmailNotifications(taskDetails.isEnableEmailNotification());
- taskDetail.save();
-
- List<String> emailAddresses = taskDetails.getEmailAddresses();
- if (emailAddresses != null && !emailAddresses.isEmpty()){
- for (String email : emailAddresses){
- NotificationEmailResource emailResource = new NotificationEmailResource();
- emailResource.setExperimentId(workflowNode.getExperimentId());
- emailResource.setTaskId(taskDetail.getTaskId());
- emailResource.setEmailAddress(email);
- emailResource.save();
- }
- }
-
- List<InputDataObjectType> applicationInputs = taskDetails.getApplicationInputs();
- if (applicationInputs != null) {
- addAppInputs(applicationInputs, taskDetail);
- }
- List<OutputDataObjectType> applicationOutput = taskDetails.getApplicationOutputs();
- if (applicationOutput != null) {
- addAppOutputs(applicationOutput, taskDetail);
- }
- ComputationalResourceScheduling taskScheduling = taskDetails.getTaskScheduling();
- if (taskScheduling != null) {
- addComputationScheduling(taskScheduling, taskDetail);
- }
- AdvancedInputDataHandling inputDataHandling = taskDetails.getAdvancedInputDataHandling();
- if (inputDataHandling != null) {
- addInputDataHandling(inputDataHandling, taskDetail);
- }
- AdvancedOutputDataHandling outputDataHandling = taskDetails.getAdvancedOutputDataHandling();
- if (outputDataHandling != null) {
- addOutputDataHandling(outputDataHandling, taskDetail);
- }
-
- List<JobDetails> jobDetailsList = taskDetails.getJobDetailsList();
- if (jobDetailsList != null && !jobDetailsList.isEmpty()) {
- for (JobDetails job : jobDetailsList) {
- CompositeIdentifier ids = new CompositeIdentifier(taskDetail.getTaskId(), job.getJobID());
- addJobDetails(job, ids);
- }
- }
-
- List<DataTransferDetails> dataTransferDetailsList = taskDetails.getDataTransferDetailsList();
- if (dataTransferDetailsList != null && !dataTransferDetailsList.isEmpty()) {
- for (DataTransferDetails transferDetails : dataTransferDetailsList) {
- addDataTransferDetails(transferDetails, taskDetail.getTaskId());
- }
- }
-
- List<ErrorDetails> errors = taskDetails.getErrors();
- if (errors != null && !errors.isEmpty()) {
- for (ErrorDetails error : errors) {
- addErrorDetails(error, taskDetail.getTaskId());
- }
- }
-
- TaskStatus taskStatus = taskDetails.getTaskStatus();
- CompositeIdentifier ids = new CompositeIdentifier(nodeId, taskDetail.getTaskId());
- if (taskStatus != null) {
- if (taskStatus.getExecutionState() != null) {
- addTaskStatus(taskStatus, ids);
- } else {
- taskStatus.setExecutionState(TaskState.UNKNOWN);
- addTaskStatus(taskStatus, ids);
- }
- } else {
- TaskStatus status = new TaskStatus();
- status.setExecutionState(TaskState.UNKNOWN);
- addTaskStatus(status, ids);
- }
- return taskDetail.getTaskId();
- } catch (Exception e) {
- logger.error("Error while adding task details...", e);
- throw new RegistryException(e);
- }
- }
-
- public String updateTaskDetails(TaskDetails taskDetails, String taskId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
-// taskDetail.setWorkflowNodeDetailResource(workflowNode);
- taskDetail.setApplicationId(taskDetails.getApplicationId());
- taskDetail.setApplicationVersion(taskDetails.getApplicationVersion());
- taskDetail.setCreationTime(AiravataUtils.getTime(taskDetails.getCreationTime()));
- taskDetail.setApplicationDeploymentId(taskDetails.getApplicationDeploymentId());
- taskDetail.setEnableEmailNotifications(taskDetails.isEnableEmailNotification());
- taskDetail.save();
-
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
-
- List<String> emailAddresses = taskDetails.getEmailAddresses();
- // remove existing emails
- taskDetail.remove(ResourceType.NOTIFICATION_EMAIL, taskId);
- if (emailAddresses != null && !emailAddresses.isEmpty()){
- for (String email : emailAddresses){
- NotificationEmailResource emailResource = new NotificationEmailResource();
- emailResource.setExperimentId(workflowNode.getExperimentId());
- emailResource.setTaskId(taskId);
- emailResource.setEmailAddress(email);
- emailResource.save();
- }
- }
- List<InputDataObjectType> applicationInputs = taskDetails.getApplicationInputs();
- if (applicationInputs != null) {
- updateAppInputs(applicationInputs, taskDetail);
- }
- ComputationalResourceScheduling taskScheduling = taskDetails.getTaskScheduling();
- if (taskScheduling != null) {
- updateSchedulingData(taskScheduling, taskDetail);
- }
- AdvancedInputDataHandling inputDataHandling = taskDetails.getAdvancedInputDataHandling();
- if (inputDataHandling != null) {
- updateInputDataHandling(inputDataHandling, taskDetail);
- }
- AdvancedOutputDataHandling outputDataHandling = taskDetails.getAdvancedOutputDataHandling();
- if (outputDataHandling != null) {
- updateOutputDataHandling(outputDataHandling, taskDetail);
- }
- List<JobDetails> jobDetailsList = taskDetails.getJobDetailsList();
- if (jobDetailsList != null && !jobDetailsList.isEmpty()) {
- for (JobDetails job : jobDetailsList) {
- CompositeIdentifier ids = new CompositeIdentifier(taskId, job.getJobID());
- updateJobDetails(job, ids);
- }
- }
-
- List<DataTransferDetails> dataTransferDetailsList = taskDetails.getDataTransferDetailsList();
- if (dataTransferDetailsList != null && !dataTransferDetailsList.isEmpty()) {
- for (DataTransferDetails transferDetails : dataTransferDetailsList) {
- updateDataTransferDetails(transferDetails, transferDetails.getTransferID());
- }
- }
-
- List<ErrorDetails> errors = taskDetails.getErrors();
- if (errors != null && !errors.isEmpty()) {
- for (ErrorDetails error : errors) {
- addErrorDetails(error, taskDetail.getTaskId());
- }
- }
-
- TaskStatus taskStatus = taskDetails.getTaskStatus();
- if (taskStatus != null) {
- updateTaskStatus(taskStatus, taskId);
- }
- return taskDetail.getTaskId();
- } catch (Exception e) {
- logger.error("Error while updating task details...", e);
- throw new RegistryException(e);
- }
- }
-
- public void addAppInputs(List<InputDataObjectType> appInputs, TaskDetailResource taskDetailResource) throws RegistryException {
- try {
- for (InputDataObjectType input : appInputs) {
- ApplicationInputResource resource = (ApplicationInputResource) taskDetailResource.create(ResourceType.APPLICATION_INPUT);
- resource.setTaskId(taskDetailResource.getTaskId());
- resource.setInputKey(input.getName());
- resource.setValue(input.getValue());
- if (input.getType() != null) {
- resource.setDataType(input.getType().toString());
- }
- resource.setMetadata(input.getMetaData());
- resource.setAppArgument(input.getApplicationArgument());
- resource.setInputOrder(input.getInputOrder());
- resource.setRequired(input.isIsRequired());
- resource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
- resource.save();
- }
- } catch (Exception e) {
- logger.error("Error while adding application inputs...", e);
- throw new RegistryException(e);
- }
-
- }
-
- public void addAppOutputs(List<OutputDataObjectType> appOytputs, TaskDetailResource taskDetailResource) throws RegistryException {
- try {
- for (OutputDataObjectType output : appOytputs) {
- ApplicationOutputResource resource = (ApplicationOutputResource) taskDetailResource.create(ResourceType.APPLICATION_OUTPUT);
- resource.setTaskId(taskDetailResource.getTaskId());
- resource.setOutputKey(output.getName());
- resource.setValue(output.getValue());
- if (output.getType() != null) {
- resource.setDataType(output.getType().toString());
- }
- resource.setRequired(output.isIsRequired());
- resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- resource.setDataMovement(output.isDataMovement());
- resource.setDataNameLocation(output.getLocation());
- resource.setAppArgument(output.getApplicationArgument());
- resource.setSearchQuery(output.getSearchQuery());
- resource.save();
- }
- } catch (Exception e) {
- logger.error("Error while adding application outputs...", e);
- throw new RegistryException(e);
- }
-
- }
-
- public void updateAppOutputs(List<OutputDataObjectType> appOutputs, String taskId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
- List<ApplicationOutputResource> outputs = taskDetail.getApplicationOutputs();
- for (OutputDataObjectType output : appOutputs) {
- for (ApplicationOutputResource resource : outputs) {
- resource.setTaskId(taskId);
- resource.setOutputKey(output.getName());
- resource.setValue(output.getValue());
- if (output.getType() != null) {
- resource.setDataType(output.getType().toString());
- }
- resource.setRequired(output.isIsRequired());
- resource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- resource.setDataMovement(output.isDataMovement());
- resource.setDataNameLocation(output.getLocation());
- resource.setAppArgument(output.getApplicationArgument());
- resource.setSearchQuery(output.getSearchQuery());
-// resource.setMetadata(output.getMetaData());
- resource.save();
- }
- }
- } catch (Exception e) {
- logger.error("Error while updating application outputs...", e);
- throw new RegistryException(e);
- }
- }
-
- public void updateAppInputs(List<InputDataObjectType> appInputs, TaskDetailResource taskDetailResource) throws RegistryException {
- try {
- List<ApplicationInputResource> inputs = taskDetailResource.getApplicationInputs();
- for (InputDataObjectType input : appInputs) {
- for (ApplicationInputResource resource : inputs) {
- resource.setTaskId(taskDetailResource.getTaskId());
- resource.setInputKey(input.getName());
- resource.setValue(input.getValue());
- if (input.getType() != null) {
- resource.setDataType(input.getType().toString());
- }
- resource.setMetadata(input.getMetaData());
- resource.setAppArgument(input.getApplicationArgument());
- resource.setInputOrder(input.getInputOrder());
- resource.setRequired(input.isIsRequired());
- resource.setRequiredToCMD(input.isRequiredToAddedToCommandLine());
- resource.save();
- }
-
- }
- } catch (Exception e) {
- logger.error("Error while updating application inputs...", e);
- throw new RegistryException(e);
- }
-
- }
-
- public String addJobDetails(JobDetails jobDetails, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail((String) ids.getTopLevelIdentifier());
- JobDetailResource jobDetail = taskDetail.createJobDetail((String) ids.getSecondLevelIdentifier());
- jobDetail.setTaskId(taskDetail.getTaskId());
- jobDetail.setJobDescription(jobDetails.getJobDescription());
- jobDetail.setCreationTime(AiravataUtils.getTime(jobDetails.getCreationTime()));
- jobDetail.setComputeResourceConsumed(jobDetails.getComputeResourceConsumed());
- jobDetail.setWorkingDir(jobDetails.getWorkingDir());
- jobDetail.setJobName(jobDetails.getJobName());
- jobDetail.save();
- JobStatus jobStatus = jobDetails.getJobStatus();
- if (jobStatus != null) {
- JobStatus status = getJobStatus(ids);
- if (status != null) {
- updateJobStatus(jobStatus, ids);
- } else {
- addJobStatus(jobStatus, ids);
- }
- }
- ApplicationStatus applicationStatus = jobDetails.getApplicationStatus();
- if (applicationStatus != null) {
- ApplicationStatus appStatus = getApplicationStatus(ids);
- if (appStatus != null) {
- updateApplicationStatus(applicationStatus, (String) ids.getSecondLevelIdentifier());
- } else {
- addApplicationStatus(applicationStatus, ids);
- }
- }
- List<ErrorDetails> errors = jobDetails.getErrors();
- if (errors != null && !errors.isEmpty()) {
- for (ErrorDetails error : errors) {
- addErrorDetails(error, ids.getSecondLevelIdentifier());
- }
- }
- return jobDetail.getJobId();
- } catch (Exception e) {
- logger.error("Error while adding job details...", e);
- throw new RegistryException(e);
- }
- }
-
- // ids - taskId + jobid
- public void updateJobDetails(JobDetails jobDetails, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- String taskId = (String) ids.getTopLevelIdentifier();
- TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
- String jobId = (String) ids.getSecondLevelIdentifier();
- JobDetailResource jobDetail = taskDetail.getJobDetail(jobId);
- jobDetail.setTaskId(taskDetail.getTaskId());
- jobDetail.setJobDescription(jobDetails.getJobDescription());
- jobDetail.setCreationTime(AiravataUtils.getTime(jobDetails.getCreationTime()));
- jobDetail.setComputeResourceConsumed(jobDetails.getComputeResourceConsumed());
- jobDetail.setJobName(jobDetails.getJobName());
- jobDetail.setWorkingDir(jobDetails.getWorkingDir());
- jobDetail.save();
- JobStatus jobStatus = jobDetails.getJobStatus();
- if (jobStatus != null) {
- JobStatus status = getJobStatus(ids);
- if (status != null) {
- updateJobStatus(jobStatus, ids);
- } else {
- addJobStatus(jobStatus, ids);
- }
- }
- ApplicationStatus applicationStatus = jobDetails.getApplicationStatus();
- if (applicationStatus != null) {
- ApplicationStatus appStatus = getApplicationStatus(ids);
- if (appStatus != null) {
- updateApplicationStatus(applicationStatus, jobId);
- } else {
- addApplicationStatus(applicationStatus, ids);
- }
- }
- List<ErrorDetails> errors = jobDetails.getErrors();
- if (errors != null && !errors.isEmpty()) {
- for (ErrorDetails error : errors) {
- addErrorDetails(error, jobId);
- }
- }
- } catch (Exception e) {
- logger.error("Error while updating job details...", e);
- throw new RegistryException(e);
- }
- }
-
- public String addDataTransferDetails(DataTransferDetails transferDetails, String taskId) throws RegistryException {
- try {
- if (transferDetails.getTransferDescription() == null){
- throw new RegistryException("Data transfer description cannot be empty");
- }
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
- DataTransferDetailResource resource = (DataTransferDetailResource) taskDetail.create(ResourceType.DATA_TRANSFER_DETAIL);
- resource.setTaskId(taskId);
- resource.setTransferId(getDataTransferID(taskId));
-
- resource.setTransferDescription(transferDetails.getTransferDescription());
- resource.setCreationTime(AiravataUtils.getTime(transferDetails.getCreationTime()));
- resource.save();
- String transferId = resource.getTransferId();
- TransferStatus transferStatus = transferDetails.getTransferStatus();
- if (transferStatus != null) {
- TransferStatus status = getDataTransferStatus(transferId);
- if (status != null) {
- updateTransferStatus(transferStatus, transferId);
- } else {
- CompositeIdentifier ids = new CompositeIdentifier(taskId, transferId);
- addTransferStatus(transferStatus, ids);
- }
- }
- return resource.getTransferId();
- } catch (Exception e) {
- logger.error("Error while adding transfer details...", e);
- throw new RegistryException(e);
- }
- }
-
- public String updateDataTransferDetails(DataTransferDetails transferDetails, String transferId) throws RegistryException {
- try {
- ExperimentResource experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- WorkflowNodeDetailResource workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = (TaskDetailResource) workflowNode.create(ResourceType.TASK_DETAIL);
- DataTransferDetailResource resource = taskDetail.getDataTransferDetail(transferId);
-// resource.setTaskDetailResource(taskDetail);
- resource.setTransferDescription(transferDetails.getTransferDescription());
- resource.setCreationTime(AiravataUtils.getTime(transferDetails.getCreationTime()));
- resource.save();
- String taskId = resource.getTaskId();
- TransferStatus transferStatus = transferDetails.getTransferStatus();
- if (transferStatus != null) {
- TransferStatus status = getDataTransferStatus(transferId);
- if (status != null) {
- updateTransferStatus(transferStatus, transferId);
- } else {
- CompositeIdentifier ids = new CompositeIdentifier(taskId, transferId);
- addTransferStatus(transferStatus, ids);
- }
- }
- return resource.getTransferId();
- } catch (Exception e) {
- logger.error("Error while updating transfer details...", e);
- throw new RegistryException(e);
- }
- }
-
- /**
- * @param scheduling computational resource object
- * @param ids contains expId and taskId, if it is an experiment, task id can be null
- * @return scheduling id
- */
- public String addComputationalResourceScheduling(ComputationalResourceScheduling scheduling, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
- ComputationSchedulingResource schedulingResource = (ComputationSchedulingResource) experiment.create(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING);
- if (ids.getSecondLevelIdentifier() != null) {
- WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = nodeDetailResource.getTaskDetail((String) ids.getSecondLevelIdentifier());
- schedulingResource.setTaskId(taskDetail.getTaskId());
- }
- schedulingResource.setExperimentId(experiment.getExpID());
- schedulingResource.setResourceHostId(scheduling.getResourceHostId());
- schedulingResource.setCpuCount(scheduling.getTotalCPUCount());
- schedulingResource.setNodeCount(scheduling.getNodeCount());
- schedulingResource.setNumberOfThreads(scheduling.getNumberOfThreads());
- schedulingResource.setQueueName(scheduling.getQueueName());
- schedulingResource.setWalltimeLimit(scheduling.getWallTimeLimit());
- schedulingResource.setJobStartTime(AiravataUtils.getTime(scheduling.getJobStartTime()));
- schedulingResource.setPhysicalMemory(scheduling.getTotalPhysicalMemory());
- schedulingResource.setProjectName(scheduling.getComputationalProjectAccount());
- schedulingResource.save();
- return String.valueOf(schedulingResource.getSchedulingId());
- } catch (Exception e) {
- logger.error("Error while adding scheduling parameters...", e);
- throw new RegistryException(e);
- }
- }
-
- /**
- * @param dataHandling advanced input data handling object
- * @param ids contains expId and taskId
- * @return data handling id
- */
- public String addInputDataHandling(AdvancedInputDataHandling dataHandling, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
- AdvanceInputDataHandlingResource dataHandlingResource = (AdvanceInputDataHandlingResource) experiment.create(ResourceType.ADVANCE_INPUT_DATA_HANDLING);
- if (ids.getSecondLevelIdentifier() != null) {
- WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = nodeDetailResource.getTaskDetail((String) ids.getSecondLevelIdentifier());
- dataHandlingResource.setTaskId(taskDetail.getTaskId());
- }
- dataHandlingResource.setExperimentId(experiment.getExpID());
- dataHandlingResource.setWorkingDir(dataHandling.getUniqueWorkingDirectory());
- dataHandlingResource.setWorkingDirParent(dataHandling.getParentWorkingDirectory());
- dataHandlingResource.setStageInputFiles(dataHandling.isStageInputFilesToWorkingDir());
- dataHandlingResource.setCleanAfterJob(dataHandling.isCleanUpWorkingDirAfterJob());
- dataHandlingResource.save();
- return String.valueOf(dataHandlingResource.getDataHandlingId());
- } catch (Exception e) {
- logger.error("Error while adding input data handling...", e);
- throw new RegistryException(e);
- }
- }
-
- /**
- * @param dataHandling advanced output data handling object
- * @param ids contains expId and taskId
- * @return data handling id
- */
- public String addOutputDataHandling(AdvancedOutputDataHandling dataHandling, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
- AdvancedOutputDataHandlingResource dataHandlingResource = (AdvancedOutputDataHandlingResource) experiment.create(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING);
- if (ids.getSecondLevelIdentifier() != null) {
- WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = nodeDetailResource.getTaskDetail((String) ids.getSecondLevelIdentifier());
- dataHandlingResource.setTaskId(taskDetail.getTaskId());
- }
- dataHandlingResource.setExperimentId(experiment.getExpID());
- dataHandlingResource.setOutputDataDir(dataHandling.getOutputDataDir());
- dataHandlingResource.setDataRegUrl(dataHandling.getDataRegistryURL());
- dataHandlingResource.setPersistOutputData(dataHandling.isPersistOutputData());
- dataHandlingResource.save();
- return String.valueOf(dataHandlingResource.getOutputDataHandlingId());
- } catch (Exception e) {
- logger.error("Error while adding output data handling...", e);
- throw new RegistryException(e);
- }
- }
-
- public String addQosParams(QualityOfServiceParams qosParams, CompositeIdentifier ids) throws RegistryException {
- try {
- ExperimentResource experiment = gatewayResource.getExperiment((String) ids.getTopLevelIdentifier());
- QosParamResource qosParamResource = (QosParamResource) experiment.create(ResourceType.QOS_PARAM);
- if (ids.getSecondLevelIdentifier() != null) {
- WorkflowNodeDetailResource nodeDetailResource = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- TaskDetailResource taskDetail = nodeDetailResource.getTaskDetail((String) ids.getSecondLevelIdentifier());
- qosParamResource.setTaskId(taskDetail.getTaskId());
- }
- qosParamResource.setExperimentId(experiment.getExpID());
- qosParamResource.setStartExecutionAt(qosParams.getStartExecutionAt());
- qosParamResource.setExecuteBefore(qosParams.getExecuteBefore());
- qosParamResource.setNoOfRetries(qosParams.getNumberofRetries());
- qosParamResource.save();
- return String.valueOf(qosParamResource.getQosId());
- } catch (Exception e) {
- logger.error("Error while adding QOS params...", e);
- throw new RegistryException(e);
- }
- }
-
- public String addErrorDetails(ErrorDetails error, Object id) throws RegistryException {
- try {
-
- ErrorDetailResource errorResource = null;
- ExperimentResource experiment;
- TaskDetailResource taskDetail;
- WorkflowNodeDetailResource workflowNode;
- // figure out the id is an experiment, node task or job
- if (id instanceof String) {
- // FIXME : for .12 we only save task related errors
-// if (isExperimentExist((String) id)) {
-// experiment = gatewayResource.getExperiment((String) id);
-// errorResource = (ErrorDetailResource) experiment.create(ResourceType.ERROR_DETAIL);
-// } else if (isWFNodeExist((String) id)) {
-// experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
-// workflowNode = experiment.getWorkflowNode((String) id);
-// errorResource = (ErrorDetailResource) workflowNode.create(ResourceType.ERROR_DETAIL);
-// errorResource.setExperimentResource(workflowNode.getExperimentResource());
-// } else
- if (isTaskDetailExist((String) id)) {
- experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- taskDetail = workflowNode.getTaskDetail((String) id);
- errorResource = (ErrorDetailResource) taskDetail.create(ResourceType.ERROR_DETAIL);
- if (error.getErrorID() != null && !error.getErrorID().equals(experimentModelConstants.DEFAULT_ID)) {
- List<ErrorDetailResource> errorDetailList = taskDetail.getErrorDetailList();
- if (errorDetailList != null && !errorDetailList.isEmpty()) {
- for (ErrorDetailResource errorDetailResource : errorDetailList) {
- if (errorDetailResource.getErrorId() == Integer.parseInt(error.getErrorID())) {
- errorResource = errorDetailResource;
- }
- }
- }
- }
- errorResource.setTaskId(taskDetail.getTaskId());
- errorResource.setNodeId(taskDetail.getNodeId());
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- errorResource.setExperimentId(workflowNode.getExperimentId());
- } else {
-// logger.error("The id provided is not an experiment id or a workflow id or a task id..");
- }
- } else if (id instanceof CompositeIdentifier) {
- CompositeIdentifier cid = (CompositeIdentifier) id;
- if (isJobDetailExist(cid)) {
- experiment = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
- workflowNode = (WorkflowNodeDetailResource) experiment.create(ResourceType.WORKFLOW_NODE_DETAIL);
- taskDetail = workflowNode.getTaskDetail((String) cid.getTopLevelIdentifier());
- JobDetailResource jobDetail = taskDetail.getJobDetail((String) cid.getSecondLevelIdentifier());
- errorResource = (ErrorDetailResource) jobDetail.create(ResourceType.ERROR_DETAIL);
- if (error.getErrorID() != null && !error.getErrorID().equals(experimentModelConstants.DEFAULT_ID)) {
- List<ErrorDetailResource> errorDetailList = taskDetail.getErrorDetailList();
- if (errorDetailList != null && !errorDetailList.isEmpty()) {
- for (ErrorDetailResource errorDetailResource : errorDetailList) {
- if (errorDetailResource.getErrorId() == Integer.parseInt(error.getErrorID())) {
- errorResource = errorDetailResource;
- }
- }
- }
- }
- errorResource.setTaskId(taskDetail.getTaskId());
- errorResource.setNodeId(taskDetail.getNodeId());
- workflowNode = experiment.getWorkflowNode(taskDetail.getNodeId());
- errorResource.setExperimentId(workflowNode.getExperimentId());
- } else {
- logger.error("The id provided is not a job in the system..");
- }
- } else {
-// logger.error("The id provided is not an experiment id or a workflow id or a task id or a composite " +
-// "identifier for job..");
- }
- if (errorResource != null) {
- errorResource.setCreationTime(AiravataUtils.getTime(error.getCreationTime()));
- errorResource.setActualErrorMsg(error.getActualErrorMessage());
- errorResource.setUserFriendlyErrorMsg(error.getUserFriendlyMessage());
- if (error.getErrorCategory() != null) {
- errorResource.setErrorCategory(error.getErrorCategory().toString());
- }
- errorResource.setTransientPersistent(error.isTransientOrPersistent());
- if (error.getCorrectiveAction() != null) {
- errorResource.setCorrectiveAction(error.getCorrectiveAction().toString());
- } else {
- errorResource.setCorrectiveAction(CorrectiveAction.CONTACT_SUPPORT.toString());
- }
- if (error.getActionableGroup() != null) {
- errorResource.setActionableGroup(error.getActionableGroup().toString());
- } else {
- errorResource.setActionableGroup(ActionableGroup.GATEWAYS_ADMINS.toString());
- }
- errorResource.save();
- return String.valueOf(errorResource.getErrorId());
- }
- } catch (Exception e) {
- logger.error("Unable to add error details...", e);
- throw new RegistryException(e);
- }
- return null;
- }
-
- public String getNodeInstanceID(String nodeName) {
- String node = nodeName.replaceAll("\\s", "");
- return node + "_" + UUID.randomUUID();
- }
-
- public String getExperimentID(String experimentName) {
- String exp = experimentName.replaceAll("\\s", "");
- return exp + "_" +
<TRUNCATED>
[17/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeOutputResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeOutputResource.java
deleted file mode 100644
index 24459b0..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NodeOutputResource.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- *
- * 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.resources;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.NodeOutput;
-import org.apache.airavata.persistance.registry.jpa.model.NodeOutput_PK;
-import org.apache.airavata.persistance.registry.jpa.model.WorkflowNodeDetail;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NodeOutputResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(NodeOutputResource.class);
-
- private String nodeId;
- private String outputKey;
- private String dataType;
- private String value;
- private boolean isRequired;
- private boolean dataMovement;
- private String dataNameLocation;
- private boolean requiredToCMD;
- private String searchQuery;
- private String appArgument;
-
- public String getSearchQuery() {
- return searchQuery;
- }
-
- public void setSearchQuery(String searchQuery) {
- this.searchQuery = searchQuery;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
-
- public boolean getRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean getRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean required) {
- this.isRequired = required;
- }
-
- public boolean isDataMovement() {
- return dataMovement;
- }
-
- public void setDataMovement(boolean dataMovement) {
- this.dataMovement = dataMovement;
- }
-
- public String getDataNameLocation() {
- return dataNameLocation;
- }
-
- public void setDataNameLocation(String dataNameLocation) {
- this.dataNameLocation = dataNameLocation;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for node output data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- NodeOutput existingOutput = em.find(NodeOutput.class, new NodeOutput_PK(outputKey, nodeId));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- NodeOutput nodeOutput = new NodeOutput();
- nodeOutput.setNodeId(nodeId);
- nodeOutput.setOutputKey(outputKey);
- nodeOutput.setDataType(dataType);
- nodeOutput.setValue(value);
- nodeOutput.setRequired(isRequired);
- nodeOutput.setRequiredToCMD(requiredToCMD);
- nodeOutput.setDataMovement(dataMovement);
- nodeOutput.setDataNameLocation(dataNameLocation);
- nodeOutput.setApplicationArgument(appArgument);
- nodeOutput.setSearchQuery(searchQuery);
-
- if (existingOutput != null) {
- existingOutput.setNodeId(nodeId);
- existingOutput.setOutputKey(outputKey);
- existingOutput.setDataType(dataType);
- existingOutput.setValue(value);
- existingOutput.setRequired(isRequired);
- existingOutput.setRequiredToCMD(requiredToCMD);
- existingOutput.setDataMovement(dataMovement);
- existingOutput.setDataNameLocation(dataNameLocation);
- existingOutput.setApplicationArgument(appArgument);
- existingOutput.setSearchQuery(searchQuery);
- nodeOutput = em.merge(existingOutput);
- } else {
- em.persist(nodeOutput);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NotificationEmailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NotificationEmailResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NotificationEmailResource.java
deleted file mode 100644
index fc29b13..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/NotificationEmailResource.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-*
-* 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.*;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class NotificationEmailResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(NotificationEmailResource.class);
-
- private int emailId = 0;
- private String experimentId;
- private String taskId;
- private String emailAddress;
-
-
- public String getEmailAddress() {
- return emailAddress;
- }
-
- public void setEmailAddress(String emailAddress) {
- this.emailAddress = emailAddress;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public Resource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public List<Resource> get(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for experiment input data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Notification_Email notification_email;
- if (emailId != 0 ){
- notification_email = em.find(Notification_Email.class, emailId);
- notification_email.setEmailId(emailId);
- }else {
- notification_email = new Notification_Email();
- }
- notification_email.setExperiment_id(experimentId);
- notification_email.setTaskId(taskId);
- notification_email.setEmailAddress(emailAddress);
- em.persist(notification_email);
- emailId = notification_email.getEmailId();
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
deleted file mode 100644
index 4d73de2..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.*;
-import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.ResultOrderType;
-import org.apache.airavata.registry.cpi.utils.Constants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class ProjectResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ProjectResource.class);
- private String name;
- private String id;
- private String gatewayId;
- private WorkerResource worker;
- private String description;
- private Timestamp creationTime;
-
- /**
- *
- */
- public ProjectResource() {
- }
-
- /**
- *
- * @param type child resource type
- * @return child resource
- */
- public Resource create(ResourceType type) throws RegistryException {
- if (type == ResourceType.EXPERIMENT) {
- ExperimentResource experimentResource = new ExperimentResource();
- experimentResource.setGatewayId(gatewayId);
- experimentResource.setExecutionUser(worker.getUser());
- experimentResource.setProjectId(id);
- return experimentResource;
- } else if (type == ResourceType.PROJECT_USER){
- ProjectUserResource pr = new ProjectUserResource();
- pr.setProjectId(id);
- pr.setUserName(worker.getUser());
- return pr;
- }
- else {
- logger.error("Unsupported resource type for project resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for project resource.");
- }
- }
-
- /**
- *
- * @param type child resource type
- * @param name child resource name
- */
- public void remove(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- if (type == ResourceType.EXPERIMENT) {
- QueryGenerator generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- } else if (type == ResourceType.PROJECT_USER) {
- QueryGenerator generator = new QueryGenerator(PROJECT_USER);
- generator.setParameter(ProjectUserConstants.USERNAME, name);
- generator.setParameter(ProjectUserConstants.PROJECT_ID, this.id);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- } else {
- logger.error("Unsupported resource type for project resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for project resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @param type child resource type
- * @param name child resource name
- * @return child resource
- */
- public Resource get(ResourceType type, Object name) throws RegistryException {
- EntityManager em = null;
- try {
- if (type == ResourceType.EXPERIMENT) {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
- Query q = generator.selectQuery(em);
- Experiment experiment = (Experiment) q.getSingleResult();
- ExperimentResource experimentResource = (ExperimentResource)
- Utils.getResource(ResourceType.EXPERIMENT, experiment);
- em.getTransaction().commit();
- em.close();
- return experimentResource;
- } else if (type == ResourceType.PROJECT_USER) {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(PROJECT_USER);
- generator.setParameter(ProjectUserConstants.USERNAME, name);
- generator.setParameter(ProjectUserConstants.PROJECT_ID, this.id);
- Query q = generator.selectQuery(em);
- ProjectUser prUser = (ProjectUser) q.getSingleResult();
- ExperimentResource experimentResource = (ExperimentResource)
- Utils.getResource(ResourceType.PROJECT_USER, prUser);
- em.getTransaction().commit();
- em.close();
- return experimentResource;
- } else {
- logger.error("Unsupported resource type for project resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for project resource.");
- }
- } catch (Exception e) {
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @param type child resource type
- * @return list of child resources
- */
- @Override
- public List<Resource> get(ResourceType type) throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- if (type == ResourceType.EXPERIMENT) {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.PROJECT_ID, id);
- Query q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Experiment experiment = (Experiment) result;
- ExperimentResource experimentResource = (ExperimentResource)
- Utils.getResource(ResourceType.EXPERIMENT, experiment);
- resourceList.add(experimentResource);
- }
- }
- em.getTransaction().commit();
- em.close();
- } else if (type == ResourceType.PROJECT_USER) {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(PROJECT_USER);
- generator.setParameter(ProjectUserConstants.PROJECT_ID, id);
- Query q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ProjectUser projectUser = (ProjectUser) result;
- ProjectUserResource pr = (ProjectUserResource)
- Utils.getResource(ResourceType.PROJECT_USER, projectUser);
- resourceList.add(pr);
- }
- }
- em.getTransaction().commit();
- em.close();
- } else {
- logger.error("Unsupported resource type for project resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for project resource.");
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- /**
- * Get results with pagination and ordering
- *
- * @param type
- * @param limit
- * @param offset
- * @param orderByIdentifier
- * @return
- * @throws RegistryException
- */
- public List<Resource> get(ResourceType type, int limit, int offset, Object orderByIdentifier,
- ResultOrderType resultOrderType) throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- if (type == ResourceType.EXPERIMENT) {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.PROJECT_ID, id);
- Query q;
- //ordering - supported only by CREATION_TIME
- if(orderByIdentifier != null && resultOrderType != null
- && orderByIdentifier.equals(Constants.FieldConstants.ExperimentConstants.CREATION_TIME)) {
- q = generator.selectQuery(em, ExperimentConstants.CREATION_TIME, resultOrderType);
- }else{
- q = generator.selectQuery(em);
- }
-
- //pagination
- if(limit>0 && offset>=0){
- q.setFirstResult(offset);
- q.setMaxResults(limit);
- }
- List<?> results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Experiment experiment = (Experiment) result;
- ExperimentResource experimentResource = (ExperimentResource)
- Utils.getResource(ResourceType.EXPERIMENT, experiment);
- resourceList.add(experimentResource);
- }
- }
- em.getTransaction().commit();
- em.close();
- } else if (type == ResourceType.PROJECT_USER) {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator = new QueryGenerator(PROJECT_USER);
- generator.setParameter(ProjectUserConstants.PROJECT_ID, id);
- Query q;
- //ordering - only supported only by CREATION_TIME
- if(orderByIdentifier != null && resultOrderType != null
- && orderByIdentifier.equals(Constants.FieldConstants.ProjectConstants.CREATION_TIME)) {
- q = generator.selectQuery(em, ProjectConstants.CREATION_TIME, resultOrderType);
- }else{
- q = generator.selectQuery(em);
- }
-
- //pagination
- if(limit>0 && offset>=0){
- q.setFirstResult(offset);
- q.setMaxResults(limit);
- }
- List<?> results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ProjectUser projectUser = (ProjectUser) result;
- ProjectUserResource pr = (ProjectUserResource)
- Utils.getResource(ResourceType.PROJECT_USER, projectUser);
- resourceList.add(pr);
- }
- }
- em.getTransaction().commit();
- em.close();
- } else {
- logger.error("Unsupported resource type for project resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for project resource.");
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- /**
- * save project to the database
- */
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- Project existingProject = em.find(Project.class, id);
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Project project = new Project();
- project.setProject_id(id);
- project.setProject_name(name);
- project.setGateway_id(gatewayId);
- Users user = em.find(Users.class, worker.getUser());
- project.setUsers(user);
- project.setUser_name(user.getUser_name());
- project.setDescription(description);
- project.setCreationTime(creationTime);
-
- if (existingProject != null) {
- existingProject.setProject_name(name);
- existingProject.setGateway_id(gatewayId);
- existingProject.setUsers(user);
- existingProject.setUser_name(user.getUser_name());
- existingProject.setDescription(description);
- existingProject.setCreationTime(creationTime);
- project = em.merge(existingProject);
- } else {
- em.persist(project);
- }
-
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- *
- * @return project name
- */
- public String getName() {
- return name;
- }
-
- /**
- *
- * @param name project name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- *
- * @return gateway worker
- */
- public WorkerResource getWorker() {
- return worker;
- }
-
- /**
- *
- * @param worker gateway worker
- */
- public void setWorker(WorkerResource worker) {
- this.worker = worker;
- }
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- /**
- *
- * @param experimentId experiment ID
- * @return whether the experiment exist
- */
- public boolean isExperimentExists(String experimentId) throws RegistryException{
- return isExists(ResourceType.EXPERIMENT, experimentId);
- }
-
- /**
- *
- * @param experimentId experiment ID
- * @return experiment resource
- */
- public ExperimentResource createExperiment(String experimentId) throws RegistryException{
- ExperimentResource experimentResource = (ExperimentResource)create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentId);
- return experimentResource;
- }
-
- /**
- *
- * @param experimentId experiment ID
- * @return experiment resource
- */
- public ExperimentResource getExperiment(String experimentId) throws RegistryException{
- return (ExperimentResource)get(ResourceType.EXPERIMENT,experimentId);
- }
-
- /**
- *
- * @return list of experiments
- */
- public List<ExperimentResource> getExperiments() throws RegistryException{
- List<Resource> list = get(ResourceType.EXPERIMENT);
- List<ExperimentResource> result=new ArrayList<ExperimentResource>();
- for (Resource resource : list) {
- result.add((ExperimentResource) resource);
- }
- return result;
- }
-
- public List<ExperimentResource> getExperiments(int limit, int offset, Object orderByIdentifier,
- ResultOrderType resultOrderType) throws RegistryException{
- List<Resource> list = get(ResourceType.EXPERIMENT, limit, offset, orderByIdentifier, resultOrderType);
- List<ExperimentResource> result=new ArrayList<ExperimentResource>();
- for (Resource resource : list) {
- result.add((ExperimentResource) resource);
- }
- return result;
- }
-
- /**
- *
- * @param experimentId experiment ID
- */
- public void removeExperiment(String experimentId) throws RegistryException{
- remove(ResourceType.EXPERIMENT, experimentId);
- }
-
- public List<ProjectUserResource> getProjectUserList () throws RegistryException{
- List<Resource> resources = get(ResourceType.PROJECT_USER);
- List<ProjectUserResource> projectUserResources = new ArrayList<ProjectUserResource>();
- if (resources != null && !resources.isEmpty()){
- for (Resource r : resources){
- projectUserResources.add((ProjectUserResource)r);
- }
- }
- return projectUserResources;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectUserResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectUserResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectUserResource.java
deleted file mode 100644
index dd50b7c..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectUserResource.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.*;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class ProjectUserResource extends AbstractResource {
- private String projectId;
- private String userName;
-
- private static final Logger logger = LoggerFactory.getLogger(ProjectUserResource.class);
-
- public String getProjectId() {
- return projectId;
- }
-
- public void setProjectId(String projectId) {
- this.projectId = projectId;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for project resource data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for project resource data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for project resource data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for project resource data resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- ProjectUser existingPrUser = em.find(ProjectUser.class, new ProjectUser_PK(projectId, userName));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- ProjectUser prUser = new ProjectUser();
- prUser.setProjectID(projectId);
- prUser.setUserName(userName);
- Users user = em.find(Users.class, userName);
- prUser.setUser(user);
- Project project = em.find(Project.class, projectId);
- prUser.setProject(project);
-
- if (existingPrUser != null) {
- existingPrUser.setProjectID(projectId);
- existingPrUser.setUserName(userName);
- existingPrUser.setUser(user);
- existingPrUser.setProject(project);
- prUser = em.merge(existingPrUser);
- } else {
- em.persist(prUser);
- }
-
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/QosParamResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/QosParamResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/QosParamResource.java
deleted file mode 100644
index f9a8b33..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/QosParamResource.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.Experiment;
-import org.apache.airavata.persistance.registry.jpa.model.QosParam;
-import org.apache.airavata.persistance.registry.jpa.model.TaskDetail;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.airavata.registry.cpi.RegistryException;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class QosParamResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(QosParamResource.class);
- private int qosId;
- private String experimentId;
- private String taskId;
- private String startExecutionAt;
- private String executeBefore;
- private int noOfRetries;
-
- public int getQosId() {
- return qosId;
- }
-
- public void setQosId(int qosId) {
- this.qosId = qosId;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getStartExecutionAt() {
- return startExecutionAt;
- }
-
- public void setStartExecutionAt(String startExecutionAt) {
- this.startExecutionAt = startExecutionAt;
- }
-
- public String getExecuteBefore() {
- return executeBefore;
- }
-
- public void setExecuteBefore(String executeBefore) {
- this.executeBefore = executeBefore;
- }
-
- public int getNoOfRetries() {
- return noOfRetries;
- }
-
- public void setNoOfRetries(int noOfRetries) {
- this.noOfRetries = noOfRetries;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for qos params resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for qos params resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for qos params resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for qos params resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QosParam qosParam = new QosParam();
- qosParam.setTaskId(taskId);
- qosParam.setExpId(experimentId);
- qosParam.setStartExecutionAt(startExecutionAt);
- qosParam.setExecuteBefore(executeBefore);
- qosParam.setNoOfRetries(noOfRetries);
- em.persist(qosParam);
- qosId = qosParam.getQosId();
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/StatusResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/StatusResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/StatusResource.java
deleted file mode 100644
index cecf925..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/StatusResource.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.airavata.registry.cpi.RegistryException;
-
-import javax.persistence.EntityManager;
-import java.sql.Timestamp;
-import java.util.List;
-
-public class StatusResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(StatusResource.class);
- private int statusId = 0;
- private String experimentId;
- private String nodeId;
- private String transferId;
- private String taskId;
- private String jobId;
- private String state;
- private Timestamp statusUpdateTime;
- private String statusType;
-
- public int getStatusId() {
- return statusId;
- }
-
- public void setStatusId(int statusId) {
- this.statusId = statusId;
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getTransferId() {
- return transferId;
- }
-
- public void setTransferId(String transferId) {
- this.transferId = transferId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- public Timestamp getStatusUpdateTime() {
- return statusUpdateTime;
- }
-
- public void setStatusUpdateTime(Timestamp statusUpdateTime) {
- this.statusUpdateTime = statusUpdateTime;
- }
-
- public String getStatusType() {
- return statusType;
- }
-
- public void setStatusType(String statusType) {
- this.statusType = statusType;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for status resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for status resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for status resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for status resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Status status;
- if (statusId != 0) {
- status = em.find(Status.class, statusId);
- status.setStatusId(statusId);
- } else {
- status = new Status();
- }
- status.setExpId(experimentId);
- status.setTaskId(taskId);
- status.setNodeId(nodeId);
- status.setTransferId(transferId);
- status.setJobId(jobId);
- status.setState(state);
- status.setStatusUpdateTime(statusUpdateTime);
- status.setStatusType(statusType);
- em.persist(status);
- statusId = status.getStatusId();
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
deleted file mode 100644
index 995704e..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
+++ /dev/null
@@ -1,748 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.*;
-import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.utils.StatusType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-public class TaskDetailResource extends AbstractResource {
- private static final Logger logger = LoggerFactory.getLogger(TaskDetailResource.class);
- private String taskId;
- private String nodeId;
- private Timestamp creationTime;
- private String applicationId;
- private String applicationVersion;
- private String applicationDeploymentId;
- private boolean enableEmailNotifications;
- private List<ApplicationInputResource> applicationInputs;
- private List<ApplicationOutputResource> applicationOutputs;
- private ComputationSchedulingResource schedulingResource;
- private AdvanceInputDataHandlingResource inputDataHandlingResource;
- private AdvancedOutputDataHandlingResource outputDataHandlingResource;
- private StatusResource taskStatus;
- private List<JobDetailResource> jobDetailResources;
- private List<DataTransferDetailResource> transferDetailResourceList;
- private List<NotificationEmailResource> emailResourceList;
- private List<ErrorDetailResource> errors;
-
- public List<JobDetailResource> getJobDetailResources() {
- return jobDetailResources;
- }
-
- public void setJobDetailResources(List<JobDetailResource> jobDetailResources) {
- this.jobDetailResources = jobDetailResources;
- }
-
- public void setApplicationInputs(List<ApplicationInputResource> applicationInputs) {
- this.applicationInputs = applicationInputs;
- }
-
- public void setApplicationOutputs(List<ApplicationOutputResource> applicationOutputs) {
- this.applicationOutputs = applicationOutputs;
- }
-
- public ComputationSchedulingResource getSchedulingResource() {
- return schedulingResource;
- }
-
- public void setSchedulingResource(ComputationSchedulingResource schedulingResource) {
- this.schedulingResource = schedulingResource;
- }
-
- public AdvanceInputDataHandlingResource getInputDataHandlingResource() {
- return inputDataHandlingResource;
- }
-
- public void setInputDataHandlingResource(AdvanceInputDataHandlingResource inputDataHandlingResource) {
- this.inputDataHandlingResource = inputDataHandlingResource;
- }
-
- public AdvancedOutputDataHandlingResource getOutputDataHandlingResource() {
- return outputDataHandlingResource;
- }
-
- public void setOutputDataHandlingResource(AdvancedOutputDataHandlingResource outputDataHandlingResource) {
- this.outputDataHandlingResource = outputDataHandlingResource;
- }
-
- public void setTaskStatus(StatusResource taskStatus) {
- this.taskStatus = taskStatus;
- }
-
- public List<DataTransferDetailResource> getTransferDetailResourceList() {
- return transferDetailResourceList;
- }
-
- public void setTransferDetailResourceList(List<DataTransferDetailResource> transferDetailResourceList) {
- this.transferDetailResourceList = transferDetailResourceList;
- }
-
- public List<NotificationEmailResource> getEmailResourceList() {
- return emailResourceList;
- }
-
- public void setEmailResourceList(List<NotificationEmailResource> emailResourceList) {
- this.emailResourceList = emailResourceList;
- }
-
- public List<ErrorDetailResource> getErrors() {
- return errors;
- }
-
- public void setErrors(List<ErrorDetailResource> errors) {
- this.errors = errors;
- }
-
- public boolean isEnableEmailNotifications() {
- return enableEmailNotifications;
- }
-
- public void setEnableEmailNotifications(boolean enableEmailNotifications) {
- this.enableEmailNotifications = enableEmailNotifications;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public Timestamp getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Timestamp creationTime) {
- this.creationTime = creationTime;
- }
-
- public String getApplicationId() {
- return applicationId;
- }
-
- public void setApplicationId(String applicationId) {
- this.applicationId = applicationId;
- }
-
- public String getApplicationVersion() {
- return applicationVersion;
- }
-
- public void setApplicationVersion(String applicationVersion) {
- this.applicationVersion = applicationVersion;
- }
-
-
- public Resource create(ResourceType type) throws RegistryException{
- switch (type){
- case ERROR_DETAIL:
- ErrorDetailResource errorDetailResource = new ErrorDetailResource();
- errorDetailResource.setTaskId(taskId);
- return errorDetailResource;
- case NOTIFICATION_EMAIL:
- NotificationEmailResource emailResource = new NotificationEmailResource();
- emailResource.setTaskId(taskId);
- return emailResource;
- case APPLICATION_INPUT:
- ApplicationInputResource applicationInputResource = new ApplicationInputResource();
- applicationInputResource.setTaskId(taskId);
- return applicationInputResource;
- case APPLICATION_OUTPUT:
- ApplicationOutputResource applicationOutputResource = new ApplicationOutputResource();
- applicationOutputResource.setTaskId(taskId);
- return applicationOutputResource;
- case JOB_DETAIL:
- JobDetailResource jobDetailResource = new JobDetailResource();
- jobDetailResource.setTaskId(taskId);
- return jobDetailResource;
- case DATA_TRANSFER_DETAIL:
- DataTransferDetailResource dataTransferDetailResource = new DataTransferDetailResource();
- dataTransferDetailResource.setTaskId(taskId);
- return dataTransferDetailResource;
- case STATUS:
- StatusResource statusResource = new StatusResource();
- statusResource.setTaskId(taskId);
- return statusResource;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- ComputationSchedulingResource schedulingResource = new ComputationSchedulingResource();
- schedulingResource.setTaskId(taskId);
- return schedulingResource;
- case ADVANCE_INPUT_DATA_HANDLING:
- AdvanceInputDataHandlingResource inputDataHandlingResource = new AdvanceInputDataHandlingResource();
- inputDataHandlingResource.setTaskId(taskId);
- return inputDataHandlingResource;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- AdvancedOutputDataHandlingResource outputDataHandlingResource = new AdvancedOutputDataHandlingResource();
- outputDataHandlingResource.setTaskId(taskId);
- return outputDataHandlingResource;
- case QOS_PARAM:
- QosParamResource qosParamResource = new QosParamResource();
- qosParamResource.setTaskId(taskId);
- return qosParamResource;
- default:
- logger.error("Unsupported resource type for task detail resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for task detail resource.");
- }
- }
-
-
- public void remove(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- switch (type) {
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case NOTIFICATION_EMAIL:
- generator = new QueryGenerator(NOTIFICATION_EMAIL);
- generator.setParameter(NotificationEmailConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case APPLICATION_INPUT:
- generator = new QueryGenerator(APPLICATION_INPUT);
- generator.setParameter(ApplicationInputConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case APPLICATION_OUTPUT:
- generator = new QueryGenerator(APPLICATION_OUTPUT);
- generator.setParameter(ApplicationOutputConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case JOB_DETAIL:
- generator = new QueryGenerator(JOB_DETAIL);
- generator.setParameter(JobDetailConstants.TASK_ID, taskId);
- generator.setParameter(JobDetailConstants.JOB_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case DATA_TRANSFER_DETAIL:
- generator = new QueryGenerator(DATA_TRANSFER_DETAIL);
- generator.setParameter(DataTransferDetailConstants.TRANSFER_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.TASK_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.TASK.toString());
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- generator = new QueryGenerator(COMPUTATIONAL_RESOURCE_SCHEDULING);
- generator.setParameter(ComputationalResourceSchedulingConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ADVANCE_INPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_INPUT_DATA_HANDLING);
- generator.setParameter(AdvancedInputDataHandlingConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_OUTPUT_DATA_HANDLING);
- generator.setParameter(AdvancedOutputDataHandlingConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case QOS_PARAM:
- generator = new QueryGenerator(QOS_PARAMS);
- generator.setParameter(QosParamsConstants.TASK_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- default:
- logger.error("Unsupported resource type for task detail resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public Resource get(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- ErrorDetail errorDetail = (ErrorDetail) q.getSingleResult();
- ErrorDetailResource errorDetailResource = (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- em.getTransaction().commit();
- em.close();
- return errorDetailResource;
- case NOTIFICATION_EMAIL:
- generator = new QueryGenerator(NOTIFICATION_EMAIL);
- generator.setParameter(NotificationEmailConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- Notification_Email notificationEmail = (Notification_Email) q.getSingleResult();
- NotificationEmailResource emailResource = (NotificationEmailResource) Utils.getResource(ResourceType.NOTIFICATION_EMAIL, notificationEmail);
- em.getTransaction().commit();
- em.close();
- return emailResource;
- case APPLICATION_INPUT:
- generator = new QueryGenerator(APPLICATION_INPUT);
- generator.setParameter(ApplicationInputConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- ApplicationInput applicationInput = (ApplicationInput) q.getSingleResult();
- ApplicationInputResource inputResource = (ApplicationInputResource) Utils.getResource(ResourceType.APPLICATION_INPUT, applicationInput);
- em.getTransaction().commit();
- em.close();
- return inputResource;
- case APPLICATION_OUTPUT:
- generator = new QueryGenerator(APPLICATION_OUTPUT);
- generator.setParameter(ApplicationOutputConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- ApplicationOutput applicationOutput = (ApplicationOutput) q.getSingleResult();
- ApplicationOutputResource outputResource = (ApplicationOutputResource) Utils.getResource(ResourceType.APPLICATION_OUTPUT, applicationOutput);
- em.getTransaction().commit();
- em.close();
- return outputResource;
- case JOB_DETAIL:
- generator = new QueryGenerator(JOB_DETAIL);
- generator.setParameter(JobDetailConstants.JOB_ID, name);
- generator.setParameter(JobDetailConstants.TASK_ID, taskId);
- q = generator.selectQuery(em);
- JobDetail jobDetail = (JobDetail) q.getSingleResult();
- JobDetailResource jobDetailResource = (JobDetailResource) Utils.getResource(ResourceType.JOB_DETAIL, jobDetail);
- em.getTransaction().commit();
- em.close();
- return jobDetailResource;
- case DATA_TRANSFER_DETAIL:
- generator = new QueryGenerator(DATA_TRANSFER_DETAIL);
- generator.setParameter(DataTransferDetailConstants.TRANSFER_ID, name);
- q = generator.selectQuery(em);
- DataTransferDetail transferDetail = (DataTransferDetail) q.getSingleResult();
- DataTransferDetailResource transferDetailResource = (DataTransferDetailResource) Utils.getResource(ResourceType.DATA_TRANSFER_DETAIL, transferDetail);
- em.getTransaction().commit();
- em.close();
- return transferDetailResource;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.TASK_ID, name);
- generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.TASK.toString());
- q = generator.selectQuery(em);
- Status status = (Status) q.getSingleResult();
- StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- em.getTransaction().commit();
- em.close();
- return statusResource;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- generator = new QueryGenerator(COMPUTATIONAL_RESOURCE_SCHEDULING);
- generator.setParameter(ComputationalResourceSchedulingConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- Computational_Resource_Scheduling resourceScheduling = (Computational_Resource_Scheduling) q.getSingleResult();
- ComputationSchedulingResource schedulingResource = (ComputationSchedulingResource) Utils.getResource(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, resourceScheduling);
- em.getTransaction().commit();
- em.close();
- return schedulingResource;
- case ADVANCE_INPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_INPUT_DATA_HANDLING);
- generator.setParameter(AdvancedInputDataHandlingConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- AdvancedInputDataHandling dataHandling = (AdvancedInputDataHandling) q.getSingleResult();
- AdvanceInputDataHandlingResource inputDataHandlingResource = (AdvanceInputDataHandlingResource) Utils.getResource(ResourceType.ADVANCE_INPUT_DATA_HANDLING, dataHandling);
- em.getTransaction().commit();
- em.close();
- return inputDataHandlingResource;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- generator = new QueryGenerator(ADVANCE_OUTPUT_DATA_HANDLING);
- generator.setParameter(AdvancedOutputDataHandlingConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- AdvancedOutputDataHandling outputDataHandling = (AdvancedOutputDataHandling) q.getSingleResult();
- AdvancedOutputDataHandlingResource outputDataHandlingResource = (AdvancedOutputDataHandlingResource) Utils.getResource(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, outputDataHandling);
- em.getTransaction().commit();
- em.close();
- return outputDataHandlingResource;
- case QOS_PARAM:
- generator = new QueryGenerator(QOS_PARAMS);
- generator.setParameter(QosParamsConstants.TASK_ID, name);
- q = generator.selectQuery(em);
- QosParam qosParam = (QosParam) q.getSingleResult();
- QosParamResource qosParamResource = (QosParamResource) Utils.getResource(ResourceType.QOS_PARAM, qosParam);
- em.getTransaction().commit();
- em.close();
- return qosParamResource;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for workflow node resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for workflow node resource.");
- }
- } catch (Exception e) {
-// logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public List<Resource> get(ResourceType type) throws RegistryException{
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- List results;
- switch (type) {
- case ERROR_DETAIL:
- generator = new QueryGenerator(ERROR_DETAIL);
- generator.setParameter(ErrorDetailConstants.TASK_ID, taskId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ErrorDetail errorDetail = (ErrorDetail) result;
- ErrorDetailResource errorDetailResource =
- (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
- resourceList.add(errorDetailResource);
- }
- }
- break;
- case NOTIFICATION_EMAIL:
- generator = new QueryGenerator(NOTIFICATION_EMAIL);
- generator.setParameter(NotificationEmailConstants.TASK_ID, taskId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Notification_Email notificationEmail = (Notification_Email) result;
- NotificationEmailResource emailResource =
- (NotificationEmailResource) Utils.getResource(ResourceType.NOTIFICATION_EMAIL, notificationEmail);
- resourceList.add(emailResource);
- }
- }
- break;
- case APPLICATION_INPUT:
- generator = new QueryGenerator(APPLICATION_INPUT);
- generator.setParameter(ApplicationInputConstants.TASK_ID, taskId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInput applicationInput = (ApplicationInput) result;
- ApplicationInputResource inputResource =
- (ApplicationInputResource) Utils.getResource(ResourceType.APPLICATION_INPUT, applicationInput);
- resourceList.add(inputResource);
- }
- }
- break;
- case APPLICATION_OUTPUT:
- generator = new QueryGenerator(APPLICATION_OUTPUT);
- generator.setParameter(ApplicationOutputConstants.TASK_ID, taskId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationOutput applicationOutput = (ApplicationOutput) result;
- ApplicationOutputResource outputResource =
- (ApplicationOutputResource) Utils.getResource(ResourceType.APPLICATION_OUTPUT, applicationOutput);
- resourceList.add(outputResource);
- }
- }
- break;
- case JOB_DETAIL:
- generator = new QueryGenerator(JOB_DETAIL);
- generator.setParameter(JobDetailConstants.TASK_ID, taskId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- JobDetail jobDetail = (JobDetail) result;
- JobDetailResource jobDetailResource =
- (JobDetailResource) Utils.getResource(ResourceType.JOB_DETAIL, jobDetail);
- resourceList.add(jobDetailResource);
- }
- }
- break;
- case DATA_TRANSFER_DETAIL:
- generator = new QueryGenerator(DATA_TRANSFER_DETAIL);
- generator.setParameter(DataTransferDetailConstants.TASK_ID, taskId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- DataTransferDetail transferDetail = (DataTransferDetail) result;
- DataTransferDetailResource transferDetailResource =
- (DataTransferDetailResource) Utils.getResource(ResourceType.DATA_TRANSFER_DETAIL, transferDetail);
- resourceList.add(transferDetailResource);
- }
- }
- break;
- case STATUS:
- generator = new QueryGenerator(STATUS);
- generator.setParameter(StatusConstants.TASK_ID, taskId);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Status status = (Status) result;
- StatusResource statusResource =
- (StatusResource) Utils.getResource(ResourceType.STATUS, status);
- resourceList.add(statusResource);
- }
- }
- break;
- default:
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported resource type for workflow node details resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
-
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- TaskDetail taskDetail = em.find(TaskDetail.class, taskId);
- em.close();
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- if (taskDetail != null) {
- updateTaskDetail(taskDetail, nodeId);
- em.merge(taskDetail);
- } else {
- taskDetail = new TaskDetail();
- updateTaskDetail(taskDetail, nodeId);
- em.persist(taskDetail);
- }
- em.getTransaction().commit();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- private void updateTaskDetail(TaskDetail taskDetail, String nodeId) {
- taskDetail.setTaskId(taskId);
- taskDetail.setNodeId(nodeId);
- taskDetail.setCreationTime(creationTime);
- taskDetail.setAppId(applicationId);
- taskDetail.setAppVersion(applicationVersion);
- taskDetail.setAllowNotification(enableEmailNotifications);
- taskDetail.setApplicationDeploymentId(getApplicationDeploymentId());
- }
-
- public List<ApplicationInputResource> getApplicationInputs() {
- return applicationInputs;
- }
-
- public List<ApplicationOutputResource> getApplicationOutputs() {
- return applicationOutputs;
- }
-
- public List<ApplicationInputResource> getApplicationInputs1() throws RegistryException{
- List<ApplicationInputResource> applicationInputResources = new ArrayList<ApplicationInputResource>();
- List<Resource> resources = get(ResourceType.APPLICATION_INPUT);
- for (Resource resource : resources) {
- ApplicationInputResource inputResource = (ApplicationInputResource) resource;
- applicationInputResources.add(inputResource);
- }
- return applicationInputResources;
- }
-
- public List<ApplicationOutputResource> getApplicationOutputs1() throws RegistryException{
- List<ApplicationOutputResource> outputResources = new ArrayList<ApplicationOutputResource>();
- List<Resource> resources = get(ResourceType.APPLICATION_OUTPUT);
- for (Resource resource : resources) {
- ApplicationOutputResource outputResource = (ApplicationOutputResource) resource;
- outputResources.add(outputResource);
- }
- return outputResources;
- }
-
- public StatusResource getTaskStatus() {
- return taskStatus;
- }
-
- public StatusResource getTaskStatus1() throws RegistryException{
- List<Resource> resources = get(ResourceType.STATUS);
- for (Resource resource : resources) {
- StatusResource taskStatus = (StatusResource) resource;
- if(taskStatus.getStatusType().equals(StatusType.TASK.toString())){
- if (taskStatus.getState() == null || taskStatus.getState().equals("") ){
- taskStatus.setState("UNKNOWN");
- }
- return taskStatus;
- }
- }
- return null;
- }
-
- public List<JobDetailResource> getJobDetailList() throws RegistryException{
- List<JobDetailResource> jobDetailResources = new ArrayList<JobDetailResource>();
- List<Resource> resources = get(ResourceType.JOB_DETAIL);
- for (Resource resource : resources) {
- JobDetailResource jobDetailResource = (JobDetailResource) resource;
- jobDetailResources.add(jobDetailResource);
- }
- return jobDetailResources;
- }
-
- public List<DataTransferDetailResource> getDataTransferDetailList() throws RegistryException{
- List<DataTransferDetailResource> transferDetails = new ArrayList<DataTransferDetailResource>();
- List<Resource> resources = get(ResourceType.DATA_TRANSFER_DETAIL);
- for (Resource resource : resources) {
- DataTransferDetailResource transferDetailResource = (DataTransferDetailResource) resource;
- transferDetails.add(transferDetailResource);
- }
- return transferDetails;
- }
-
- public List<ErrorDetailResource> getErrorDetailList() throws RegistryException{
- List<ErrorDetailResource> errorDetailResources = new ArrayList<ErrorDetailResource>();
- List<Resource> resources = get(ResourceType.ERROR_DETAIL);
- for (Resource resource : resources) {
- ErrorDetailResource errorDetailResource = (ErrorDetailResource) resource;
- errorDetailResources.add(errorDetailResource);
- }
- return errorDetailResources;
- }
-
- public ComputationSchedulingResource getComputationScheduling (String taskId) throws RegistryException{
- return (ComputationSchedulingResource)get(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, taskId);
- }
-
- public AdvanceInputDataHandlingResource getInputDataHandling (String taskId) throws RegistryException{
- return (AdvanceInputDataHandlingResource)get(ResourceType.ADVANCE_INPUT_DATA_HANDLING, taskId);
- }
-
- public AdvancedOutputDataHandlingResource getOutputDataHandling (String taskId) throws RegistryException{
- return (AdvancedOutputDataHandlingResource)get(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, taskId);
- }
-
- public JobDetailResource createJobDetail (String jobId) throws RegistryException{
- JobDetailResource resource = (JobDetailResource)create(ResourceType.JOB_DETAIL);
- resource.setJobId(jobId);
- return resource;
- }
-
- public JobDetailResource getJobDetail (String jobId) throws RegistryException{
- return (JobDetailResource)get(ResourceType.JOB_DETAIL, jobId);
- }
-
- public DataTransferDetailResource getDataTransferDetail (String dataTransferId) throws RegistryException{
- return (DataTransferDetailResource)get(ResourceType.DATA_TRANSFER_DETAIL, dataTransferId);
- }
-
- public boolean isTaskStatusExist (String taskId) throws RegistryException{
- return isExists(ResourceType.STATUS, taskId);
- }
-
- public String getApplicationDeploymentId() {
- return applicationDeploymentId;
- }
-
- public void setApplicationDeploymentId(String applicationDeploymentId) {
- this.applicationDeploymentId = applicationDeploymentId;
- }
-
- public List<NotificationEmailResource> getNotificationEmails () throws RegistryException{
- List<NotificationEmailResource> emailResources = new ArrayList<NotificationEmailResource>();
- List<Resource> resources = get(ResourceType.NOTIFICATION_EMAIL);
- for (Resource resource : resources) {
- emailResources.add((NotificationEmailResource) resource);
- }
- return emailResources;
- }
-}
[12/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceUtils.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceUtils.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceUtils.java
new file mode 100644
index 0000000..a8d8e83
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/ResourceUtils.java
@@ -0,0 +1,525 @@
+/*
+ *
+ * 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.experiment.catalog;
+
+import org.apache.airavata.experiment.catalog.model.*;
+import org.apache.airavata.experiment.catalog.resources.*;
+import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ResourceUtils {
+ private final static Logger logger = LoggerFactory.getLogger(ResourceUtils.class);
+ private static final String PERSISTENCE_UNIT_NAME = "airavata_data";
+ protected static EntityManagerFactory factory;
+
+ public static void reset(){
+ factory=null;
+ }
+
+ public static EntityManager getEntityManager(){
+ if (factory == null) {
+ String connectionProperties = "DriverClassName=" + Utils.getJDBCDriver() + "," + "Url=" + Utils.getJDBCURL() + "?autoReconnect=true,," +
+ "Username=" + Utils.getJDBCUser() + "," + "Password=" + Utils.getJDBCPassword() + ",validationQuery=" +
+ Utils.getValidationQuery();
+ System.out.println(connectionProperties);
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource");
+ properties.put("openjpa.ConnectionProperties", connectionProperties);
+ properties.put("openjpa.DynamicEnhancementAgent", "true");
+ properties.put("openjpa.RuntimeUnenhancedClasses", "unsupported");
+ properties.put("openjpa.DataCache","" + Utils.isCachingEnabled() + "(CacheSize=" + Utils.getJPACacheSize() + ", SoftReferenceSize=0)");
+ properties.put("openjpa.QueryCache","" + Utils.isCachingEnabled() + "(CacheSize=" + Utils.getJPACacheSize() + ", SoftReferenceSize=0)");
+ properties.put("openjpa.RemoteCommitProvider","sjvm");
+ properties.put("openjpa.Log","DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO");
+ properties.put("openjpa.jdbc.DBDictionary","SupportsMultipleNontransactionalResultSets=false");
+// properties.put("openjpa.ReadLockLevel", "none");
+// properties.put("openjpa.WriteLockLevel", "none");
+// properties.put("openjpa.LockTimeout", "30000");
+// properties.put("openjpa.LockManager", "none");
+ properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
+ properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000, autoReconnect=true");
+ properties.put("openjpa.jdbc.QuerySQLCache", "false");
+ factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
+ }
+ return factory.createEntityManager();
+ }
+
+ /**
+ * @param gatewayId
+ * @return
+ */
+ public static Resource createGateway(String gatewayId) throws RegistryException {
+ if (!isGatewayExist(gatewayId)) {
+ GatewayResource gatewayResource = new GatewayResource();
+ gatewayResource.setGatewayId(gatewayId);
+ return gatewayResource;
+ }else {
+ return getGateway(gatewayId);
+ }
+ }
+
+ public static UserResource createUser(String username, String password) throws RegistryException {
+ if (!isUserExist(username)) {
+ UserResource userResource = new UserResource();
+ userResource.setUserName(username);
+ userResource.setPassword(password);
+ return userResource;
+ }else {
+ return (UserResource)getUser(username);
+ }
+
+ }
+
+ public static Resource getGateway(String gatewayId) throws RegistryException{
+ EntityManager em = null;
+ try {
+ if (isGatewayExist(gatewayId)) {
+ em = getEntityManager();
+ Gateway gateway = em.find(Gateway.class, gatewayId);
+ GatewayResource gatewayResource = (GatewayResource)Utils.getResource(ResourceType.GATEWAY, gateway);
+ em.close();
+ return gatewayResource;
+ }
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return null;
+ }
+
+ public static void addUser (String userName, String password) throws RegistryException{
+ UserResource resource = new UserResource();
+ resource.setUserName(userName);
+ resource.setPassword(password);
+ resource.save();
+ }
+
+ public static boolean isUserExist (String username) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(AbstractResource.USERS);
+ generator.setParameter(AbstractResource.UserConstants.USERNAME, username);
+ Query q = generator.selectQuery(em);
+ int size = q.getResultList().size();
+ em.getTransaction().commit();
+ em.close();
+ return size>0;
+ } catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+
+ public static Resource getUser(String userName) throws RegistryException{
+ EntityManager em = null;
+ try {
+ if (isUserExist(userName)) {
+ em = getEntityManager();
+ Users user = em.find(Users.class, userName);
+ UserResource userResource = (UserResource)Utils.getResource(ResourceType.USER, user);
+ em.close();
+ return userResource;
+ }
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return null;
+
+ }
+
+ public static Resource getWorker(String gatewayId, String userName) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = getEntityManager();
+ Gateway_Worker gatewayWorker = em.find(Gateway_Worker.class, new Gateway_Worker_PK(gatewayId, userName));
+ WorkerResource workerResource = (WorkerResource) Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
+ em.close();
+ return workerResource;
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+
+
+ }
+
+
+ /**
+ * @param gatewayId
+ * @return
+ */
+ public static boolean isGatewayExist(String gatewayId) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(AbstractResource.GATEWAY);
+ generator.setParameter(AbstractResource.GatewayConstants.GATEWAY_ID, gatewayId);
+ Query q = generator.selectQuery(em);
+ int size = q.getResultList().size();
+ em.getTransaction().commit();
+ em.close();
+ return size>0;
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+
+ }
+
+ public static List<Resource> getAllGateways() throws RegistryException{
+ List<Resource> resourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(AbstractResource.GATEWAY);
+ Query q = generator.selectQuery(em);
+ List results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Gateway gateway = (Gateway) result;
+ GatewayResource gatewayResource =
+ (GatewayResource) Utils.getResource(ResourceType.GATEWAY, gateway);
+ resourceList.add(gatewayResource);
+ }
+ }
+ em.getTransaction().commit();
+ em.close();
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return resourceList;
+ }
+
+ /**
+ * @param gatewayId
+ * @return
+ */
+ public static boolean removeGateway(String gatewayId) {
+ EntityManager em = null;
+ try {
+ em = getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(AbstractResource.GATEWAY);
+ generator.setParameter(AbstractResource.GatewayConstants.GATEWAY_ID, gatewayId);
+ Query q = generator.deleteQuery(em);
+ q.executeUpdate();
+ em.getTransaction().commit();
+ em.close();
+ return true;
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ return false;
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ /**
+ * @param gatewayResource
+ * @param userResource
+ */
+ public static WorkerResource addGatewayWorker(GatewayResource gatewayResource, UserResource userResource) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = getEntityManager();
+ em.getTransaction().begin();
+ if (!isGatewayExist(gatewayResource.getGatewayName())){
+ gatewayResource.save();
+ }
+ if (!isUserExist(userResource.getUserName())){
+ userResource.save();
+ }
+ Gateway gateway = em.find(Gateway.class, gatewayResource.getGatewayId());
+ Users user = em.find(Users.class, userResource.getUserName());
+ Gateway_Worker gatewayWorker = new Gateway_Worker();
+ gatewayWorker.setGateway(gateway);
+ gatewayWorker.setUser(user);
+ em.persist(gatewayWorker);
+ em.getTransaction().commit();
+ em.close();
+ return (WorkerResource)Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
+ } catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ /**
+ * @param gatewayResource
+ * @param userResource
+ * @return
+ */
+ public static boolean removeGatewayWorker(GatewayResource gatewayResource, UserResource userResource) {
+ EntityManager em = null;
+ try {
+ em = getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(AbstractResource.GATEWAY_WORKER);
+ generator.setParameter(AbstractResource.GatewayWorkerConstants.GATEWAY_ID,
+ gatewayResource.getGatewayName());
+ generator.setParameter(AbstractResource.UserConstants.USERNAME, userResource.getUserName());
+ Query q = generator.deleteQuery(em);
+ q.executeUpdate();
+ em.getTransaction().commit();
+ em.close();
+ return true;
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ return false;
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+
+ }
+
+ /**
+ * @param configKey
+ * @return
+ */
+ public static List<ConfigurationResource> getConfigurations(String configKey){
+ List<ConfigurationResource> list = new ArrayList<ConfigurationResource>();
+ EntityManager em = null;
+ try {
+ em = getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator = new QueryGenerator(AbstractResource.CONFIGURATION);
+ generator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_KEY, configKey);
+ Query q = generator.selectQuery(em);
+ List<?> resultList = q.getResultList();
+ if (resultList.size() != 0) {
+ for (Object result : resultList) {
+ ConfigurationResource configurationResource = createConfigurationResourceObject(result);
+ list.add(configurationResource);
+ }
+ }
+ em.getTransaction().commit();
+ em.close();
+ }catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return list;
+ }
+
+ /**
+ * @param configKey
+ * @return
+ */
+ public static ConfigurationResource getConfiguration(String configKey){
+ List<ConfigurationResource> configurations = getConfigurations(configKey);
+ return (configurations != null && configurations.size() > 0) ? configurations.get(0) : null;
+ }
+
+ /**
+ * @param configKey
+ * @return
+ */
+ public static boolean isConfigurationExist(String configKey){
+ List<ConfigurationResource> configurations = getConfigurations(configKey);
+ return (configurations != null && configurations.size() > 0);
+ }
+
+ /**
+ * @param configKey
+ * @return
+ */
+ public static ConfigurationResource createConfiguration(String configKey) {
+ ConfigurationResource config = new ConfigurationResource();
+ config.setConfigKey(configKey);
+ return config;
+ }
+
+ /**
+ * @param result
+ * @return
+ */
+ private static ConfigurationResource createConfigurationResourceObject(
+ Object result) {
+ Configuration configuration = (Configuration) result;
+ ConfigurationResource configurationResource = new ConfigurationResource(configuration.getConfig_key(), configuration.getConfig_val());
+ configurationResource.setExpireDate(configuration.getExpire_date());
+ return configurationResource;
+ }
+
+ /**
+ * @param configkey
+ * @param configValue
+ */
+ public static void removeConfiguration(String configkey, String configValue) throws RegistryException{
+ QueryGenerator queryGenerator = new QueryGenerator(AbstractResource.CONFIGURATION);
+ queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_KEY, configkey);
+ queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_VAL, configValue);
+ EntityManager em = null;
+ try {
+ if(isConfigurationExists(configkey, configValue)){
+ em = getEntityManager();
+ em.getTransaction().begin();
+ Query q = queryGenerator.deleteQuery(em);
+ q.executeUpdate();
+ em.getTransaction().commit();
+ em.close();
+ }
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ /**
+ * @param configkey
+ */
+ public static void removeConfiguration(String configkey) throws RegistryException{
+ QueryGenerator queryGenerator = new QueryGenerator(AbstractResource.CONFIGURATION);
+ queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_KEY, configkey);
+ EntityManager em = null;
+ try {
+ if(isConfigurationExist(configkey)){
+ em = getEntityManager();
+ em.getTransaction().begin();
+ Query q = queryGenerator.deleteQuery(em);
+ q.executeUpdate();
+ em.getTransaction().commit();
+ em.close();
+ }
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public static boolean isConfigurationExists(String configKey, String configVal) throws RegistryException{
+ EntityManager em = null;
+ try{
+ //Currently categoryID is hardcoded value
+ em = ResourceUtils.getEntityManager();
+ Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey, configVal, AbstractResource.ConfigurationConstants.CATEGORY_ID_DEFAULT_VALUE));
+ em.close();
+ return existing!= null;
+ } catch (Exception e){
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ }finally {
+ if (em != null && em.isOpen()){
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+}
[03/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/WorkflowNodeDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/WorkflowNodeDetailResource.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/WorkflowNodeDetailResource.java
new file mode 100644
index 0000000..47bd072
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/resources/WorkflowNodeDetailResource.java
@@ -0,0 +1,515 @@
+/*
+ *
+ * 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.experiment.catalog.resources;
+
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.ResourceUtils;
+import org.apache.airavata.experiment.catalog.model.*;
+import org.apache.airavata.experiment.catalog.utils.QueryGenerator;
+import org.apache.airavata.registry.cpi.utils.StatusType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.airavata.registry.cpi.RegistryException;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+public class WorkflowNodeDetailResource extends AbstractResource {
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowNodeDetailResource.class);
+ private String experimentId;
+ private String nodeInstanceId;
+ private Timestamp creationTime;
+ private String nodeName;
+ private String executionUnit;
+ private String executionUnitData;
+ private List<TaskDetailResource> taskDetailResourceList;
+ private List<NodeInputResource> nodeInputs;
+ private List<NodeOutputResource> nodeOutputs;
+ private StatusResource nodeStatus;
+ private List<ErrorDetailResource> erros;
+
+ public List<TaskDetailResource> getTaskDetailResourceList() {
+ return taskDetailResourceList;
+ }
+
+ public void setTaskDetailResourceList(List<TaskDetailResource> taskDetailResourceList) {
+ this.taskDetailResourceList = taskDetailResourceList;
+ }
+
+ public void setNodeInputs(List<NodeInputResource> nodeInputs) {
+ this.nodeInputs = nodeInputs;
+ }
+
+ public void setNodeOutputs(List<NodeOutputResource> nodeOutputs) {
+ this.nodeOutputs = nodeOutputs;
+ }
+
+ public StatusResource getNodeStatus() {
+ return nodeStatus;
+ }
+
+ public void setNodeStatus(StatusResource nodeStatus) {
+ this.nodeStatus = nodeStatus;
+ }
+
+ public List<ErrorDetailResource> getErros() {
+ return erros;
+ }
+
+ public void setErros(List<ErrorDetailResource> erros) {
+ this.erros = erros;
+ }
+
+ public String getExperimentId() {
+ return experimentId;
+ }
+
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
+ }
+
+ public String getNodeInstanceId() {
+ return nodeInstanceId;
+ }
+
+ public void setNodeInstanceId(String nodeInstanceId) {
+ this.nodeInstanceId = nodeInstanceId;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getNodeName() {
+ return nodeName;
+ }
+
+ public void setNodeName(String nodeName) {
+ this.nodeName = nodeName;
+ }
+
+ public Resource create(ResourceType type) throws RegistryException{
+ switch (type){
+ case TASK_DETAIL:
+ TaskDetailResource taskDetailResource = new TaskDetailResource();
+ taskDetailResource.setNodeId(nodeInstanceId);
+ return taskDetailResource;
+ case ERROR_DETAIL:
+ ErrorDetailResource errorDetailResource = new ErrorDetailResource();
+ errorDetailResource.setNodeId(nodeInstanceId);;
+ return errorDetailResource;
+ case NODE_INPUT:
+ NodeInputResource nodeInputResource = new NodeInputResource();
+ nodeInputResource.setNodeId(nodeInstanceId);
+ return nodeInputResource;
+ case NODE_OUTPUT:
+ NodeOutputResource nodeOutputResource = new NodeOutputResource();
+ nodeOutputResource.setNodeId(nodeInstanceId);
+ return nodeOutputResource;
+ case STATUS:
+ StatusResource statusResource = new StatusResource();
+ statusResource.setNodeId(nodeInstanceId);
+ return statusResource;
+ default:
+ logger.error("Unsupported resource type for workflow node detail resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for workflow node detail resource.");
+ }
+ }
+
+ public void remove(ResourceType type, Object name) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ switch (type) {
+ case TASK_DETAIL:
+ generator = new QueryGenerator(TASK_DETAIL);
+ generator.setParameter(TaskDetailConstants.TASK_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case ERROR_DETAIL:
+ generator = new QueryGenerator(ERROR_DETAIL);
+ generator.setParameter(ErrorDetailConstants.NODE_INSTANCE_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case NODE_INPUT:
+ generator = new QueryGenerator(NODE_INPUT);
+ generator.setParameter(NodeInputConstants.NODE_INSTANCE_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case NODE_OUTPUT:
+ generator = new QueryGenerator(NODE_OUTPUT);
+ generator.setParameter(NodeOutputConstants.NODE_INSTANCE_ID, name);
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.NODE_INSTANCE_ID, name);
+ generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.WORKFLOW_NODE.toString());
+ q = generator.deleteQuery(em);
+ q.executeUpdate();
+ break;
+ default:
+ logger.error("Unsupported resource type for experiment resource.", new IllegalArgumentException());
+ break;
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public Resource get(ResourceType type, Object name) throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ QueryGenerator generator;
+ Query q;
+ switch (type) {
+ case TASK_DETAIL:
+ generator = new QueryGenerator(TASK_DETAIL);
+ generator.setParameter(TaskDetailConstants.TASK_ID, name);
+ q = generator.selectQuery(em);
+ TaskDetail taskDetail = (TaskDetail) q.getSingleResult();
+ TaskDetailResource taskDetailResource = (TaskDetailResource) Utils.getResource(ResourceType.TASK_DETAIL, taskDetail);
+ em.getTransaction().commit();
+ em.close();
+ return taskDetailResource;
+ case ERROR_DETAIL:
+ generator = new QueryGenerator(ERROR_DETAIL);
+ generator.setParameter(ErrorDetailConstants.NODE_INSTANCE_ID, name);
+ q = generator.selectQuery(em);
+ ErrorDetail errorDetail = (ErrorDetail) q.getSingleResult();
+ ErrorDetailResource errorDetailResource = (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
+ em.getTransaction().commit();
+ em.close();
+ return errorDetailResource;
+ case NODE_INPUT:
+ generator = new QueryGenerator(NODE_INPUT);
+ generator.setParameter(NodeInputConstants.NODE_INSTANCE_ID, name);
+ q = generator.selectQuery(em);
+ NodeInput nodeInput = (NodeInput) q.getSingleResult();
+ NodeInputResource nodeInputResource = (NodeInputResource) Utils.getResource(ResourceType.NODE_INPUT, nodeInput);
+ em.getTransaction().commit();
+ em.close();
+ return nodeInputResource;
+ case NODE_OUTPUT:
+ generator = new QueryGenerator(NODE_OUTPUT);
+ generator.setParameter(NodeOutputConstants.NODE_INSTANCE_ID, name);
+ q = generator.selectQuery(em);
+ NodeOutput nodeOutput = (NodeOutput) q.getSingleResult();
+ NodeOutputResource nodeOutputResource = (NodeOutputResource) Utils.getResource(ResourceType.NODE_OUTPUT, nodeOutput);
+ em.getTransaction().commit();
+ em.close();
+ return nodeOutputResource;
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.NODE_INSTANCE_ID, name);
+ generator.setParameter(StatusConstants.STATUS_TYPE, StatusType.WORKFLOW_NODE.toString());
+ q = generator.selectQuery(em);
+ Status status = (Status) q.getSingleResult();
+ StatusResource statusResource = (StatusResource) Utils.getResource(ResourceType.STATUS, status);
+ em.getTransaction().commit();
+ em.close();
+ return statusResource;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for workflow node resource.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Unsupported resource type for workflow node resource.");
+ }
+ } catch (Exception e) {
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public List<Resource> get(ResourceType type) throws RegistryException{
+ List<Resource> resourceList = new ArrayList<Resource>();
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ Query q;
+ QueryGenerator generator;
+ List results;
+ switch (type) {
+ case TASK_DETAIL:
+ generator = new QueryGenerator(TASK_DETAIL);
+ generator.setParameter(TaskDetailConstants.NODE_INSTANCE_ID, nodeInstanceId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ TaskDetail taskDetail = (TaskDetail) result;
+ TaskDetailResource taskDetailResource =
+ (TaskDetailResource) Utils.getResource(ResourceType.TASK_DETAIL, taskDetail);
+ resourceList.add(taskDetailResource);
+ }
+ }
+ break;
+ case ERROR_DETAIL:
+ generator = new QueryGenerator(ERROR_DETAIL);
+ generator.setParameter(ErrorDetailConstants.NODE_INSTANCE_ID, nodeInstanceId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ ErrorDetail errorDetail = (ErrorDetail) result;
+ ErrorDetailResource errorDetailResource =
+ (ErrorDetailResource) Utils.getResource(ResourceType.ERROR_DETAIL, errorDetail);
+ resourceList.add(errorDetailResource);
+ }
+ }
+ break;
+ case NODE_INPUT:
+ generator = new QueryGenerator(NODE_INPUT);
+ generator.setParameter(NodeInputConstants.NODE_INSTANCE_ID, nodeInstanceId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ NodeInput nodeInput = (NodeInput) result;
+ NodeInputResource nodeInputResource =
+ (NodeInputResource) Utils.getResource(ResourceType.NODE_INPUT, nodeInput);
+ resourceList.add(nodeInputResource);
+ }
+ }
+ break;
+ case NODE_OUTPUT:
+ generator = new QueryGenerator(NODE_OUTPUT);
+ generator.setParameter(NodeOutputConstants.NODE_INSTANCE_ID, nodeInstanceId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ NodeOutput nodeOutput = (NodeOutput) result;
+ NodeOutputResource nodeOutputResource =
+ (NodeOutputResource) Utils.getResource(ResourceType.NODE_OUTPUT, nodeOutput);
+ resourceList.add(nodeOutputResource);
+ }
+ }
+ break;
+ case STATUS:
+ generator = new QueryGenerator(STATUS);
+ generator.setParameter(StatusConstants.NODE_INSTANCE_ID, nodeInstanceId);
+ q = generator.selectQuery(em);
+ results = q.getResultList();
+ if (results.size() != 0) {
+ for (Object result : results) {
+ Status status = (Status) result;
+ StatusResource statusResource =
+ (StatusResource) Utils.getResource(ResourceType.STATUS, status);
+ resourceList.add(statusResource);
+ }
+ }
+ break;
+ default:
+ em.getTransaction().commit();
+ em.close();
+ logger.error("Unsupported resource type for workflow node details resource.", new UnsupportedOperationException());
+ throw new UnsupportedOperationException();
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+// logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ return resourceList;
+ }
+
+ public void save() throws RegistryException{
+ EntityManager em = null;
+ try {
+ em = ResourceUtils.getEntityManager();
+ WorkflowNodeDetail existingNode = em.find(WorkflowNodeDetail.class, nodeInstanceId);
+ em.close();
+
+ em = ResourceUtils.getEntityManager();
+ em.getTransaction().begin();
+ WorkflowNodeDetail workflowNodeDetail = new WorkflowNodeDetail();
+ workflowNodeDetail.setNodeId(nodeInstanceId);
+ workflowNodeDetail.setExpId(experimentId);
+ workflowNodeDetail.setCreationTime(creationTime);
+ workflowNodeDetail.setNodeName(nodeName);
+ workflowNodeDetail.setExecutionUnit(getExecutionUnit());
+ workflowNodeDetail.setExecutionUnitData(getExecutionUnitData());
+
+ if (existingNode != null) {
+ existingNode.setExpId(experimentId);
+ existingNode.setCreationTime(creationTime);
+ existingNode.setNodeName(nodeName);
+ existingNode.setExecutionUnit(getExecutionUnit());
+ existingNode.setExecutionUnitData(getExecutionUnitData());
+ workflowNodeDetail = em.merge(existingNode);
+ } else {
+ em.persist(workflowNodeDetail);
+ }
+ em.getTransaction().commit();
+ em.close();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RegistryException(e);
+ } finally {
+ if (em != null && em.isOpen()) {
+ if (em.getTransaction().isActive()){
+ em.getTransaction().rollback();
+ }
+ em.close();
+ }
+ }
+ }
+
+ public List<NodeInputResource> getNodeInputs() {
+ return nodeInputs;
+ }
+
+ public List<NodeOutputResource> getNodeOutputs() {
+ return nodeOutputs;
+ }
+
+ public List<NodeInputResource> getNodeInputs1() throws RegistryException{
+ List<NodeInputResource> nodeInputResourceList = new ArrayList<NodeInputResource>();
+ List<Resource> resources = get(ResourceType.NODE_INPUT);
+ for (Resource resource : resources) {
+ NodeInputResource nodeInputResource = (NodeInputResource) resource;
+ nodeInputResourceList.add(nodeInputResource);
+ }
+ return nodeInputResourceList;
+ }
+
+ public List<NodeOutputResource> getNodeOutputs1() throws RegistryException{
+ List<NodeOutputResource> outputResources = new ArrayList<NodeOutputResource>();
+ List<Resource> resources = get(ResourceType.NODE_OUTPUT);
+ for (Resource resource : resources) {
+ NodeOutputResource nodeOutputResource = (NodeOutputResource) resource;
+ outputResources.add(nodeOutputResource);
+ }
+ return outputResources;
+ }
+
+ public StatusResource getWorkflowNodeStatus() throws RegistryException{
+ List<Resource> resources = get(ResourceType.STATUS);
+ for (Resource resource : resources) {
+ StatusResource nodeStatus = (StatusResource) resource;
+ if(nodeStatus.getStatusType().equals(StatusType.WORKFLOW_NODE.toString())){
+ if (nodeStatus.getState() == null || nodeStatus.getState().equals("") ){
+ nodeStatus.setState("UNKNOWN");
+ }
+ return nodeStatus;
+ }
+ }
+ return null;
+ }
+
+ public StatusResource getTaskStatus(String taskId) throws RegistryException{
+ List<Resource> resources = get(ResourceType.STATUS);
+ for (Resource resource : resources) {
+ StatusResource taskStatus = (StatusResource) resource;
+ if(taskStatus.getStatusType().equals(StatusType.TASK.toString()) && taskStatus.getTaskId().equals(taskId)){
+ if (taskStatus.getState() == null || taskStatus.getState().equals("") ){
+ taskStatus.setState("UNKNOWN");
+ }
+ return taskStatus;
+ }
+ }
+ return null;
+ }
+
+ public List<TaskDetailResource> getTaskDetails() throws RegistryException{
+ List<TaskDetailResource> taskDetailResources = new ArrayList<TaskDetailResource>();
+ List<Resource> resources = get(ResourceType.TASK_DETAIL);
+ for (Resource resource : resources) {
+ TaskDetailResource taskDetailResource = (TaskDetailResource) resource;
+ taskDetailResources.add(taskDetailResource);
+ }
+ return taskDetailResources;
+ }
+
+ public List<ErrorDetailResource> getErrorDetails() throws RegistryException{
+ List<ErrorDetailResource> errorDetails = new ArrayList<ErrorDetailResource>();
+ List<Resource> resources = get(ResourceType.ERROR_DETAIL);
+ for (Resource resource : resources) {
+ ErrorDetailResource errorDetailResource = (ErrorDetailResource) resource;
+ errorDetails.add(errorDetailResource);
+ }
+ return errorDetails;
+ }
+
+ public TaskDetailResource getTaskDetail(String taskId) throws RegistryException{
+ return (TaskDetailResource)get(ResourceType.TASK_DETAIL, taskId);
+ }
+
+ public String getExecutionUnit() {
+ return executionUnit;
+ }
+
+ public void setExecutionUnit(String executionUnit) {
+ this.executionUnit = executionUnit;
+ }
+
+ public String getExecutionUnitData() {
+ return executionUnitData;
+ }
+
+ public void setExecutionUnitData(String executionUnitData) {
+ this.executionUnitData = executionUnitData;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/utils/QueryGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/utils/QueryGenerator.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/utils/QueryGenerator.java
new file mode 100644
index 0000000..2c6c219
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/utils/QueryGenerator.java
@@ -0,0 +1,128 @@
+/*
+ *
+ * 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.experiment.catalog.utils;
+
+import org.apache.airavata.registry.cpi.ResultOrderType;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.HashMap;
+import java.util.Map;
+
+public class QueryGenerator {
+ private String tableName;
+ private Map<String,Object> matches=new HashMap<String, Object>();
+ private static final String SELECT_OBJ="p";
+ private static final String DELETE_OBJ="p";
+ private static final String TABLE_OBJ="p";
+//
+// public QueryGenerator(String tableName) {
+// setTableName(tableName);
+// }
+
+ public QueryGenerator(String tableName, Object[]...params) {
+ setTableName(tableName);
+ for (Object[] param : params) {
+ addMatch(param[0].toString(), param[1]);
+ }
+ }
+
+ public String getTableName() {
+ return tableName;
+ }
+ public void setTableName(String tableName) {
+ this.tableName = tableName;
+ }
+ public void addMatch(String colName, Object matchValue){
+ matches.put(colName, matchValue);
+ }
+
+ public void setParameter(String colName, Object matchValue){
+ addMatch(colName, matchValue);
+ }
+
+ /**
+ * Select query
+ * @param entityManager
+ * @return
+ */
+ public Query selectQuery(EntityManager entityManager){
+ String queryString="SELECT "+ SELECT_OBJ + " FROM " +getTableName()+" "+TABLE_OBJ;
+ return generateQueryWithParameters(entityManager, queryString);
+ }
+
+ /**
+ * Select query with pagination
+ * @param entityManager
+ * @param orderByColumn
+ * @param resultOrderType
+ * @return
+ */
+ public Query selectQuery(EntityManager entityManager, String orderByColumn,
+ ResultOrderType resultOrderType){
+ String order = (resultOrderType == ResultOrderType.ASC) ? "ASC" : "DESC";
+ String orderByClause = " ORDER BY " + SELECT_OBJ + "." + orderByColumn + " " + order;
+ String queryString="SELECT "+ SELECT_OBJ + " FROM " +getTableName()+" "+TABLE_OBJ;
+ return generateQueryWithParameters(entityManager, queryString, orderByClause);
+ }
+
+// public Query countQuery(EntityManager entityManager){
+// SELECT COUNT(p.host_descriptor_ID) FROM Host_Descriptor p WHERE p.gateway_name =:gate_ID and p.host_descriptor_ID =:host_desc_name")
+// String queryString="SELECT COUNT("+ SELECT_OBJ + " FROM " +getTableName()+" "+TABLE_OBJ;
+// return generateQueryWithParameters(entityManager, queryString);
+// }
+
+ public Query deleteQuery(EntityManager entityManager){
+ String queryString="Delete FROM "+getTableName()+" "+TABLE_OBJ;
+ return generateQueryWithParameters(entityManager, queryString);
+ }
+
+ private Query generateQueryWithParameters(EntityManager entityManager,
+ String queryString) {
+ return generateQueryWithParameters(entityManager, queryString, "");
+ }
+
+ private Query generateQueryWithParameters(EntityManager entityManager,
+ String queryString, String orderByClause) {
+ Map<String,Object> queryParameters=new HashMap<String, Object>();
+ if (matches.size()>0){
+ String matchString = "";
+ int paramCount=0;
+ for (String colName : matches.keySet()) {
+ String paramName="param"+paramCount;
+ queryParameters.put(paramName, matches.get(colName));
+ if (!matchString.equals("")){
+ matchString+=" AND ";
+ }
+ matchString+=TABLE_OBJ+"."+colName+" =:"+paramName;
+ paramCount++;
+ }
+ queryString+=" WHERE "+matchString;
+ }
+ queryString += orderByClause;
+ Query query = entityManager.createQuery(queryString);
+ for (String paramName : queryParameters.keySet()) {
+ query.setParameter(paramName, queryParameters.get(paramName));
+ }
+ return query;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/utils/ThriftDataModelConversion.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/utils/ThriftDataModelConversion.java b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/utils/ThriftDataModelConversion.java
new file mode 100644
index 0000000..45acd3a
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/java/org/apache/airavata/experiment/catalog/utils/ThriftDataModelConversion.java
@@ -0,0 +1,686 @@
+/*
+*
+* 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.experiment.catalog.utils;
+
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.model.appcatalog.appinterface.DataType;
+import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
+import org.apache.airavata.model.workspace.Gateway;
+import org.apache.airavata.model.workspace.Project;
+import org.apache.airavata.model.workspace.experiment.*;
+import org.apache.airavata.experiment.catalog.Resource;
+import org.apache.airavata.experiment.catalog.ResourceType;
+import org.apache.airavata.experiment.catalog.resources.*;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ThriftDataModelConversion {
+ private final static Logger logger = LoggerFactory.getLogger(ThriftDataModelConversion.class);
+
+ public static Project getProject (ProjectResource pr) throws RegistryException {
+ if (pr != null) {
+ Project project = new Project();
+ project.setProjectID(pr.getId());
+ project.setName(pr.getName());
+ if (pr.getCreationTime()!=null) {
+ project.setCreationTime(pr.getCreationTime().getTime());
+ }
+ project.setDescription(pr.getDescription());
+ project.setOwner(pr.getWorker().getUser());
+ List<ProjectUserResource> projectUserList = pr.getProjectUserList();
+ List<String> sharedUsers = new ArrayList<String>();
+ if (projectUserList != null && !projectUserList.isEmpty()){
+ for (ProjectUserResource resource : projectUserList){
+ sharedUsers.add(resource.getUserName());
+ }
+ }
+ project.setSharedUsers(sharedUsers);
+ return project;
+ }
+ return null;
+ }
+
+ public static Gateway getGateway (GatewayResource resource){
+ Gateway gateway = new Gateway();
+ gateway.setGatewayId(resource.getGatewayId());
+ gateway.setGatewayName(resource.getGatewayName());
+ gateway.setDomain(resource.getDomain());
+ gateway.setEmailAddress(resource.getEmailAddress());
+ return gateway;
+ }
+
+ public static List<Gateway> getAllGateways (List<Resource> gatewayList){
+ List<Gateway> gateways = new ArrayList<Gateway>();
+ for (Resource resource : gatewayList){
+ gateways.add(getGateway((GatewayResource)resource));
+ }
+ return gateways;
+ }
+
+
+ public static Experiment getExperiment(ExperimentResource experimentResource) throws RegistryException {
+ if (experimentResource != null){
+ Experiment experiment = new Experiment();
+ experiment.setProjectID(experimentResource.getProjectId());
+ experiment.setExperimentID(experimentResource.getExpID());
+ experiment.setCreationTime(experimentResource.getCreationTime().getTime());
+ experiment.setUserName(experimentResource.getExecutionUser());
+ experiment.setName(experimentResource.getExpName());
+ experiment.setDescription(experimentResource.getDescription());
+ experiment.setApplicationId(experimentResource.getApplicationId());
+ experiment.setApplicationVersion(experimentResource.getApplicationVersion());
+ experiment.setWorkflowTemplateId(experimentResource.getWorkflowTemplateId());
+ experiment.setEnableEmailNotification(experimentResource.isEnableEmailNotifications());
+ experiment.setGatewayExecutionId(experimentResource.getGatewayExecutionId());
+ if (experiment.isEnableEmailNotification()){
+ List<NotificationEmailResource> notificationEmails = experimentResource.getNotificationEmails();
+ experiment.setEmailAddresses(getEmailAddresses(notificationEmails));
+ }
+ experiment.setWorkflowTemplateVersion(experimentResource.getWorkflowTemplateVersion());
+ experiment.setWorkflowExecutionInstanceId(experimentResource.getWorkflowExecutionId());
+ List<ExperimentInputResource> experimentInputs = experimentResource.getExperimentInputs();
+ experiment.setExperimentInputs(getExpInputs(experimentInputs));
+ List<ExperimentOutputResource> experimentOutputs = experimentResource.getExperimentOutputs();
+ experiment.setExperimentOutputs(getExpOutputs(experimentOutputs));
+ StatusResource experimentStatus = experimentResource.getExperimentStatus();
+ if (experimentStatus != null){
+ experiment.setExperimentStatus(getExperimentStatus(experimentStatus));
+ }
+ List<StatusResource> changeList = experimentResource.getWorkflowNodeStatuses();
+ if (changeList != null && !changeList.isEmpty()){
+ experiment.setStateChangeList(getWorkflowNodeStatusList(changeList));
+ }
+
+ List<WorkflowNodeDetailResource> workflowNodeDetails = experimentResource.getWorkflowNodeDetails();
+ if (workflowNodeDetails != null && !workflowNodeDetails.isEmpty()){
+ experiment.setWorkflowNodeDetailsList(getWfNodeList(workflowNodeDetails));
+ }
+ List<ErrorDetailResource> errorDetails = experimentResource.getErrorDetails();
+ if (errorDetails!= null && !errorDetails.isEmpty()){
+ experiment.setErrors(getErrorDetailList(errorDetails));
+ }
+ if (experimentResource.isExists(ResourceType.CONFIG_DATA, experimentResource.getExpID())){
+ ConfigDataResource userConfigData = experimentResource.getUserConfigData(experimentResource.getExpID());
+ experiment.setUserConfigurationData(getUserConfigData(userConfigData));
+ }
+ return experiment;
+ }
+ return null;
+ }
+
+ public static ExperimentSummary getExperimentSummary(ExperimentSummaryResource experimentSummaryResource) throws RegistryException {
+ if (experimentSummaryResource != null){
+ ExperimentSummary experimentSummary = new ExperimentSummary();
+ experimentSummary.setProjectID(experimentSummaryResource.getProjectID());
+ experimentSummary.setExperimentID(experimentSummaryResource.getExpID());
+ experimentSummary.setCreationTime(experimentSummaryResource.getCreationTime().getTime());
+ experimentSummary.setUserName(experimentSummaryResource.getExecutionUser());
+ experimentSummary.setName(experimentSummaryResource.getExpName());
+ experimentSummary.setDescription(experimentSummaryResource.getDescription());
+ experimentSummary.setApplicationId(experimentSummaryResource.getApplicationId());
+ StatusResource experimentStatus = experimentSummaryResource.getStatus();
+ if (experimentStatus != null){
+ experimentSummary.setExperimentStatus(getExperimentStatus(experimentStatus));
+ }
+ return experimentSummary;
+ }
+ return null;
+ }
+
+ public static InputDataObjectType getInput(Object object){
+ if (object != null){
+ InputDataObjectType dataObjectType = new InputDataObjectType();
+ if (object instanceof ExperimentInputResource){
+ ExperimentInputResource expInput = (ExperimentInputResource) object;
+ dataObjectType.setName(expInput.getExperimentKey());
+ dataObjectType.setValue(expInput.getValue());
+ if (expInput.getDataType() != null){
+ dataObjectType.setType(DataType.valueOf(expInput.getDataType()));
+ }
+ dataObjectType.setMetaData(expInput.getMetadata());
+ dataObjectType.setApplicationArgument(expInput.getAppArgument());
+ dataObjectType.setStandardInput(expInput.isStandardInput());
+ dataObjectType.setUserFriendlyDescription(expInput.getUserFriendlyDesc());
+ dataObjectType.setInputOrder(expInput.getInputOrder());
+ dataObjectType.setIsRequired(expInput.getRequired());
+ dataObjectType.setRequiredToAddedToCommandLine(expInput.getRequiredToCMD());
+ dataObjectType.setDataStaged(expInput.isDataStaged());
+ return dataObjectType;
+ }else if (object instanceof NodeInputResource){
+ NodeInputResource nodeInputResource = (NodeInputResource)object;
+ dataObjectType.setName(nodeInputResource.getInputKey());
+ dataObjectType.setValue(nodeInputResource.getValue());
+ if (nodeInputResource.getDataType() != null){
+ dataObjectType.setType(DataType.valueOf(nodeInputResource.getDataType()));
+ }
+ dataObjectType.setMetaData(nodeInputResource.getMetadata());
+ dataObjectType.setApplicationArgument(nodeInputResource.getAppArgument());
+ dataObjectType.setStandardInput(nodeInputResource.isStandardInput());
+ dataObjectType.setUserFriendlyDescription(nodeInputResource.getUserFriendlyDesc());
+ dataObjectType.setInputOrder(nodeInputResource.getInputOrder());
+ dataObjectType.setIsRequired(nodeInputResource.getRequired());
+ dataObjectType.setRequiredToAddedToCommandLine(nodeInputResource.getRequiredToCMD());
+ dataObjectType.setDataStaged(nodeInputResource.isDataStaged());
+ return dataObjectType;
+ }else if (object instanceof ApplicationInputResource){
+ ApplicationInputResource inputResource = (ApplicationInputResource)object;
+ dataObjectType.setName(inputResource.getInputKey());
+ dataObjectType.setValue(inputResource.getValue());
+ if (inputResource.getDataType() != null){
+ dataObjectType.setType(DataType.valueOf(inputResource.getDataType()));
+ }
+ dataObjectType.setMetaData(inputResource.getMetadata());
+ dataObjectType.setApplicationArgument(inputResource.getAppArgument());
+ dataObjectType.setStandardInput(inputResource.isStandardInput());
+ dataObjectType.setUserFriendlyDescription(inputResource.getUserFriendlyDesc());
+ dataObjectType.setInputOrder(inputResource.getInputOrder());
+ dataObjectType.setIsRequired(inputResource.isRequired());
+ dataObjectType.setRequiredToAddedToCommandLine(inputResource.isRequiredToCMD());
+ dataObjectType.setDataStaged(inputResource.isDataStaged());
+ return dataObjectType;
+ }else {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public static OutputDataObjectType getOutput(Object object){
+ if (object != null){
+ OutputDataObjectType dataObjectType = new OutputDataObjectType();
+ if (object instanceof ExperimentOutputResource){
+ ExperimentOutputResource expOutput = (ExperimentOutputResource)object;
+ dataObjectType.setName(expOutput.getExperimentKey());
+ dataObjectType.setValue(expOutput.getValue());
+ if (expOutput.getDataType() != null){
+ dataObjectType.setType(DataType.valueOf(expOutput.getDataType()));
+ }
+ dataObjectType.setIsRequired(expOutput.getRequired());
+ dataObjectType.setRequiredToAddedToCommandLine(expOutput.getRequiredToCMD());
+ dataObjectType.setDataMovement(expOutput.isDataMovement());
+ dataObjectType.setLocation(expOutput.getDataNameLocation());
+ dataObjectType.setSearchQuery(expOutput.getSearchQuery());
+ dataObjectType.setApplicationArgument(expOutput.getAppArgument());
+ return dataObjectType;
+ }else if (object instanceof NodeOutputResource){
+ NodeOutputResource nodeOutputResource = (NodeOutputResource)object;
+ dataObjectType.setName(nodeOutputResource.getOutputKey());
+ dataObjectType.setValue(nodeOutputResource.getValue());
+ if (nodeOutputResource.getDataType() != null){
+ dataObjectType.setType(DataType.valueOf(nodeOutputResource.getDataType()));
+ }
+ dataObjectType.setIsRequired(nodeOutputResource.getRequired());
+ dataObjectType.setRequiredToAddedToCommandLine(nodeOutputResource.getRequiredToCMD());
+ dataObjectType.setDataMovement(nodeOutputResource.isDataMovement());
+ dataObjectType.setLocation(nodeOutputResource.getDataNameLocation());
+ dataObjectType.setSearchQuery(nodeOutputResource.getSearchQuery());
+ dataObjectType.setApplicationArgument(nodeOutputResource.getAppArgument());
+ return dataObjectType;
+ }else if (object instanceof ApplicationOutputResource){
+ ApplicationOutputResource outputResource = (ApplicationOutputResource)object;
+ dataObjectType.setName(outputResource.getOutputKey());
+ dataObjectType.setValue(outputResource.getValue());
+ dataObjectType.setIsRequired(outputResource.isRequired());
+ dataObjectType.setRequiredToAddedToCommandLine(outputResource.isRequiredToCMD());
+ if (outputResource.getDataType() != null){
+ dataObjectType.setType(DataType.valueOf(outputResource.getDataType()));
+ }
+ dataObjectType.setDataMovement(outputResource.isDataMovement());
+ dataObjectType.setLocation(outputResource.getDataNameLocation());
+ dataObjectType.setSearchQuery(outputResource.getSearchQuery());
+ dataObjectType.setApplicationArgument(outputResource.getAppArgument());
+ return dataObjectType;
+ }else {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public static List<String> getEmailAddresses (List<NotificationEmailResource> resourceList){
+ List<String> emailAddresses = new ArrayList<String>();
+ if (resourceList != null && !resourceList.isEmpty()){
+ for (NotificationEmailResource emailResource : resourceList){
+ emailAddresses.add(emailResource.getEmailAddress());
+ }
+ }
+ return emailAddresses;
+ }
+
+ public static List<InputDataObjectType> getExpInputs (List<ExperimentInputResource> exInputList){
+ List<InputDataObjectType> expInputs = new ArrayList<InputDataObjectType>();
+ if (exInputList != null && !exInputList.isEmpty()){
+ for (ExperimentInputResource inputResource : exInputList){
+ InputDataObjectType exInput = getInput(inputResource);
+ expInputs.add(exInput);
+ }
+ }
+ return expInputs;
+ }
+
+ public static List<OutputDataObjectType> getExpOutputs (List<ExperimentOutputResource> experimentOutputResourceList){
+ List<OutputDataObjectType> exOutputs = new ArrayList<OutputDataObjectType>();
+ if (experimentOutputResourceList != null && !experimentOutputResourceList.isEmpty()){
+ for (ExperimentOutputResource outputResource : experimentOutputResourceList){
+ OutputDataObjectType output = getOutput(outputResource);
+ exOutputs.add(output);
+ }
+ }
+ return exOutputs;
+ }
+
+ public static List<InputDataObjectType> getNodeInputs (List<NodeInputResource> nodeInputResources){
+ List<InputDataObjectType> nodeInputs = new ArrayList<InputDataObjectType>();
+ if (nodeInputResources != null && !nodeInputResources.isEmpty()){
+ for (NodeInputResource inputResource : nodeInputResources){
+ InputDataObjectType nodeInput = getInput(inputResource);
+ nodeInputs.add(nodeInput);
+ }
+ }
+ return nodeInputs;
+ }
+
+ public static List<OutputDataObjectType> getNodeOutputs (List<NodeOutputResource> nodeOutputResourceList){
+ List<OutputDataObjectType> nodeOutputs = new ArrayList<OutputDataObjectType>();
+ if (nodeOutputResourceList != null && !nodeOutputResourceList.isEmpty()){
+ for (NodeOutputResource outputResource : nodeOutputResourceList){
+ OutputDataObjectType output = getOutput(outputResource);
+ nodeOutputs.add(output);
+ }
+ }
+ return nodeOutputs;
+ }
+
+ public static List<InputDataObjectType> getApplicationInputs (List<ApplicationInputResource> applicationInputResources){
+ List<InputDataObjectType> appInputs = new ArrayList<InputDataObjectType>();
+ if (applicationInputResources != null && !applicationInputResources.isEmpty()){
+ for (ApplicationInputResource inputResource : applicationInputResources){
+ InputDataObjectType appInput = getInput(inputResource);
+ appInputs.add(appInput);
+ }
+ }
+ return appInputs;
+ }
+
+ public static List<OutputDataObjectType> getApplicationOutputs (List<ApplicationOutputResource> outputResources){
+ List<OutputDataObjectType> appOutputs = new ArrayList<OutputDataObjectType>();
+ if (outputResources != null && !outputResources.isEmpty()){
+ for (ApplicationOutputResource outputResource : outputResources){
+ OutputDataObjectType output = getOutput(outputResource);
+ appOutputs.add(output);
+ }
+ }
+ return appOutputs;
+ }
+
+ public static ExperimentStatus getExperimentStatus(StatusResource status){
+ if (status != null){
+ ExperimentStatus experimentStatus = new ExperimentStatus();
+ if (status.getState() == null || status.getState().equals("")){
+ status.setState("UNKNOWN");
+ }
+ experimentStatus.setExperimentState(ExperimentState.valueOf(status.getState()));
+ experimentStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
+ return experimentStatus;
+ }
+ return null;
+ }
+
+ public static WorkflowNodeStatus getWorkflowNodeStatus (StatusResource status){
+ if (status != null){
+ WorkflowNodeStatus workflowNodeStatus = new WorkflowNodeStatus();
+ if (status.getState() == null || status.getState().equals("")){
+ status.setState("UNKNOWN");
+ }
+ workflowNodeStatus.setWorkflowNodeState(WorkflowNodeState.valueOf(status.getState()));
+ workflowNodeStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
+ return workflowNodeStatus;
+ }
+ return null;
+ }
+
+ public static TaskStatus getTaskStatus (StatusResource status){
+ if (status != null){
+ TaskStatus taskStatus = new TaskStatus();
+ if (status.getState() == null || status.getState().equals("")){
+ status.setState("UNKNOWN");
+ }
+ taskStatus.setExecutionState(TaskState.valueOf(status.getState()));
+ taskStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
+ return taskStatus;
+ }
+ return null;
+ }
+
+ public static JobStatus getJobStatus (StatusResource status){
+ if (status != null){
+ JobStatus jobStatus = new JobStatus();
+ if (status.getState() == null || status.getState().equals("")){
+ status.setState("UNKNOWN");
+ }
+ jobStatus.setJobState(JobState.valueOf(status.getState()));
+ if (status.getStatusUpdateTime() == null){
+ jobStatus.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
+ }else {
+ jobStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
+ }
+ return jobStatus;
+ }
+ return null;
+ }
+
+ public static TransferStatus getTransferStatus (StatusResource status){
+ if (status != null){
+ TransferStatus transferStatus = new TransferStatus();
+ if (status.getState() == null || status.getState().equals("")){
+ status.setState("UNKNOWN");
+ }
+ transferStatus.setTransferState(TransferState.valueOf(status.getState()));
+ transferStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
+ return transferStatus;
+ }
+ return null;
+ }
+
+ public static ApplicationStatus getApplicationStatus (StatusResource status){
+ if (status != null){
+ ApplicationStatus applicationStatus = new ApplicationStatus();
+ if (status.getState() == null || status.getState().equals("")){
+ status.setState("UNKNOWN");
+ }
+ applicationStatus.setApplicationState(status.getState());
+ applicationStatus.setTimeOfStateChange(status.getStatusUpdateTime().getTime());
+ return applicationStatus;
+ }
+ return null;
+ }
+
+ public static List<WorkflowNodeStatus> getWorkflowNodeStatusList(List<StatusResource> statuses){
+ List<WorkflowNodeStatus> wfNodeStatuses = new ArrayList<WorkflowNodeStatus>();
+ if (statuses != null && !statuses.isEmpty()){
+ for (StatusResource statusResource : statuses){
+ wfNodeStatuses.add(getWorkflowNodeStatus(statusResource));
+ }
+ }
+ return wfNodeStatuses;
+ }
+
+ public static WorkflowNodeDetails getWorkflowNodeDetails(WorkflowNodeDetailResource nodeDetailResource) throws RegistryException {
+ if (nodeDetailResource != null){
+ WorkflowNodeDetails wfNode = new WorkflowNodeDetails();
+ wfNode.setNodeInstanceId(nodeDetailResource.getNodeInstanceId());
+ wfNode.setCreationTime(nodeDetailResource.getCreationTime().getTime());
+ wfNode.setNodeName(nodeDetailResource.getNodeName());
+ List<NodeInputResource> nodeInputs = nodeDetailResource.getNodeInputs();
+ wfNode.setNodeInputs(getNodeInputs(nodeInputs));
+ List<NodeOutputResource> nodeOutputs = nodeDetailResource.getNodeOutputs();
+ wfNode.setNodeOutputs(getNodeOutputs(nodeOutputs));
+ List<TaskDetailResource> taskDetails = nodeDetailResource.getTaskDetails();
+ wfNode.setTaskDetailsList(getTaskDetailsList(taskDetails));
+ wfNode.setWorkflowNodeStatus(getWorkflowNodeStatus(nodeDetailResource.getWorkflowNodeStatus()));
+ List<ErrorDetailResource> errorDetails = nodeDetailResource.getErrorDetails();
+ wfNode.setErrors(getErrorDetailList(errorDetails));
+ wfNode.setExecutionUnit(ExecutionUnit.valueOf(nodeDetailResource.getExecutionUnit()));
+ wfNode.setExecutionUnitData(nodeDetailResource.getExecutionUnitData());
+ return wfNode;
+ }
+ return null;
+ }
+
+ public static List<WorkflowNodeDetails> getWfNodeList (List<WorkflowNodeDetailResource> resources) throws RegistryException {
+ List<WorkflowNodeDetails> workflowNodeDetailsList = new ArrayList<WorkflowNodeDetails>();
+ if (resources != null && !resources.isEmpty()){
+ for (WorkflowNodeDetailResource resource : resources){
+ workflowNodeDetailsList.add(getWorkflowNodeDetails(resource));
+ }
+ }
+ return workflowNodeDetailsList;
+ }
+
+ public static TaskDetails getTaskDetail (TaskDetailResource taskDetailResource) throws RegistryException {
+ if (taskDetailResource != null){
+ TaskDetails taskDetails = new TaskDetails();
+ String taskId = taskDetailResource.getTaskId();
+ taskDetails.setTaskID(taskId);
+ taskDetails.setApplicationId(taskDetailResource.getApplicationId());
+ taskDetails.setApplicationVersion(taskDetailResource.getApplicationVersion());
+ List<ApplicationInputResource> applicationInputs = taskDetailResource.getApplicationInputs();
+ taskDetails.setApplicationInputs(getApplicationInputs(applicationInputs));
+ List<ApplicationOutputResource> applicationOutputs = taskDetailResource.getApplicationOutputs();
+ taskDetails.setApplicationOutputs(getApplicationOutputs(applicationOutputs));
+ taskDetails.setEnableEmailNotification(taskDetailResource.isEnableEmailNotifications());
+ if (taskDetails.isEnableEmailNotification()){
+ List<NotificationEmailResource> notificationEmails = taskDetailResource.getNotificationEmails();
+ taskDetails.setEmailAddresses(getEmailAddresses(notificationEmails));
+ }
+ taskDetails.setApplicationDeploymentId(taskDetailResource.getApplicationDeploymentId());
+ if (taskDetailResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, taskId)){
+ ComputationSchedulingResource computationScheduling = taskDetailResource.getComputationScheduling(taskId);
+ taskDetails.setTaskScheduling(getComputationalResourceScheduling(computationScheduling));
+ }
+
+ if (taskDetailResource.isExists(ResourceType.ADVANCE_INPUT_DATA_HANDLING, taskId)){
+ AdvanceInputDataHandlingResource inputDataHandling = taskDetailResource.getInputDataHandling(taskId);
+ taskDetails.setAdvancedInputDataHandling(getAdvanceInputDataHandling(inputDataHandling));
+ }
+
+ if (taskDetailResource.isExists(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, taskId)){
+ AdvancedOutputDataHandlingResource outputDataHandling = taskDetailResource.getOutputDataHandling(taskId);
+ taskDetails.setAdvancedOutputDataHandling(getAdvanceOutputDataHandling(outputDataHandling));
+ }
+
+ taskDetails.setTaskStatus(getTaskStatus(taskDetailResource.getTaskStatus()));
+ List<JobDetailResource> jobDetailList = taskDetailResource.getJobDetailList();
+ taskDetails.setJobDetailsList(getJobDetailsList(jobDetailList));
+ taskDetails.setErrors(getErrorDetailList(taskDetailResource.getErrorDetailList()));
+ taskDetails.setDataTransferDetailsList(getDataTransferlList(taskDetailResource.getDataTransferDetailList()));
+ return taskDetails;
+ }
+ return null;
+ }
+
+ public static List<TaskDetails> getTaskDetailsList (List<TaskDetailResource> resources) throws RegistryException {
+ List<TaskDetails> taskDetailsList = new ArrayList<TaskDetails>();
+ if (resources != null && !resources.isEmpty()){
+ for (TaskDetailResource resource : resources){
+ taskDetailsList.add(getTaskDetail(resource));
+ }
+ }
+ return taskDetailsList;
+ }
+
+ public static List<JobDetails> getJobDetailsList(List<JobDetailResource> jobs) throws RegistryException {
+ List<JobDetails> jobDetailsList = new ArrayList<JobDetails>();
+ if (jobs != null && !jobs.isEmpty()){
+ for (JobDetailResource resource : jobs){
+ jobDetailsList.add(getJobDetail(resource));
+ }
+ }
+ return jobDetailsList;
+ }
+
+
+ public static JobDetails getJobDetail(JobDetailResource jobDetailResource) throws RegistryException {
+ if (jobDetailResource != null){
+ JobDetails jobDetails = new JobDetails();
+ jobDetails.setJobID(jobDetailResource.getJobId());
+ jobDetails.setJobDescription(jobDetailResource.getJobDescription());
+ jobDetails.setCreationTime(jobDetailResource.getCreationTime().getTime());
+ StatusResource jobStatus = jobDetailResource.getJobStatus();
+ jobDetails.setJobStatus(getJobStatus(jobStatus));
+ jobDetails.setJobName(jobDetailResource.getJobName());
+ jobDetails.setWorkingDir(jobDetailResource.getWorkingDir());
+ StatusResource applicationStatus = jobDetailResource.getApplicationStatus();
+ jobDetails.setApplicationStatus(getApplicationStatus(applicationStatus));
+ List<ErrorDetailResource> errorDetails = jobDetailResource.getErrorDetails();
+ jobDetails.setErrors(getErrorDetailList(errorDetails));
+ jobDetails.setComputeResourceConsumed(jobDetailResource.getComputeResourceConsumed());
+ return jobDetails;
+ }
+ return null;
+ }
+
+ public static ErrorDetails getErrorDetails (ErrorDetailResource resource){
+ if (resource != null){
+ ErrorDetails errorDetails = new ErrorDetails();
+ errorDetails.setErrorID(String.valueOf(resource.getErrorId()));
+ errorDetails.setCreationTime(resource.getCreationTime().getTime());
+ errorDetails.setActualErrorMessage(resource.getActualErrorMsg());
+ errorDetails.setUserFriendlyMessage(resource.getUserFriendlyErrorMsg());
+ errorDetails.setErrorCategory(ErrorCategory.valueOf(resource.getErrorCategory()));
+ errorDetails.setTransientOrPersistent(resource.isTransientPersistent());
+ errorDetails.setCorrectiveAction(CorrectiveAction.valueOf(resource.getCorrectiveAction()));
+ errorDetails.setActionableGroup(ActionableGroup.valueOf(resource.getActionableGroup()));
+ return errorDetails;
+ }
+ return null;
+ }
+
+ public static List<ErrorDetails> getErrorDetailList (List<ErrorDetailResource> errorDetailResources){
+ List<ErrorDetails> errorDetailsList = new ArrayList<ErrorDetails>();
+ if (errorDetailResources != null && !errorDetailResources.isEmpty()){
+ for (ErrorDetailResource errorDetailResource : errorDetailResources){
+ errorDetailsList.add(getErrorDetails(errorDetailResource));
+ }
+ }
+ return errorDetailsList;
+ }
+
+ public static DataTransferDetails getDataTransferDetail (DataTransferDetailResource resource) throws RegistryException {
+ if (resource != null){
+ DataTransferDetails details = new DataTransferDetails();
+ details.setTransferID(resource.getTransferId());
+ details.setCreationTime(resource.getCreationTime().getTime());
+ details.setTransferDescription(resource.getTransferDescription());
+ details.setTransferStatus(getTransferStatus(resource.getDataTransferStatus()));
+ return details;
+ }
+ return null;
+ }
+
+ public static List<DataTransferDetails> getDataTransferlList (List<DataTransferDetailResource> resources) throws RegistryException {
+ List<DataTransferDetails> transferDetailsList = new ArrayList<DataTransferDetails>();
+ if (resources != null && !resources.isEmpty()){
+ for (DataTransferDetailResource resource : resources){
+ transferDetailsList.add(getDataTransferDetail(resource));
+ }
+ }
+ return transferDetailsList;
+ }
+
+
+ public static UserConfigurationData getUserConfigData (ConfigDataResource resource) throws RegistryException {
+ if (resource != null){
+ UserConfigurationData data = new UserConfigurationData();
+ data.setAiravataAutoSchedule(resource.isAiravataAutoSchedule());
+ data.setOverrideManualScheduledParams(resource.isOverrideManualParams());
+ data.setShareExperimentPublicly(resource.isShareExp());
+ data.setUserDN(resource.getUserDn());
+ data.setGenerateCert(resource.isGenerateCert());
+ String expID = resource.getExperimentId();
+ ExperimentResource experimentResource = new ExperimentResource();
+ experimentResource.setExpID(expID);
+ if (experimentResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, expID)){
+ ComputationSchedulingResource computationScheduling = experimentResource.getComputationScheduling(expID);
+ data.setComputationalResourceScheduling(getComputationalResourceScheduling(computationScheduling));
+ }
+
+ if (experimentResource.isExists(ResourceType.ADVANCE_INPUT_DATA_HANDLING, expID)){
+ AdvanceInputDataHandlingResource inputDataHandling = experimentResource.getInputDataHandling(expID);
+ data.setAdvanceInputDataHandling(getAdvanceInputDataHandling(inputDataHandling));
+ }
+
+ if (experimentResource.isExists(ResourceType.ADVANCE_OUTPUT_DATA_HANDLING, expID)){
+ AdvancedOutputDataHandlingResource outputDataHandling = experimentResource.getOutputDataHandling(expID);
+ data.setAdvanceOutputDataHandling(getAdvanceOutputDataHandling(outputDataHandling));
+ }
+
+ if (experimentResource.isExists(ResourceType.QOS_PARAM, expID)){
+ QosParamResource qoSparams = experimentResource.getQOSparams(expID);
+ data.setQosParams(getQOSParams(qoSparams));
+ }
+ return data;
+ }
+ return null;
+ }
+
+
+ public static ComputationalResourceScheduling getComputationalResourceScheduling (ComputationSchedulingResource csr){
+ if (csr != null){
+ ComputationalResourceScheduling scheduling = new ComputationalResourceScheduling();
+ scheduling.setResourceHostId(csr.getResourceHostId());
+ scheduling.setTotalCPUCount(csr.getCpuCount());
+ scheduling.setNodeCount(csr.getNodeCount());
+ scheduling.setNumberOfThreads(csr.getNumberOfThreads());
+ scheduling.setQueueName(csr.getQueueName());
+ scheduling.setWallTimeLimit(csr.getWalltimeLimit());
+ scheduling.setJobStartTime((int)csr.getJobStartTime().getTime());
+ scheduling.setTotalPhysicalMemory(csr.getPhysicalMemory());
+ scheduling.setComputationalProjectAccount(csr.getProjectName());
+ scheduling.setChassisName(csr.getChessisName());
+ return scheduling;
+ }
+ return null;
+ }
+
+ public static AdvancedInputDataHandling getAdvanceInputDataHandling(AdvanceInputDataHandlingResource adhr){
+ if (adhr != null){
+ AdvancedInputDataHandling adih = new AdvancedInputDataHandling();
+ adih.setStageInputFilesToWorkingDir(adhr.isStageInputFiles());
+ adih.setParentWorkingDirectory(adhr.getWorkingDirParent());
+ adih.setUniqueWorkingDirectory(adhr.getWorkingDir());
+ adih.setCleanUpWorkingDirAfterJob(adhr.isCleanAfterJob());
+ return adih;
+ }
+ return null;
+ }
+
+ public static AdvancedOutputDataHandling getAdvanceOutputDataHandling(AdvancedOutputDataHandlingResource adodh){
+ if (adodh != null){
+ AdvancedOutputDataHandling outputDataHandling = new AdvancedOutputDataHandling();
+ outputDataHandling.setOutputDataDir(adodh.getOutputDataDir());
+ outputDataHandling.setDataRegistryURL(adodh.getDataRegUrl());
+ outputDataHandling.setPersistOutputData(adodh.isPersistOutputData());
+ return outputDataHandling;
+ }
+ return null;
+ }
+
+ public static QualityOfServiceParams getQOSParams (QosParamResource qos){
+ if (qos != null){
+ QualityOfServiceParams qosParams = new QualityOfServiceParams();
+ qosParams.setStartExecutionAt(qos.getStartExecutionAt());
+ qosParams.setExecuteBefore(qos.getExecuteBefore());
+ qosParams.setNumberofRetries(qos.getNoOfRetries());
+ return qosParams;
+ }
+ return null;
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/resources/META-INF/persistence.xml b/modules/registry/experiment-catalog/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..8df44f9
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<!--*
+ *
+ * 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.
+ *
+* -->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
+ <persistence-unit name="airavata_data">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <class>org.apache.airavata.experiment.catalog.model.Gateway</class>
+ <class>org.apache.airavata.experiment.catalog.model.Configuration</class>
+ <class>org.apache.airavata.experiment.catalog.model.Users</class>
+ <class>org.apache.airavata.experiment.catalog.model.Gateway_Worker</class>
+ <class>org.apache.airavata.experiment.catalog.model.Project</class>
+ <class>org.apache.airavata.experiment.catalog.model.ProjectUser</class>
+ <class>org.apache.airavata.experiment.catalog.model.Experiment</class>
+ <class>org.apache.airavata.experiment.catalog.model.Notification_Email</class>
+ <class>org.apache.airavata.experiment.catalog.model.Experiment_Input</class>
+ <class>org.apache.airavata.experiment.catalog.model.Experiment_Output</class>
+ <class>org.apache.airavata.experiment.catalog.model.WorkflowNodeDetail</class>
+ <class>org.apache.airavata.experiment.catalog.model.TaskDetail</class>
+ <class>org.apache.airavata.experiment.catalog.model.ErrorDetail</class>
+ <class>org.apache.airavata.experiment.catalog.model.ApplicationInput</class>
+ <class>org.apache.airavata.experiment.catalog.model.ApplicationOutput</class>
+ <class>org.apache.airavata.experiment.catalog.model.NodeInput</class>
+ <class>org.apache.airavata.experiment.catalog.model.NodeOutput</class>
+ <class>org.apache.airavata.experiment.catalog.model.JobDetail</class>
+ <class>org.apache.airavata.experiment.catalog.model.DataTransferDetail</class>
+ <class>org.apache.airavata.experiment.catalog.model.Status</class>
+ <class>org.apache.airavata.experiment.catalog.model.ExperimentConfigData</class>
+ <class>org.apache.airavata.experiment.catalog.model.Computational_Resource_Scheduling</class>
+ <class>org.apache.airavata.experiment.catalog.model.AdvancedInputDataHandling</class>
+ <class>org.apache.airavata.experiment.catalog.model.AdvancedOutputDataHandling</class>
+ <class>org.apache.airavata.experiment.catalog.model.QosParam</class>
+ <exclude-unlisted-classes>true</exclude-unlisted-classes>
+ <!--properties>
+ <property name="openjpa.ConnectionURL"
+ value="jdbc:mysql://localhost:3306/persitant_data" />
+ <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" />
+ <property name="openjpa.ConnectionUserName" value="airavata" />
+ <property name="openjpa.ConnectionPassword" value="airavata" />
+ <property name="openjpa.DynamicEnhancementAgent" value="true" />
+ <property name="openjpa.RuntimeUnenhancedClasses" value="supported" />
+ <property name="openjpa.Log" value="SQL=TRACE" />
+ <property name="openjpa.ConnectionFactoryProperties"
+ value="PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=60000" />
+ </properties-->
+ </persistence-unit>
+</persistence>
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/resources/registry-derby.sql
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/resources/registry-derby.sql b/modules/registry/experiment-catalog/src/main/resources/registry-derby.sql
new file mode 100644
index 0000000..7ab3755
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/resources/registry-derby.sql
@@ -0,0 +1,391 @@
+/*
+ *
+ * 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.
+ *
+ */
+CREATE TABLE GATEWAY
+(
+ GATEWAY_ID VARCHAR (255),
+ GATEWAY_NAME VARCHAR(255),
+ DOMAIN VARCHAR(255),
+ EMAIL_ADDRESS VARCHAR(255),
+ PRIMARY KEY (GATEWAY_ID)
+);
+
+CREATE TABLE CONFIGURATION
+(
+ CONFIG_KEY VARCHAR(255),
+ CONFIG_VAL VARCHAR(255),
+ EXPIRE_DATE TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ CATEGORY_ID VARCHAR (255),
+ PRIMARY KEY(CONFIG_KEY, CONFIG_VAL, CATEGORY_ID)
+);
+
+INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL, EXPIRE_DATE, CATEGORY_ID) VALUES('registry.version', '0.15', CURRENT_TIMESTAMP ,'SYSTEM');
+
+CREATE TABLE USERS
+(
+ USER_NAME VARCHAR(255),
+ PASSWORD VARCHAR(255),
+ PRIMARY KEY(USER_NAME)
+);
+
+CREATE TABLE GATEWAY_WORKER
+(
+ GATEWAY_ID VARCHAR(255),
+ USER_NAME VARCHAR(255),
+ PRIMARY KEY (GATEWAY_ID, USER_NAME),
+ FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
+ FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE PROJECT
+(
+ GATEWAY_ID VARCHAR(255),
+ USER_NAME VARCHAR(255) NOT NULL,
+ PROJECT_ID VARCHAR(255),
+ PROJECT_NAME VARCHAR(255) NOT NULL,
+ DESCRIPTION VARCHAR(255),
+ CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (PROJECT_ID),
+ FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
+ FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE PROJECT_USER
+(
+ PROJECT_ID VARCHAR(255),
+ USER_NAME VARCHAR(255),
+ PRIMARY KEY (PROJECT_ID,USER_NAME),
+ FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE EXPERIMENT
+(
+ EXPERIMENT_ID VARCHAR(255),
+ GATEWAY_ID VARCHAR(255),
+ EXECUTION_USER VARCHAR(255) NOT NULL,
+ PROJECT_ID VARCHAR(255) NOT NULL,
+ CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ EXPERIMENT_NAME VARCHAR(255) NOT NULL,
+ EXPERIMENT_DESCRIPTION VARCHAR(255),
+ APPLICATION_ID VARCHAR(255),
+ APPLICATION_VERSION VARCHAR(255),
+ WORKFLOW_TEMPLATE_ID VARCHAR(255),
+ WORKFLOW_TEMPLATE_VERSION VARCHAR(255),
+ WORKFLOW_EXECUTION_ID VARCHAR(255),
+ ALLOW_NOTIFICATION SMALLINT,
+ GATEWAY_EXECUTION_ID VARCHAR(255),
+ PRIMARY KEY(EXPERIMENT_ID),
+ FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
+ FOREIGN KEY (EXECUTION_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE,
+ FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE EXPERIMENT_INPUT
+(
+ EXPERIMENT_ID VARCHAR(255),
+ INPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ METADATA VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ STANDARD_INPUT SMALLINT,
+ USER_FRIENDLY_DESC VARCHAR(255),
+ VALUE CLOB,
+ INPUT_ORDER INTEGER,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_STAGED SMALLINT,
+ PRIMARY KEY(EXPERIMENT_ID,INPUT_KEY),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE EXPERIMENT_OUTPUT
+(
+ EXPERIMENT_ID VARCHAR(255),
+ OUTPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ VALUE CLOB,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_MOVEMENT SMALLINT,
+ DATA_NAME_LOCATION VARCHAR(255),
+ SEARCH_QUERY VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ PRIMARY KEY(EXPERIMENT_ID,OUTPUT_KEY),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
+);
+
+
+CREATE TABLE WORKFLOW_NODE_DETAIL
+(
+ EXPERIMENT_ID VARCHAR(255) NOT NULL,
+ NODE_INSTANCE_ID VARCHAR(255),
+ CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ NODE_NAME VARCHAR(255) NOT NULL,
+ EXECUTION_UNIT VARCHAR(255) NOT NULL,
+ EXECUTION_UNIT_DATA VARCHAR(255),
+ PRIMARY KEY(NODE_INSTANCE_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE TASK_DETAIL
+(
+ TASK_ID VARCHAR(255),
+ NODE_INSTANCE_ID VARCHAR(255),
+ CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ APPLICATION_ID VARCHAR(255),
+ APPLICATION_VERSION VARCHAR(255),
+ APPLICATION_DEPLOYMENT_ID VARCHAR(255),
+ ALLOW_NOTIFICATION SMALLINT,
+ PRIMARY KEY(TASK_ID),
+ FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE NOTIFICATION_EMAIL
+(
+ EMAIL_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ EMAIL_ADDRESS VARCHAR(255),
+ PRIMARY KEY(EMAIL_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE ERROR_DETAIL
+(
+ ERROR_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ NODE_INSTANCE_ID VARCHAR(255),
+ JOB_ID VARCHAR(255),
+ CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ ACTUAL_ERROR_MESSAGE CLOB,
+ USER_FRIEDNLY_ERROR_MSG VARCHAR(255),
+ TRANSIENT_OR_PERSISTENT SMALLINT,
+ ERROR_CATEGORY VARCHAR(255),
+ CORRECTIVE_ACTION VARCHAR(255),
+ ACTIONABLE_GROUP VARCHAR(255),
+ PRIMARY KEY(ERROR_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
+ FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE APPLICATION_INPUT
+(
+ TASK_ID VARCHAR(255),
+ INPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ METADATA VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ STANDARD_INPUT SMALLINT,
+ USER_FRIENDLY_DESC VARCHAR(255),
+ VALUE CLOB,
+ INPUT_ORDER INTEGER,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_STAGED SMALLINT,
+ PRIMARY KEY(TASK_ID,INPUT_KEY),
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE APPLICATION_OUTPUT
+(
+ TASK_ID VARCHAR(255),
+ OUTPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ VALUE CLOB,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_MOVEMENT SMALLINT,
+ DATA_NAME_LOCATION VARCHAR(255),
+ SEARCH_QUERY VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ PRIMARY KEY(TASK_ID,OUTPUT_KEY),
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE NODE_INPUT
+(
+ NODE_INSTANCE_ID VARCHAR(255),
+ INPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ METADATA VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ STANDARD_INPUT SMALLINT,
+ USER_FRIENDLY_DESC VARCHAR(255),
+ VALUE VARCHAR(255),
+ INPUT_ORDER INTEGER,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_STAGED SMALLINT,
+ PRIMARY KEY(NODE_INSTANCE_ID,INPUT_KEY),
+ FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE NODE_OUTPUT
+(
+ NODE_INSTANCE_ID VARCHAR(255),
+ OUTPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ VALUE VARCHAR(255),
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_MOVEMENT SMALLINT,
+ DATA_NAME_LOCATION VARCHAR(255),
+ SEARCH_QUERY VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ PRIMARY KEY(NODE_INSTANCE_ID,OUTPUT_KEY),
+ FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE JOB_DETAIL
+(
+ JOB_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ JOB_DESCRIPTION CLOB NOT NULL,
+ CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ COMPUTE_RESOURCE_CONSUMED VARCHAR(255),
+ JOBNAME VARCHAR (255),
+ WORKING_DIR VARCHAR(255),
+ PRIMARY KEY (TASK_ID, JOB_ID),
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE DATA_TRANSFER_DETAIL
+(
+ TRANSFER_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ TRANSFER_DESC VARCHAR(255) NOT NULL,
+ PRIMARY KEY(TRANSFER_ID),
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE STATUS
+(
+ STATUS_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ EXPERIMENT_ID VARCHAR(255),
+ NODE_INSTANCE_ID VARCHAR(255),
+ TRANSFER_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ JOB_ID VARCHAR(255),
+ STATE VARCHAR(255),
+ STATUS_UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ STATUS_TYPE VARCHAR(255),
+ PRIMARY KEY(STATUS_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
+ FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TRANSFER_ID) REFERENCES DATA_TRANSFER_DETAIL(TRANSFER_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE CONFIG_DATA
+(
+ EXPERIMENT_ID VARCHAR(255),
+ AIRAVATA_AUTO_SCHEDULE SMALLINT NOT NULL,
+ OVERRIDE_MANUAL_SCHEDULE_PARAMS SMALLINT NOT NULL,
+ SHARE_EXPERIMENT SMALLINT,
+ USER_DN VARCHAR(255),
+ GENERATE_CERT SMALLINT,
+ PRIMARY KEY(EXPERIMENT_ID)
+);
+
+CREATE TABLE COMPUTATIONAL_RESOURCE_SCHEDULING
+(
+ RESOURCE_SCHEDULING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ RESOURCE_HOST_ID VARCHAR(255),
+ CPU_COUNT INTEGER,
+ NODE_COUNT INTEGER,
+ NO_OF_THREADS INTEGER,
+ QUEUE_NAME VARCHAR(255),
+ WALLTIME_LIMIT INTEGER,
+ JOB_START_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ TOTAL_PHYSICAL_MEMORY INTEGER,
+ COMPUTATIONAL_PROJECT_ACCOUNT VARCHAR(255),
+ CHESSIS_NAME VARCHAR(255),
+ PRIMARY KEY(RESOURCE_SCHEDULING_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE ADVANCE_INPUT_DATA_HANDLING
+(
+ INPUT_DATA_HANDLING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ WORKING_DIR_PARENT VARCHAR(255),
+ UNIQUE_WORKING_DIR VARCHAR(255),
+ STAGE_INPUT_FILES_TO_WORKING_DIR SMALLINT,
+ CLEAN_AFTER_JOB SMALLINT,
+ PRIMARY KEY(INPUT_DATA_HANDLING_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE ADVANCE_OUTPUT_DATA_HANDLING
+(
+ OUTPUT_DATA_HANDLING_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ OUTPUT_DATA_DIR VARCHAR(255),
+ DATA_REG_URL VARCHAR (255),
+ PERSIST_OUTPUT_DATA SMALLINT,
+ PRIMARY KEY(OUTPUT_DATA_HANDLING_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE QOS_PARAM
+(
+ QOS_ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ START_EXECUTION_AT VARCHAR(255),
+ EXECUTE_BEFORE VARCHAR(255),
+ NO_OF_RETRIES INTEGER,
+ PRIMARY KEY(QOS_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE COMMUNITY_USER
+(
+ GATEWAY_ID VARCHAR(256) NOT NULL,
+ COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
+ TOKEN_ID VARCHAR(256) NOT NULL,
+ COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
+ PRIMARY KEY (GATEWAY_ID, COMMUNITY_USER_NAME, TOKEN_ID)
+);
+
+CREATE TABLE CREDENTIALS
+(
+ GATEWAY_ID VARCHAR(256) NOT NULL,
+ TOKEN_ID VARCHAR(256) NOT NULL,
+ CREDENTIAL BLOB NOT NULL,
+ PORTAL_USER_ID VARCHAR(256) NOT NULL,
+ TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
+);
+
+
[16/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java
deleted file mode 100644
index db1c29f..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.SecurityUtil;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.Users;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import java.security.NoSuchAlgorithmException;
-import java.util.List;
-
-public class UserResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(UserResource.class);
- private String userName;
- private String password;
- /**
- *
- */
- public UserResource() {
- }
-
- /**
- *
- * @param userName user name
- */
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- /**
- *
- * @return user name
- */
- public String getUserName() {
- return userName;
- }
-
-
- /**
- * User is a hypothical data structure.
- * @param type child resource type
- * @return child resource
- */
- public Resource create(ResourceType type) throws RegistryException {
- logger.error("Unsupported resource type for user resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- *
- * @param type child resource type
- * @param name child resource name
- */
- public void remove(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for user resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- *
- * @param type child resource type
- * @param name child resource name
- * @return UnsupportedOperationException
- */
- public Resource get(ResourceType type, Object name) throws RegistryException {
- logger.error("Unsupported resource type for user resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- *
- * @param type child resource type
- * @return UnsupportedOperationException
- */
- public List<Resource> get(ResourceType type) throws RegistryException{
- logger.error("Unsupported resource type for user resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- * save user to the database
- */
- public void save() throws RegistryException {
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- Users existingUser = em.find(Users.class, userName);
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Users user = new Users();
- user.setUser_name(userName);
- if (password != null && !password.equals("")) {
- try {
- user.setPassword(SecurityUtil.digestString(password,
- ServerSettings.getSetting("default.registry.password.hash.method")));
- } catch (NoSuchAlgorithmException e) {
- throw new RuntimeException("Error hashing default admin password. Invalid hash algorithm.", e);
- } catch (ApplicationSettingsException e) {
- throw new RuntimeException("Error reading hash algorithm from configurations", e);
- }
- }
- if (existingUser != null) {
- if (password != null && !password.equals("")) {
- try {
- existingUser.setPassword(SecurityUtil.digestString(password,
- ServerSettings.getSetting("default.registry.password.hash.method")));
- } catch (NoSuchAlgorithmException e) {
- throw new RuntimeException("Error hashing default admin password. Invalid hash algorithm.", e);
- } catch (ApplicationSettingsException e) {
- throw new RuntimeException("Error reading hash algorithm from configurations", e);
- }
- }
- user = em.merge(existingUser);
- } else {
- em.persist(user);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @param type child resource type
- * @param name child resource name
- * @return UnsupportedOperationException
- */
- public boolean isExists(ResourceType type, Object name) throws RegistryException{
- logger.error("Unsupported resource type for user resource.", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
-
- /**
- *
- * @return password
- */
- public String getPassword() {
- return password;
- }
-
- /**
- *
- * @param password password
- */
- public void setPassword(String password) {
- this.password = password;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
deleted file mode 100644
index ae42089..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
+++ /dev/null
@@ -1,1014 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.persistance.registry.jpa.JPAConstants;
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.model.*;
-import org.apache.airavata.registry.cpi.utils.StatusType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Collection;
-import java.util.Iterator;
-
-
-public class Utils {
- private final static Logger logger = LoggerFactory.getLogger(Utils.class);
-
- public static String getJDBCFullURL(){
- String jdbcUrl = getJDBCURL();
- String jdbcUser = getJDBCUser();
- String jdbcPassword = getJDBCPassword();
- jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
- return jdbcUrl;
- }
-
- public static String getJDBCURL(){
- try {
- return ServerSettings.getSetting(JPAConstants.KEY_JDBC_URL);
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- public static String getHost(){
- try{
- String jdbcURL = getJDBCURL();
- String cleanURI = jdbcURL.substring(5);
- URI uri = URI.create(cleanURI);
- return uri.getHost();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- public static int getPort(){
- try{
- String jdbcURL = getJDBCURL();
- String cleanURI = jdbcURL.substring(5);
- URI uri = URI.create(cleanURI);
- return uri.getPort();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- return -1;
- }
- }
-
- public static int getJPACacheSize (){
- try {
- String cache = ServerSettings.getSetting(JPAConstants.JPA_CACHE_SIZE, "5000");
- return Integer.parseInt(cache);
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- return -1;
- }
- }
-
- public static String isCachingEnabled (){
- try {
- return ServerSettings.getSetting(JPAConstants.ENABLE_CACHING, "true");
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- return "true";
- }
- }
-
- public static String getDBType(){
- try{
- String jdbcURL = getJDBCURL();
- String cleanURI = jdbcURL.substring(5);
- URI uri = URI.create(cleanURI);
- return uri.getScheme();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- public static boolean isDerbyStartEnabled(){
- try {
- String s = ServerSettings.getSetting(JPAConstants.KEY_DERBY_START_ENABLE);
- if("true".equals(s)){
- return true;
- }
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return false;
- }
- return false;
- }
-
- public static String getJDBCUser(){
- try {
- return ServerSettings.getSetting(JPAConstants.KEY_JDBC_USER);
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- public static String getValidationQuery(){
- try {
- return ServerSettings.getSetting(JPAConstants.VALIDATION_QUERY);
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- public static String getJDBCPassword(){
- try {
- return ServerSettings.getSetting(JPAConstants.KEY_JDBC_PASSWORD);
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return null;
- }
-
- }
-
- public static String getJDBCDriver(){
- try {
- return ServerSettings.getSetting(JPAConstants.KEY_JDBC_DRIVER);
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- /**
- *
- * @param type model type
- * @param o model type instance
- * @return corresponding resource object
- */
- public static Resource getResource(ResourceType type, Object o) {
- switch (type){
- case GATEWAY:
- if (o instanceof Gateway) {
- return createGateway((Gateway) o);
- } else {
- logger.error("Object should be a Gateway.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Gateway.");
- }
- case PROJECT:
- if (o instanceof Project){
- return createProject((Project) o);
- } else {
- logger.error("Object should be a Project.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Project.");
- }
- case PROJECT_USER:
- if (o instanceof ProjectUser){
- return createProjectUser((ProjectUser)o);
- }else {
- logger.error("Object should be a ProjectUser.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a ProjectUser.");
- }
- case CONFIGURATION:
- if(o instanceof Configuration){
- return createConfiguration((Configuration) o);
- }else {
- logger.error("Object should be a Configuration.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Configuration.");
- }
- case USER:
- if(o instanceof Users) {
- return createUser((Users) o);
- }else {
- logger.error("Object should be a User.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a User.");
- }
- case GATEWAY_WORKER:
- if (o instanceof Gateway_Worker){
- return createGatewayWorker((Gateway_Worker)o);
- } else {
- logger.error("Object should be a Gateway Worker.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Gateway Worker.");
- }
- case EXPERIMENT:
- if (o instanceof Experiment){
- return createExperiment((Experiment)o);
- }else {
- logger.error("Object should be a Experiment.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Experiment.");
- }
- case EXPERIMENT_SUMMARY:
- if (o instanceof Experiment){
- return createExperimentSummary((Experiment)o);
- }else {
- logger.error("Object should be a ExperimentSummary.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a ExperimentSummary.");
- }
- case NOTIFICATION_EMAIL:
- if (o instanceof Notification_Email){
- return createNotificationEmail((Notification_Email)o);
- }else {
- logger.error("Object should be a Experiment.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Experiment.");
- }
- case EXPERIMENT_INPUT:
- if (o instanceof Experiment_Input){
- return createExperimentInput((Experiment_Input)o);
- }else {
- logger.error("Object should be a Experiment input data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Experiment input data.");
- }
- case EXPERIMENT_OUTPUT:
- if (o instanceof Experiment_Output){
- return createExperimentOutput((Experiment_Output)o);
- }else {
- logger.error("Object should be a Experiment output data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Experiment output data.");
- }
- case WORKFLOW_NODE_DETAIL:
- if (o instanceof WorkflowNodeDetail){
- return createWorkflowNodeDetail((WorkflowNodeDetail)o);
- }else {
- logger.error("Object should be a Workflow node data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a Workflow node data.");
- }
- case TASK_DETAIL:
- if (o instanceof TaskDetail){
- return createTaskDetail((TaskDetail)o);
- }else {
- logger.error("Object should be a task detail data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a task detail data.");
- }
- case ERROR_DETAIL:
- if (o instanceof ErrorDetail){
- return createErrorDetail((ErrorDetail)o);
- }else {
- logger.error("Object should be a error detail data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a error detail data.");
- }
- case APPLICATION_INPUT:
- if (o instanceof ApplicationInput){
- return createApplicationInput((ApplicationInput)o);
- }else {
- logger.error("Object should be a application input data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a application input data.");
- }
- case APPLICATION_OUTPUT:
- if (o instanceof ApplicationOutput){
- return createApplicationOutput((ApplicationOutput)o);
- }else {
- logger.error("Object should be a application output data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a application output data.");
- }
- case NODE_INPUT:
- if (o instanceof NodeInput){
- return createNodeInput((NodeInput)o);
- }else {
- logger.error("Object should be a node input data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a node input data.");
- }
- case NODE_OUTPUT:
- if (o instanceof NodeOutput){
- return createNodeOutput((NodeOutput)o);
- }else {
- logger.error("Object should be a node output data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a node output data.");
- }
- case JOB_DETAIL:
- if (o instanceof JobDetail){
- return createJobDetail((JobDetail)o);
- }else {
- logger.error("Object should be a job detail data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a job detail data.");
- }
- case DATA_TRANSFER_DETAIL:
- if (o instanceof DataTransferDetail){
- return createDataTransferResource((DataTransferDetail)o);
- }else {
- logger.error("Object should be a data transfer detail data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a data transfer detail data.");
- }
- case STATUS:
- if (o instanceof Status){
- return createStatusResource((Status)o);
- }else {
- logger.error("Object should be a status data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be a status data.");
- }
- case CONFIG_DATA:
- if (o instanceof ExperimentConfigData){
- return createExConfigDataResource((ExperimentConfigData)o);
- }else {
- logger.error("Object should be a experiment config data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be experiment config data.");
- }
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- if (o instanceof Computational_Resource_Scheduling){
- return createComputationalScheduling((Computational_Resource_Scheduling)o);
- }else {
- logger.error("Object should be a scheduling resource data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be scheduling resource data.");
- }
- case ADVANCE_INPUT_DATA_HANDLING:
- if (o instanceof AdvancedInputDataHandling){
- return createAdvancedInputDataResource((AdvancedInputDataHandling)o);
- }else {
- logger.error("Object should be a advanced input data handling data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be advanced input data handling data.");
- }
- case ADVANCE_OUTPUT_DATA_HANDLING:
- if (o instanceof AdvancedOutputDataHandling){
- return createAdvancedOutputDataResource((AdvancedOutputDataHandling)o);
- }else {
- logger.error("Object should be a advanced output data handling data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be advanced output data handling data.");
- }
- case QOS_PARAM:
- if (o instanceof QosParam){
- return createQosParamResource((QosParam)o);
- }else {
- logger.error("Object should be a QOSparam data.", new IllegalArgumentException());
- throw new IllegalArgumentException("Object should be QOSparam data.");
- }
- default:
- logger.error("Illegal data type..", new IllegalArgumentException());
- throw new IllegalArgumentException("Illegal data type..");
- }
- }
-
- /**
- *
- * @param o Gateway model object
- * @return GatewayResource object
- */
- private static Resource createGateway(Gateway o) {
- GatewayResource gatewayResource = new GatewayResource();
- gatewayResource.setGatewayName(o.getGateway_name());
- gatewayResource.setGatewayId(o.getGateway_id());
- gatewayResource.setDomain(o.getDomain());
- gatewayResource.setEmailAddress(o.getEmailAddress());
- return gatewayResource;
- }
-
- /**
- *
- * @param o Project model object
- * @return ProjectResource object
- */
- private static Resource createProject(Project o) {
- ProjectResource projectResource = new ProjectResource();
- if (o != null){
- projectResource.setId(o.getProject_id());
- projectResource.setName(o.getProject_name());
- projectResource.setGatewayId(o.getGateway_id());
- Gateway_Worker gateway_worker = new Gateway_Worker();
- gateway_worker.setGateway(o.getGateway());
- gateway_worker.setUser(o.getUsers());
- gateway_worker.setUser_name(o.getUsers().getUser_name());
- WorkerResource workerResource = (WorkerResource) createGatewayWorker(gateway_worker);
- projectResource.setWorker(workerResource);
- projectResource.setDescription(o.getDescription());
- projectResource.setCreationTime(o.getCreationTime());
- }
-
- return projectResource;
- }
-
- private static Resource createProjectUser(ProjectUser o) {
- ProjectUserResource projectUserResource = new ProjectUserResource();
- if (o != null){
- projectUserResource.setUserName(o.getUser().getUser_name());
- projectUserResource.setProjectId(o.getProjectID());
- }
- return projectUserResource;
- }
-
- /**
- *
- * @param o configuration model object
- * @return configuration resource object
- */
- private static Resource createConfiguration (Configuration o){
- ConfigurationResource configurationResource = new ConfigurationResource();
- if (o != null){
- configurationResource.setConfigKey(o.getConfig_key());
- configurationResource.setConfigVal(o.getConfig_val());
- configurationResource.setExpireDate(o.getExpire_date());
- configurationResource.setCategoryID(o.getCategory_id());
- }
-
- return configurationResource;
- }
-
- /**
- *
- * @param o Gateway_Worker model object
- * @return Gateway_Worker resource object
- */
- private static Resource createGatewayWorker(Gateway_Worker o) {
- if (o != null){
- WorkerResource workerResource = new WorkerResource();
- workerResource.setGatewayId(o.getGateway_id());
- workerResource.setUser(o.getUser_name());
- return workerResource;
- }
- return null;
- }
-
- /**
- *
- * @param o Users model object
- * @return UserResource object
- */
- private static Resource createUser(Users o) {
- UserResource userResource = new UserResource();
- if (o != null){
- userResource.setUserName(o.getUser_name());
- userResource.setPassword(o.getPassword());
- }
-
- return userResource;
- }
-
- /**
- * @param o Experiment model object
- * @return Experiment resource object
- */
- private static Resource createExperiment(Experiment o) {
- ExperimentResource experimentResource = new ExperimentResource();
- if (o != null){
- experimentResource.setGatewayId(o.getGatewayId());
- experimentResource.setExecutionUser(o.getExecutionUser());
- experimentResource.setProjectId(o.getProjectID());
- experimentResource.setExpID(o.getExpId());
- experimentResource.setExpName(o.getExpName());
- experimentResource.setCreationTime(o.getCreationTime());
- experimentResource.setDescription(o.getExpDesc());
- experimentResource.setApplicationId(o.getApplicationId());
- experimentResource.setApplicationVersion(o.getAppVersion());
- experimentResource.setWorkflowTemplateId(o.getWorkflowTemplateId());
- experimentResource.setWorkflowTemplateVersion(o.getWorkflowTemplateVersion());
- experimentResource.setWorkflowExecutionId(o.getWorkflowExecutionId());
- experimentResource.setEnableEmailNotifications(o.isAllowNotification());
- experimentResource.setGatewayExecutionId(o.getGatewayExecutionId());
- if (o.getExperimentInputs() != null && !o.getExperimentInputs().isEmpty()){
- experimentResource.setExperimentInputResources(getExperimentInputs(o.getExperimentInputs()));
- }
- if (o.getExperimentOutputs() != null && !o.getExperimentOutputs().isEmpty()){
- experimentResource.setExperimentOutputputResources(getExperimentOutputs(o.getExperimentOutputs()));
- }
- if (o.getResourceScheduling() != null){
- experimentResource.setComputationSchedulingResource((ComputationSchedulingResource)createComputationalScheduling(o.getResourceScheduling()));
- }
- if (o.getUserConfigurationData() != null){
- experimentResource.setUserConfigDataResource((ConfigDataResource)createExConfigDataResource(o.getUserConfigurationData()));
- }
-
- if (o.getWorkflowNodeDetails() != null && !o.getWorkflowNodeDetails().isEmpty()){
- experimentResource.setWorkflowNodeDetailResourceList(getWorkflowNodeLit(o.getWorkflowNodeDetails()));
- }
-
- if (o.getStateChangeList() != null && !o.getStateChangeList().isEmpty()){
- experimentResource.setStateChangeList(getStateChangeList(o.getStateChangeList()));
- }
-
- if (o.getErrorDetails() != null && !o.getErrorDetails().isEmpty()){
- experimentResource.setErrorDetailList(getErrorList(o.getErrorDetails()));
- }
-
- if (o.getExperimentStatus() != null){
- experimentResource.setExperimentStatus((StatusResource)createStatusResource(o.getExperimentStatus()));
- }
-
- if (o.getNotificationEmails() != null && !o.getNotificationEmails().isEmpty()){
- experimentResource.setEmailResourceList(getEmailList(o.getNotificationEmails()));
- }
- }
- return experimentResource;
- }
-
- /**
- *
- * @param o ExperimentSummary model object
- * @return ExperimentSummary Resource object
- */
- private static Resource createExperimentSummary(Experiment o) {
- ExperimentSummaryResource experimentSummaryResource = new ExperimentSummaryResource();
- if (o != null){
- experimentSummaryResource.setExecutionUser(o.getExecutionUser());
- experimentSummaryResource.setExpID(o.getExpId());
- experimentSummaryResource.setExpName(o.getExpName());
- experimentSummaryResource.setProjectID(o.getProjectID());
- experimentSummaryResource.setCreationTime(o.getCreationTime());
- experimentSummaryResource.setDescription(o.getExpDesc());
- experimentSummaryResource.setApplicationId(o.getApplicationId());
-
- Status experimentStatus = o.getExperimentStatus();
- if(experimentStatus != null) {
- StatusResource statusResource = new StatusResource();
- statusResource.setStatusId(experimentStatus.getStatusId());
- statusResource.setJobId(experimentStatus.getJobId());
- statusResource.setState(experimentStatus.getState());
- statusResource.setStatusUpdateTime(experimentStatus.getStatusUpdateTime());
- statusResource.setStatusType(experimentStatus.getStatusType());
- experimentSummaryResource.setStatus(statusResource);
- }
- }
-
- return experimentSummaryResource;
- }
-
- private static List<ExperimentInputResource> getExperimentInputs(List<Experiment_Input> inputs){
- List<ExperimentInputResource> inputResources = new ArrayList<ExperimentInputResource>();
- for (Experiment_Input input : inputs){
- inputResources.add((ExperimentInputResource)createExperimentInput(input));
- }
- return inputResources;
- }
-
- private static List<ExperimentOutputResource> getExperimentOutputs(List<Experiment_Output> outputs){
- List<ExperimentOutputResource> outputResources = new ArrayList<>();
- for (Experiment_Output output : outputs){
- outputResources.add((ExperimentOutputResource) createExperimentOutput(output));
- }
- return outputResources;
- }
-
- private static List<NodeInputResource> getNodeInputs(List<NodeInput> inputs){
- List<NodeInputResource> inputResources = new ArrayList<NodeInputResource>();
- for (NodeInput input : inputs){
- inputResources.add((NodeInputResource)createNodeInput(input));
- }
- return inputResources;
- }
-
- private static List<NodeOutputResource> getNodeOutputs(List<NodeOutput> outputs){
- List<NodeOutputResource> outputResources = new ArrayList<>();
- for (NodeOutput output : outputs){
- outputResources.add((NodeOutputResource) createNodeOutput(output));
- }
- return outputResources;
- }
-
- private static List<ApplicationInputResource> getApplicationInputs(List<ApplicationInput> inputs){
- List<ApplicationInputResource> inputResources = new ArrayList<ApplicationInputResource>();
- for (ApplicationInput input : inputs){
- inputResources.add((ApplicationInputResource)createApplicationInput(input));
- }
- return inputResources;
- }
-
- private static List<ApplicationOutputResource> getApplicationOutputs(List<ApplicationOutput> outputs){
- List<ApplicationOutputResource> outputResources = new ArrayList<>();
- for (ApplicationOutput output : outputs){
- outputResources.add((ApplicationOutputResource) createApplicationOutput(output));
- }
- return outputResources;
- }
-
- private static List<WorkflowNodeDetailResource> getWorkflowNodeLit(List<WorkflowNodeDetail> nodes){
- List<WorkflowNodeDetailResource> nodeList = new ArrayList<>();
- for (WorkflowNodeDetail node : nodes){
- nodeList.add((WorkflowNodeDetailResource) createWorkflowNodeDetail(node));
- }
- return nodeList;
- }
-
- private static List<StatusResource> getStateChangeList(List<Status> statusList){
- List<StatusResource> changeList = new ArrayList<>();
- for (Status status : statusList){
- changeList.add((StatusResource) createStatusResource(status));
- }
- return changeList;
- }
-
- private static List<ErrorDetailResource> getErrorList(List<ErrorDetail> errorDetails){
- List<ErrorDetailResource> errors = new ArrayList<>();
- for (ErrorDetail error : errorDetails){
- errors.add((ErrorDetailResource) createErrorDetail(error));
- }
- return errors;
- }
-
- private static List<JobDetailResource> getJobDetails(List<JobDetail> jobDetails){
- List<JobDetailResource> resources = new ArrayList<>();
- for (JobDetail jobDetail : jobDetails){
- resources.add((JobDetailResource) createJobDetail(jobDetail));
- }
- return resources;
- }
-
- private static List<DataTransferDetailResource> getDTDetails(List<DataTransferDetail> dataTransferDetails){
- List<DataTransferDetailResource> resources = new ArrayList<>();
- for (DataTransferDetail detail : dataTransferDetails){
- resources.add((DataTransferDetailResource) createDataTransferResource(detail));
- }
- return resources;
- }
-
- private static List<NotificationEmailResource> getEmailList(List<Notification_Email> emails){
- List<NotificationEmailResource> emailResources = new ArrayList<>();
- for (Notification_Email email : emails){
- emailResources.add((NotificationEmailResource) createNotificationEmail(email));
- }
- return emailResources;
- }
-
- private static Resource createNotificationEmail (Notification_Email o){
- NotificationEmailResource emailResource = new NotificationEmailResource();
- if (o != null){
- emailResource.setExperimentId(o.getExperiment_id());
- emailResource.setTaskId(o.getTaskId());
- emailResource.setEmailAddress(o.getEmailAddress());
- }
- return emailResource;
- }
-
- private static Resource createExperimentInput (Experiment_Input o){
- ExperimentInputResource eInputResource = new ExperimentInputResource();
- if (o != null){
- eInputResource.setExperimentId(o.getExperiment_id());
- eInputResource.setDataType(o.getDataType());
- eInputResource.setMetadata(o.getMetadata());
- eInputResource.setExperimentKey(o.getEx_key());
- eInputResource.setAppArgument(o.getAppArgument());
- eInputResource.setInputOrder(o.getInputOrder());
- eInputResource.setStandardInput(o.isStandardInput());
- eInputResource.setUserFriendlyDesc(o.getUserFriendlyDesc());
- eInputResource.setRequired(o.isRequired());
- eInputResource.setRequiredToCMD(o.isRequiredToCMD());
- eInputResource.setDataStaged(o.isDataStaged());
- if (o.getValue() != null){
- eInputResource.setValue(new String(o.getValue()));
- }
- }
- return eInputResource;
- }
-
- private static Resource createExperimentOutput (Experiment_Output o){
- ExperimentOutputResource eOutputResource = new ExperimentOutputResource();
- if (o != null){
- eOutputResource.setExperimentId(o.getExperiment_id());
- eOutputResource.setExperimentKey(o.getEx_key());
- if (o.getValue() != null){
- eOutputResource.setValue(new String(o.getValue()));
- }
- eOutputResource.setDataType(o.getDataType());
- eOutputResource.setRequired(o.isRequired());
- eOutputResource.setRequiredToCMD(o.isRequiredToCMD());
- eOutputResource.setDataMovement(o.isDataMovement());
- eOutputResource.setDataNameLocation(o.getDataNameLocation());
- eOutputResource.setSearchQuery(o.getSearchQuery());
- eOutputResource.setAppArgument(o.getApplicationArgument());
- }
- return eOutputResource;
- }
-
- private static Resource createWorkflowNodeDetail (WorkflowNodeDetail o){
- WorkflowNodeDetailResource nodeDetailResource = new WorkflowNodeDetailResource();
- if (o != null){
- nodeDetailResource.setExperimentId(o.getExpId());
- nodeDetailResource.setCreationTime(o.getCreationTime());
- nodeDetailResource.setNodeInstanceId(o.getNodeId());
- nodeDetailResource.setNodeName(o.getNodeName());
- nodeDetailResource.setExecutionUnit(o.getExecutionUnit());
- nodeDetailResource.setExecutionUnitData(o.getExecutionUnitData());
- if (o.getTaskDetails() != null && !o.getErrorDetails().isEmpty()){
- nodeDetailResource.setTaskDetailResourceList(getTaskDetails(o.getTaskDetails()));
- }
-
- if (o.getNodeInputs() != null && !o.getNodeInputs().isEmpty()){
- nodeDetailResource.setNodeInputs(getNodeInputs(o.getNodeInputs()));
- }
-
- if (o.getNodeOutputs() != null && !o.getNodeOutputs().isEmpty()){
- nodeDetailResource.setNodeOutputs(getNodeOutputs(o.getNodeOutputs()));
- }
-
- if (o.getNodeStatus() != null){
- nodeDetailResource.setNodeStatus((StatusResource) createStatusResource(o.getNodeStatus()));
- }
-
- if (o.getErrorDetails() != null && !o.getErrorDetails().isEmpty()){
- nodeDetailResource.setErros(getErrorList(o.getErrorDetails()));
- }
- }
- return nodeDetailResource;
- }
-
- private static List<TaskDetailResource> getTaskDetails (List<TaskDetail> taskDetails){
- List<TaskDetailResource> tasks = new ArrayList<>();
- for (TaskDetail detail : taskDetails){
- tasks.add((TaskDetailResource) createTaskDetail(detail));
- }
- return tasks;
- }
-
- private static Resource createTaskDetail(TaskDetail o){
- TaskDetailResource taskDetailResource = new TaskDetailResource();
- if ( o != null){
- taskDetailResource.setNodeId(o.getNodeId());
- taskDetailResource.setCreationTime(o.getCreationTime());
- taskDetailResource.setTaskId(o.getTaskId());
- taskDetailResource.setApplicationId(o.getAppId());
- taskDetailResource.setApplicationVersion(o.getAppVersion());
- taskDetailResource.setApplicationDeploymentId(o.getApplicationDeploymentId());
- taskDetailResource.setEnableEmailNotifications(o.isAllowNotification());
- if (o.getApplicationInputs() != null && !o.getApplicationInputs().isEmpty()){
- taskDetailResource.setApplicationInputs(getApplicationInputs(o.getApplicationInputs()));
- }
- if (o.getApplicationOutputs() != null && !o.getApplicationOutputs().isEmpty()){
- taskDetailResource.setApplicationOutputs(getApplicationOutputs(o.getApplicationOutputs()));
- }
- if (o.getResourceScheduling() != null){
- taskDetailResource.setSchedulingResource((ComputationSchedulingResource) createComputationalScheduling(o.getResourceScheduling()));
-
- }
- if (o.getInputDataHandling() != null){
- taskDetailResource.setInputDataHandlingResource((AdvanceInputDataHandlingResource) createAdvancedInputDataResource(o.getInputDataHandling()));
- }
- if (o.getOutputDataHandling() != null){
- taskDetailResource.setOutputDataHandlingResource((AdvancedOutputDataHandlingResource) createAdvancedOutputDataResource(o.getOutputDataHandling()));
- }
- if (o.getErrorDetails() != null && !o.getErrorDetails().isEmpty()){
- taskDetailResource.setErrors(getErrorList(o.getErrorDetails()));
- }
- if (o.getTaskStatus() != null){
- taskDetailResource.setTaskStatus((StatusResource) createStatusResource(o.getTaskStatus()));
- }
- if (o.getNotificationEmails() != null && !o.getNotificationEmails().isEmpty()){
- taskDetailResource.setEmailResourceList(getEmailList(o.getNotificationEmails()));
- }
- if (o.getJobDetails() != null && !o.getJobDetails().isEmpty()){
- taskDetailResource.setJobDetailResources(getJobDetails(o.getJobDetails()));
- }
- if (o.getDataTransferDetails() != null && !o.getDataTransferDetails().isEmpty()){
- taskDetailResource.setTransferDetailResourceList(getDTDetails(o.getDataTransferDetails()));
- }
-
- }
- return taskDetailResource;
- }
-
- private static Resource createErrorDetail (ErrorDetail o){
- ErrorDetailResource errorDetailResource = new ErrorDetailResource();
- if (o != null){
- errorDetailResource.setExperimentId(o.getExpId());
- errorDetailResource.setTaskId(o.getTaskId());
- errorDetailResource.setNodeId(o.getNodeId());
- errorDetailResource.setErrorId(o.getErrorID());
- errorDetailResource.setJobId(o.getJobId());
- errorDetailResource.setCreationTime(o.getCreationTime());
- if (o.getActualErrorMsg() != null){
- errorDetailResource.setActualErrorMsg(new String(o.getActualErrorMsg()));
- }
- errorDetailResource.setUserFriendlyErrorMsg(o.getUserFriendlyErrorMsg());
- errorDetailResource.setTransientPersistent(o.isTransientPersistent());
- errorDetailResource.setErrorCategory(o.getErrorCategory());
- errorDetailResource.setCorrectiveAction(o.getCorrectiveAction());
- errorDetailResource.setActionableGroup(o.getActionableGroup());
- }
-
- return errorDetailResource;
- }
-
- private static Resource createApplicationInput (ApplicationInput o){
- ApplicationInputResource inputResource = new ApplicationInputResource();
- if (o != null){
- inputResource.setTaskId(o.getTaskId());
- inputResource.setInputKey(o.getInputKey());
- inputResource.setDataType(o.getDataType());
- inputResource.setAppArgument(o.getAppArgument());
- inputResource.setInputOrder(o.getInputOrder());
- inputResource.setStandardInput(o.isStandardInput());
- inputResource.setUserFriendlyDesc(o.getUserFriendlyDesc());
- inputResource.setRequired(o.isRequired());
- inputResource.setRequiredToCMD(o.isRequiredToCMD());
- inputResource.setDataStaged(o.isDataStaged());
- if (o.getValue() != null){
- inputResource.setValue(new String(o.getValue()));
- }
- inputResource.setMetadata(o.getMetadata());
- }
- return inputResource;
- }
-
- private static Resource createApplicationOutput (ApplicationOutput o){
- ApplicationOutputResource outputResource = new ApplicationOutputResource();
- if (o != null){
- outputResource.setTaskId(o.getTaskId());
- outputResource.setDataType(o.getDataType());
- outputResource.setOutputKey(o.getOutputKey());
- if (o.getValue() != null){
- outputResource.setValue(new String(o.getValue()));
- }
- outputResource.setRequired(o.isRequired());
- outputResource.setRequiredToCMD(o.isAddedToCmd());
- outputResource.setDataMovement(o.isDataMovement());
- outputResource.setDataNameLocation(o.getDataNameLocation());
- outputResource.setSearchQuery(o.getSearchQuery());
- outputResource.setAppArgument(o.getApplicationArgument());
- }
- return outputResource;
- }
-
- private static Resource createNodeInput (NodeInput o){
- NodeInputResource inputResource = new NodeInputResource();
- if (o != null){
- inputResource.setNodeId(o.getNodeId());
- inputResource.setInputKey(o.getInputKey());
- inputResource.setDataType(o.getDataType());
- inputResource.setValue(o.getValue());
- inputResource.setMetadata(o.getMetadata());
- inputResource.setAppArgument(o.getAppArgument());
- inputResource.setInputOrder(o.getInputOrder());
- inputResource.setStandardInput(o.isStandardInput());
- inputResource.setUserFriendlyDesc(o.getUserFriendlyDesc());
- inputResource.setRequired(o.getIsRequired());
- inputResource.setRequiredToCMD(o.getRequiredToCMD());
- inputResource.setDataStaged(o.isDataStaged());
- }
- return inputResource;
- }
-
- private static Resource createNodeOutput (NodeOutput o){
- NodeOutputResource outputResource = new NodeOutputResource();
- if (o != null){
- outputResource.setNodeId(o.getNodeId());
- outputResource.setDataType(o.getDataType());
- outputResource.setOutputKey(o.getOutputKey());
- outputResource.setValue(o.getValue());
- outputResource.setRequired(o.isRequired());
- outputResource.setRequiredToCMD(o.isRequiredToCMD());
- outputResource.setDataMovement(o.isDataMovement());
- outputResource.setDataNameLocation(o.getDataNameLocation());
- outputResource.setSearchQuery(o.getSearchQuery());
- outputResource.setAppArgument(o.getApplicationArgument());
- }
-
- return outputResource;
- }
-
- private static Resource createJobDetail (JobDetail o){
- JobDetailResource jobDetailResource = new JobDetailResource();
- if (o != null){
- jobDetailResource.setTaskId(o.getTaskId());
- if (o.getJobDescription() != null){
- jobDetailResource.setJobDescription(new String(o.getJobDescription()));
- }
- jobDetailResource.setJobId(o.getJobId());
- jobDetailResource.setCreationTime(o.getCreationTime());
- jobDetailResource.setComputeResourceConsumed(o.getComputeResourceConsumed());
- jobDetailResource.setJobName(o.getJobName());
- jobDetailResource.setWorkingDir(o.getWorkingDir());
- jobDetailResource.setJobStatus((StatusResource)createStatusResource(o.getJobStatus()));
- jobDetailResource.setErrors(getErrorList(o.getErrorDetails()));
- }
-
- return jobDetailResource;
- }
-
- private static Resource createDataTransferResource (DataTransferDetail o){
- DataTransferDetailResource transferDetailResource = new DataTransferDetailResource();
- if (o != null){
- transferDetailResource.setTaskId(o.getTaskId());
- transferDetailResource.setTransferId(o.getTransferId());
- transferDetailResource.setCreationTime(o.getCreationTime());
- if (o.getTransferDesc() != null){
- transferDetailResource.setTransferDescription(new String(o.getTransferDesc()));
- }
- if (o.getDataTransferStatus() != null){
- transferDetailResource.setDatatransferStatus((StatusResource)createStatusResource(o.getDataTransferStatus()));
- }
- }
- return transferDetailResource;
- }
-
- private static Resource createStatusResource (Status o){
- StatusResource statusResource = new StatusResource();
- if (o != null){
- statusResource.setExperimentId(o.getExpId());
- statusResource.setTaskId(o.getTaskId());
- statusResource.setNodeId(o.getNodeId());
- statusResource.setTransferId(o.getTransferId());
- statusResource.setStatusId(o.getStatusId());
- statusResource.setJobId(o.getJobId());
- statusResource.setState(o.getState());
- statusResource.setStatusUpdateTime(o.getStatusUpdateTime());
- statusResource.setStatusType(o.getStatusType());
- }
-
- return statusResource;
- }
-
- private static Resource createExConfigDataResource (ExperimentConfigData o){
- ConfigDataResource configDataResource = new ConfigDataResource();
- if (o != null){
- configDataResource.setExperimentId(o.getExpId());
- configDataResource.setAiravataAutoSchedule(o.isAiravataAutoSchedule());
- configDataResource.setOverrideManualParams(o.isOverrideManualParams());
- configDataResource.setShareExp(o.isShareExp());
- configDataResource.setUserDn(o.getUserDn());
- configDataResource.setGenerateCert(o.isGenerateCert());
- if (o.getOutputDataHandling() != null){
- configDataResource.setAdvancedOutputDataHandlingResource((AdvancedOutputDataHandlingResource) createAdvancedOutputDataResource(o.getOutputDataHandling()));
- }
- if (o.getInputDataHandling() != null){
- configDataResource.setAdvanceInputDataHandlingResource((AdvanceInputDataHandlingResource) createAdvancedInputDataResource(o.getInputDataHandling()));
- }
- if (o.getResourceScheduling() != null){
- configDataResource.setComputationSchedulingResource((ComputationSchedulingResource) createComputationalScheduling(o.getResourceScheduling()));
- }
- if (o.getQosParam() != null){
- configDataResource.setQosParamResource((QosParamResource) createQosParamResource(o.getQosParam()));
- }
-
- }
- return configDataResource;
- }
-
- private static Resource createComputationalScheduling (Computational_Resource_Scheduling o){
- ComputationSchedulingResource schedulingResource = new ComputationSchedulingResource();
- if (o != null){
- schedulingResource.setExperimentId(o.getExpId());
- schedulingResource.setTaskId(o.getTaskId());
- schedulingResource.setSchedulingId(o.getSchedulingId());
- schedulingResource.setResourceHostId(o.getResourceHostId());
- schedulingResource.setCpuCount(o.getCpuCount());
- schedulingResource.setNodeCount(o.getNodeCount());
- schedulingResource.setNumberOfThreads(o.getNumberOfThreads());
- schedulingResource.setQueueName(o.getQueueName());
- schedulingResource.setWalltimeLimit(o.getWallTimeLimit());
- schedulingResource.setJobStartTime(o.getJobStartTime());
- schedulingResource.setPhysicalMemory(o.getTotalPhysicalmemory());
- schedulingResource.setProjectName(o.getProjectName());
- schedulingResource.setChessisName(o.getChessisName());
- }
-
- return schedulingResource;
- }
-
- private static Resource createAdvancedInputDataResource (AdvancedInputDataHandling o){
- AdvanceInputDataHandlingResource dataHandlingResource = new AdvanceInputDataHandlingResource();
- if (o != null){
- dataHandlingResource.setExperimentId(o.getExpId());
- dataHandlingResource.setTaskId(o.getTaskId());
- dataHandlingResource.setDataHandlingId(o.getDataHandlingId());
- dataHandlingResource.setWorkingDirParent(o.getParentWorkingDir());
- dataHandlingResource.setWorkingDir(o.getWorkingDir());
- dataHandlingResource.setStageInputFiles(o.isStageInputsToWorkingDir());
- dataHandlingResource.setCleanAfterJob(o.isCleanAfterJob());
- }
-
- return dataHandlingResource;
- }
-
- private static Resource createAdvancedOutputDataResource (AdvancedOutputDataHandling o){
- AdvancedOutputDataHandlingResource dataHandlingResource = new AdvancedOutputDataHandlingResource();
- if (o != null){
- dataHandlingResource.setExperimentId(o.getExpId());
- dataHandlingResource.setTaskId(o.getTaskId());
- dataHandlingResource.setOutputDataHandlingId(o.getOutputDataHandlingId());
- dataHandlingResource.setOutputDataDir(o.getOutputDataDir());
- dataHandlingResource.setDataRegUrl(o.getDataRegUrl());
- dataHandlingResource.setPersistOutputData(o.isPersistOutputData());
- }
- return dataHandlingResource;
- }
-
- private static Resource createQosParamResource (QosParam o){
- QosParamResource qosParamResource = new QosParamResource();
- if (o != null){
- qosParamResource.setExperimentId(o.getExpId());
- qosParamResource.setTaskId(o.getTaskId());
- qosParamResource.setQosId(o.getQosId());
- qosParamResource.setExecuteBefore(o.getExecuteBefore());
- qosParamResource.setStartExecutionAt(o.getStartExecutionAt());
- qosParamResource.setNoOfRetries(o.getNoOfRetries());
- }
-
- return qosParamResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
deleted file mode 100644
index a9f0b38..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
+++ /dev/null
@@ -1,727 +0,0 @@
-/*
- *
- * 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.resources;
-
-import org.apache.airavata.model.workspace.experiment.ExperimentState;
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.model.*;
-import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.ResultOrderType;
-import org.apache.airavata.registry.cpi.utils.Constants;
-import org.apache.airavata.registry.cpi.utils.StatusType;
-import org.apache.openjpa.persistence.OpenJPAPersistence;
-import org.apache.openjpa.persistence.OpenJPAQuery;
-import org.apache.openjpa.persistence.jdbc.FetchMode;
-import org.apache.openjpa.persistence.jdbc.JDBCFetchPlan;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-public class WorkerResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(WorkerResource.class);
- private String user;
- private String gatewayId;
-
- public WorkerResource() {
- }
-
- public WorkerResource(String user, String gatewayId) {
- this.user = user;
- this.gatewayId = gatewayId;
- }
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- /**
- * Gateway worker can create child data structures such as projects and user workflows
- * @param type child resource type
- * @return child resource
- */
- public Resource create(ResourceType type) throws RegistryException{
- Resource result = null;
- switch (type) {
- case PROJECT:
- ProjectResource projectResource = new ProjectResource();
- projectResource.setWorker(this);
- projectResource.setGatewayId(gatewayId);
- result=projectResource;
- break;
- case EXPERIMENT:
- ExperimentResource experimentResource = new ExperimentResource();
- experimentResource.setExecutionUser(user);
- experimentResource.setGatewayId(gatewayId);
- result = experimentResource;
- break;
- default:
- logger.error("Unsupported resource type for worker resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported resource type for worker resource.");
-
- }
- return result;
- }
-
- /**
- *
- * @param type child resource type
- * @param name child resource name
- */
- public void remove(ResourceType type, Object name) throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- QueryGenerator generator;
- switch (type) {
- case PROJECT:
- generator = new QueryGenerator(PROJECT);
- generator.setParameter(ProjectConstants.PROJECT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- case EXPERIMENT:
- generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
- q = generator.deleteQuery(em);
- q.executeUpdate();
- break;
- default:
- logger.error("Unsupported resource type for worker resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e.getMessage());
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @param type child resource type
- * @param name child resource name
- * @return child resource
- */
- public Resource get(ResourceType type, Object name) throws RegistryException{
- Resource result = null;
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case PROJECT:
- generator = new QueryGenerator(PROJECT);
- generator.setParameter(ProjectConstants.PROJECT_ID, name);
- q = generator.selectQuery(em);
- Project project = (Project) q.getSingleResult();
- result = Utils.getResource(ResourceType.PROJECT, project);
- break;
- case EXPERIMENT:
- generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
- q = generator.selectQuery(em);
- Experiment experiment = (Experiment) q.getSingleResult();
- result = Utils.getResource(ResourceType.EXPERIMENT, experiment);
- break;
- default:
- logger.error("Unsupported resource type for worker resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return result;
- }
-
-// public List<GFacJobDataResource> getGFacJobs(String serviceDescriptionId, String hostDescriptionId, String applicationDescriptionId){
-// List<GFacJobDataResource> result = new ArrayList<GFacJobDataResource>();
-// EntityManager em = ResourceUtils.getEntityManager();
-// em.getTransaction().begin();
-// QueryGenerator generator;
-// Query q;
-// generator = new QueryGenerator(GFAC_JOB_DATA);
-// generator.setParameter(GFacJobDataConstants.SERVICE_DESC_ID, serviceDescriptionId);
-// generator.setParameter(GFacJobDataConstants.HOST_DESC_ID, hostDescriptionId);
-// generator.setParameter(GFacJobDataConstants.APP_DESC_ID, applicationDescriptionId);
-// q = generator.selectQuery(em);
-// for (Object o : q.getResultList()) {
-// GFac_Job_Data gFacJobData = (GFac_Job_Data)o;
-// result.add((GFacJobDataResource)Utils.getResource(ResourceType.GFAC_JOB_DATA, gFacJobData));
-// }
-// em.getTransaction().commit();
-// em.close();
-// return result;
-// }
-//
-// public List<GFacJobStatusResource> getGFacJobStatuses(String jobId){
-// List<GFacJobStatusResource> resourceList = new ArrayList<GFacJobStatusResource>();
-// EntityManager em = ResourceUtils.getEntityManager();
-// em.getTransaction().begin();
-// QueryGenerator generator;
-// Query q;
-// generator = new QueryGenerator(GFAC_JOB_STATUS);
-// generator.setParameter(GFacJobStatusConstants.LOCAL_JOB_ID, jobId);
-// q = generator.selectQuery(em);
-// for (Object result : q.getResultList()) {
-// GFac_Job_Status gFacJobStatus = (GFac_Job_Status) result;
-// GFacJobStatusResource gFacJobStatusResource =
-// (GFacJobStatusResource)Utils.getResource(ResourceType.GFAC_JOB_STATUS, gFacJobStatus);
-// resourceList.add(gFacJobStatusResource);
-// }
-// return resourceList;
-// }
-
- /**
- * Method get all results of the given child resource type
- *
- * @param type child resource type
- * @return list of child resources
- */
- public List<Resource> get(ResourceType type) throws RegistryException{
- return get(type, -1, -1, null, null);
- }
-
- /**
- * Method get all results of the given child resource type with paginaltion and ordering
- *
- * @param type child resource type
- * @param limit
- * @param offset
- * @param orderByIdentifier
- * @param resultOrderType
- * @return list of child resources
- * @throws RegistryException
- */
- public List<Resource> get(ResourceType type, int limit, int offset, Object orderByIdentifier,
- ResultOrderType resultOrderType) throws RegistryException{
- List<Resource> result = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- QueryGenerator generator;
- Query q;
- switch (type) {
- case PROJECT:
- generator = new QueryGenerator(PROJECT);
- Users users = em.find(Users.class, getUser());
- Gateway gatewayModel = em.find(Gateway.class, gatewayId);
- generator.setParameter("users", users);
- if (gatewayModel != null){
- generator.setParameter("gateway", gatewayModel);
- }
-
- //ordering - only supported only by CREATION_TIME
- if(orderByIdentifier != null && resultOrderType != null
- && orderByIdentifier.equals(Constants.FieldConstants.ProjectConstants.CREATION_TIME)) {
- q = generator.selectQuery(em, ProjectConstants.CREATION_TIME, resultOrderType);
- }else{
- q = generator.selectQuery(em);
- }
-
- //pagination
- if(limit>0 && offset>=0){
- q.setFirstResult(offset);
- q.setMaxResults(limit);
- }
-
- for (Object o : q.getResultList()) {
- Project project = (Project) o;
- ProjectResource projectResource = (ProjectResource) Utils.getResource(ResourceType.PROJECT, project);
- result.add(projectResource);
- }
- break;
- case EXPERIMENT:
- generator = new QueryGenerator(EXPERIMENT);
- generator.setParameter(ExperimentConstants.EXECUTION_USER, getUser());
-
- //ordering - only supported only by CREATION_TIME
- if(orderByIdentifier != null && resultOrderType != null
- && orderByIdentifier.equals(Constants.FieldConstants.ProjectConstants.CREATION_TIME)) {
- q = generator.selectQuery(em, ExperimentConstants.CREATION_TIME, resultOrderType);
- }else{
- q = generator.selectQuery(em);
- }
-
- //pagination
- if(limit>0 && offset>=0){
- q.setFirstResult(offset);
- q.setMaxResults(limit);
- }
- for (Object o : q.getResultList()) {
- Experiment experiment = (Experiment) o;
- ExperimentResource experimentResource = (ExperimentResource) Utils.getResource(ResourceType.EXPERIMENT, experiment);
- result.add(experimentResource);
- }
-
- break;
- default:
- logger.error("Unsupported resource type for worker resource.", new IllegalArgumentException());
- break;
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return result;
- }
-
- /**
- * save gateway worker to database
- */
- public void save() throws RegistryException{
- EntityManager em = null;
- try {
- em = ResourceUtils.getEntityManager();
- Gateway_Worker existingWorker = em.find(Gateway_Worker.class, new Gateway_Worker_PK(gatewayId, user));
- em.close();
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Gateway_Worker gatewayWorker = new Gateway_Worker();
- Users existingUser = em.find(Users.class, this.user);
- gatewayWorker.setUser(existingUser);
- gatewayWorker.setUser_name(existingUser.getUser_name());
- gatewayWorker.setGateway_id(gatewayId);
- if (existingWorker != null) {
- existingWorker.setUser_name(existingUser.getUser_name());
- existingWorker.setUser(existingUser);
- existingWorker.setGateway_id(gatewayId);
- gatewayWorker = em.merge(existingWorker);
- } else {
- em.persist(gatewayWorker);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- /**
- *
- * @return user name
- */
- public String getUser() {
- return user;
- }
-
- /**
- *
- * @param user user name
- */
- public void setUser(String user) {
- this.user = user;
- }
-
- /**
- *
- * @param id project id
- * @return whether the project is available under the user
- */
- public boolean isProjectExists(String id) throws RegistryException{
- return isExists(ResourceType.PROJECT, id);
- }
-
- /**
- *
- * @param projectId project id
- * @return project resource for the user
- */
- public ProjectResource createProject(String projectId) throws RegistryException{
- ProjectResource project=(ProjectResource)create(ResourceType.PROJECT);
- project.setId(projectId);
- return project;
- }
-
- public String getProjectID(String projectName) {
- String pro = projectName.replaceAll("\\s", "");
- return pro + "_" + UUID.randomUUID();
- }
-
- /**
- *
- * @param id project id
- * @return project resource
- */
- public ProjectResource getProject(String id) throws RegistryException{
- return (ProjectResource)get(ResourceType.PROJECT, id);
- }
-
- /**
- *
- * @param id project id
- */
- public void removeProject(String id) throws RegistryException{
- remove(ResourceType.PROJECT, id);
- }
-
- /**
- * Get projects list of user
- * @return list of projects for the user
- */
- public List<ProjectResource> getProjects() throws RegistryException{
- return getProjects(-1, -1, null, null);
- }
-
-
- /**
- * Get projects list of user with pagination and ordering
- *
- * @return list of projects for the user
- */
- public List<ProjectResource> getProjects(int limit, int offset, Object orderByIdentifier,
- ResultOrderType resultOrderType) throws RegistryException{
- List<ProjectResource> result=new ArrayList<ProjectResource>();
- List<Resource> list = get(ResourceType.PROJECT, limit, offset, orderByIdentifier, resultOrderType);
- for (Resource resource : list) {
- result.add((ProjectResource) resource);
- }
- return result;
- }
-
- /**
- *
- * @param name experiment name
- * @return whether experiment is already exist for the given user
- */
- public boolean isExperimentExists(String name) throws RegistryException{
- return isExists(ResourceType.EXPERIMENT, name);
- }
-
-
- /**
- *
- * @param name experiment name
- * @return experiment resource
- */
- public ExperimentResource getExperiment(String name) throws RegistryException{
- return (ExperimentResource)get(ResourceType.EXPERIMENT, name);
- }
-//
-// public GFacJobDataResource getGFacJob(String jobId){
-// return (GFacJobDataResource)get(ResourceType.GFAC_JOB_DATA,jobId);
-// }
-
- /**
- * Method to get list of expeirments of user
- * @return list of experiments for the user
- */
- public List<ExperimentResource> getExperiments() throws RegistryException{
- return getExperiments(-1, -1, null, null);
- }
-
- /**
- * Method to get list of experiments of user with pagination and ordering
- * @param limit
- * @param offset
- * @param orderByIdentifier
- * @param resultOrderType
- * @return
- * @throws RegistryException
- */
- public List<ExperimentResource> getExperiments(int limit, int offset, Object orderByIdentifier,
- ResultOrderType resultOrderType) throws RegistryException{
- List<ExperimentResource> result=new ArrayList<ExperimentResource>();
- List<Resource> list = get(ResourceType.EXPERIMENT, limit, offset, orderByIdentifier, resultOrderType);
- for (Resource resource : list) {
- result.add((ExperimentResource) resource);
- }
- return result;
- }
-
- /**
- *
- * @param experimentId experiment name
- */
- public void removeExperiment(String experimentId) throws RegistryException{
- remove(ResourceType.EXPERIMENT, experimentId);
- }
-
- /**
- * To search the projects of user with the given filter criteria and retrieve the results with
- * pagination support. Results can be ordered based on an identifier (i.e column) either ASC or
- * DESC. But in the current implementation ordering is only supported based on the project
- * creation time
- *
- * @param filters
- * @param limit
- * @param offset
- * @param orderByIdentifier
- * @param resultOrderType
- * @return
- * @throws RegistryException
- */
- public List<ProjectResource> searchProjects(Map<String, String> filters, int limit,
- int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- List<ProjectResource> result = new ArrayList<ProjectResource>();
- EntityManager em = null;
- try {
- String query = "SELECT p from Project p WHERE ";
- if (filters != null && filters.size() != 0) {
- for (String field : filters.keySet()) {
- String filterVal = filters.get(field);
- if (field.equals(ProjectConstants.USERNAME)) {
- query += "p." + field + "= '" + filterVal + "' AND ";
- }else if (field.equals(ProjectConstants.GATEWAY_ID)) {
- query += "p." + field + "= '" + filterVal + "' AND ";
- }else {
- if (filterVal.contains("*")){
- filterVal = filterVal.replaceAll("\\*", "");
- }
- query += "p." + field + " LIKE '%" + filterVal + "%' AND ";
- }
- }
- }
- query = query.substring(0, query.length() - 5);
-
- //ordering
- if( orderByIdentifier != null && resultOrderType != null
- && orderByIdentifier.equals(Constants.FieldConstants.ProjectConstants.CREATION_TIME)){
- String order = (resultOrderType == ResultOrderType.ASC) ? "ASC" : "DESC";
- query += " ORDER BY p." + ProjectConstants.CREATION_TIME + " " + order;
- }
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
-
- //pagination
- if(offset>=0 && limit >=0){
- q = em.createQuery(query).setFirstResult(offset).setMaxResults(limit);
- }else{
- q = em.createQuery(query);
- }
-
- List resultList = q.getResultList();
- for (Object o : resultList) {
- Project project = (Project) o;
- ProjectResource projectResource =
- (ProjectResource) Utils.getResource(ResourceType.PROJECT, project);
- result.add(projectResource);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return result;
- }
-
- /**
- * To search the experiments of user with the given time period and filter criteria and retrieve the results with
- * pagination support. Results can be ordered based on an identifier (i.e column) either ASC or
- * DESC. But in the current implementation ordering is only supported based on creationTime. Also if
- * time period values i.e fromTime and toTime are null they will be ignored.
- *
- * @param fromTime
- * @param toTime
- * @param filters
- * @param limit
- * @param offset
- * @param orderByIdentifier
- * @param resultOrderType
- * @return
- * @throws RegistryException
- */
- public List<ExperimentSummaryResource> searchExperiments(Timestamp fromTime, Timestamp toTime, Map<String, String> filters, int limit,
- int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- List<ExperimentSummaryResource> result = new ArrayList();
- EntityManager em = null;
- try {
- String query;
- if(filters.get(StatusConstants.STATE) != null) {
- query = "SELECT DISTINCT (e) FROM Experiment e " +
- "JOIN e.statuses s LEFT JOIN FETCH e.statuses WHERE " +
- "s.statusType='" + StatusType.EXPERIMENT + "' AND ";
- String experimentState = ExperimentState.valueOf(filters.get(StatusConstants.STATE)).toString();
- query += "s.state='" + experimentState + "' AND ";
- }else{
- query = "SELECT e FROM Experiment e " +
- "LEFT JOIN FETCH e.statuses WHERE ";
- }
-
- if(toTime != null && fromTime != null && toTime.after(fromTime)){
- query += "e.creationTime > '" + fromTime + "' " + "AND e.creationTime <'" + toTime + "' AND ";
- }
-
- filters.remove(StatusConstants.STATE);
- if (filters != null && filters.size() != 0) {
- for (String field : filters.keySet()) {
- String filterVal = filters.get(field);
- if (field.equals(ExperimentConstants.EXECUTION_USER)) {
- query += "e." + field + "= '" + filterVal + "' AND ";
- }else if (field.equals(ExperimentConstants.GATEWAY_ID)) {
- query += "e." + field + "= '" + filterVal + "' AND ";
- } else if (field.equals(ExperimentConstants.PROJECT_ID)) {
- query += "e." + field + "= '" + filterVal + "' AND ";
- } else {
- if (filterVal.contains("*")){
- filterVal = filterVal.replaceAll("\\*", "");
- }
- query += "e." + field + " LIKE '%" + filterVal + "%' AND ";
- }
- }
- }
- query = query.substring(0, query.length() - 5);
-
- //ordering
- if( orderByIdentifier != null && resultOrderType != null
- && orderByIdentifier.equals(Constants.FieldConstants.ExperimentConstants.CREATION_TIME)){
- String order = (resultOrderType == ResultOrderType.ASC) ? "ASC" : "DESC";
- query += " ORDER BY e." + ExperimentConstants.CREATION_TIME + " " + order;
- }
-
- em = ResourceUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
-
- //pagination
- if(offset>=0 && limit >=0){
- q = em.createQuery(query).setFirstResult(offset).setMaxResults(limit);
- }else{
- q = em.createQuery(query);
- }
- OpenJPAQuery kq = OpenJPAPersistence.cast(q);
- JDBCFetchPlan fetch = (JDBCFetchPlan) kq.getFetchPlan();
- fetch.setEagerFetchMode(FetchMode.JOIN);
-
- List resultList = q.getResultList();
- for (Object o : resultList) {
- Experiment experiment = (Experiment) o;
- ExperimentSummaryResource experimentSummaryResource =
- (ExperimentSummaryResource) Utils.getResource(ResourceType.EXPERIMENT_SUMMARY, experiment);
- result.add(experimentSummaryResource);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return result;
- }
-
- /**
- *
- * @return list of experiments for the user
- */
- public List<ExperimentResource> getExperimentsByCaching(String user) throws RegistryException{
- List<ExperimentResource> result = new ArrayList<ExperimentResource>();
- EntityManager em = null;
- try {
- String query = "SELECT e from Experiment e WHERE e.executionUser = '" + user + "'";
- em = ResourceUtils.getEntityManager();
-// OpenJPAEntityManagerFactory oemf = OpenJPAPersistence.cast(em.getEntityManagerFactory());
-// QueryResultCache qcache = oemf.getQueryResultCache();
- // qcache.evictAll(Experiment.class);
- em.getTransaction().begin();
- Query q = em.createQuery(query);
- List resultList = q.getResultList();
- for (Object o : resultList) {
- Experiment experiment = (Experiment) o;
- ExperimentResource experimentResource = (ExperimentResource) Utils.getResource(ResourceType.EXPERIMENT, experiment);
- result.add(experimentResource);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RegistryException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return result;
- }
-}
[14/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/resources/registry-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/resources/registry-mysql.sql b/modules/registry/airavata-jpa-registry/src/main/resources/registry-mysql.sql
deleted file mode 100644
index 14d7fc8..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/resources/registry-mysql.sql
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- *
- * 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.
- *
- */
-CREATE TABLE GATEWAY
-(
- GATEWAY_ID VARCHAR(255),
- GATEWAY_NAME VARCHAR(255),
- DOMAIN VARCHAR(255),
- EMAIL_ADDRESS VARCHAR(255),
- PRIMARY KEY (GATEWAY_ID)
-);
-
-CREATE TABLE CONFIGURATION
-(
- CONFIG_KEY VARCHAR(255),
- CONFIG_VAL VARCHAR(255),
- EXPIRE_DATE TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- CATEGORY_ID VARCHAR (255),
- PRIMARY KEY(CONFIG_KEY, CONFIG_VAL, CATEGORY_ID)
-);
-
-INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL, EXPIRE_DATE, CATEGORY_ID) VALUES('registry.version', '0.15', CURRENT_TIMESTAMP ,'SYSTEM');
-
-CREATE TABLE USERS
-(
- USER_NAME VARCHAR(255),
- PASSWORD VARCHAR(255),
- PRIMARY KEY(USER_NAME)
-);
-
-CREATE TABLE GATEWAY_WORKER
-(
- GATEWAY_ID VARCHAR(255),
- USER_NAME VARCHAR(255),
- PRIMARY KEY (GATEWAY_ID, USER_NAME),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE PROJECT
-(
- GATEWAY_ID VARCHAR(255),
- USER_NAME VARCHAR(255),
- PROJECT_NAME VARCHAR(255) NOT NULL,
- PROJECT_ID VARCHAR(255),
- DESCRIPTION VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- PRIMARY KEY (PROJECT_ID),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE PROJECT_USER
-(
- PROJECT_ID VARCHAR(255),
- USER_NAME VARCHAR(255),
- PRIMARY KEY (PROJECT_ID,USER_NAME),
- FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE,
- FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT
-(
- EXPERIMENT_ID VARCHAR(255),
- GATEWAY_ID VARCHAR(255),
- EXECUTION_USER VARCHAR(255) NOT NULL,
- PROJECT_ID VARCHAR(255) NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- EXPERIMENT_NAME VARCHAR(255) NOT NULL,
- EXPERIMENT_DESCRIPTION VARCHAR(255),
- APPLICATION_ID VARCHAR(255),
- APPLICATION_VERSION VARCHAR(255),
- WORKFLOW_TEMPLATE_ID VARCHAR(255),
- WORKFLOW_TEMPLATE_VERSION VARCHAR(255),
- WORKFLOW_EXECUTION_ID VARCHAR(255),
- ALLOW_NOTIFICATION SMALLINT,
- GATEWAY_EXECUTION_ID VARCHAR(255),
- PRIMARY KEY(EXPERIMENT_ID),
- FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
- FOREIGN KEY (EXECUTION_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE,
- FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT_INPUT
-(
- EXPERIMENT_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- METADATA VARCHAR(255),
- VALUE LONGTEXT,
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(EXPERIMENT_ID,INPUT_KEY),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE EXPERIMENT_OUTPUT
-(
- EXPERIMENT_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE LONGTEXT,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(EXPERIMENT_ID,OUTPUT_KEY),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE WORKFLOW_NODE_DETAIL
-(
- EXPERIMENT_ID VARCHAR(255) NOT NULL,
- NODE_INSTANCE_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- NODE_NAME VARCHAR(255) NOT NULL,
- EXECUTION_UNIT VARCHAR(255) NOT NULL,
- EXECUTION_UNIT_DATA VARCHAR(255),
- PRIMARY KEY(NODE_INSTANCE_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE TASK_DETAIL
-(
- TASK_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- APPLICATION_ID VARCHAR(255),
- APPLICATION_VERSION VARCHAR(255),
- APPLICATION_DEPLOYMENT_ID VARCHAR(255),
- ALLOW_NOTIFICATION SMALLINT,
- PRIMARY KEY(TASK_ID),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NOTIFICATION_EMAIL
-(
- EMAIL_ID INTEGER NOT NULL AUTO_INCREMENT,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- EMAIL_ADDRESS VARCHAR(255),
- PRIMARY KEY(EMAIL_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_INPUT
-(
- TASK_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- METADATA VARCHAR(255),
- VALUE LONGTEXT,
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(TASK_ID,INPUT_KEY),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE APPLICATION_OUTPUT
-(
- TASK_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE LONGTEXT,
- DATA_MOVEMENT SMALLINT,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(TASK_ID,OUTPUT_KEY),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NODE_INPUT
-(
- NODE_INSTANCE_ID VARCHAR(255),
- INPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- STANDARD_INPUT SMALLINT,
- USER_FRIENDLY_DESC VARCHAR(255),
- METADATA VARCHAR(255),
- VALUE VARCHAR(255),
- INPUT_ORDER INTEGER,
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_STAGED SMALLINT,
- PRIMARY KEY(NODE_INSTANCE_ID,INPUT_KEY),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE NODE_OUTPUT
-(
- NODE_INSTANCE_ID VARCHAR(255),
- OUTPUT_KEY VARCHAR(255) NOT NULL,
- DATA_TYPE VARCHAR(255),
- VALUE VARCHAR(255),
- IS_REQUIRED SMALLINT,
- REQUIRED_TO_COMMANDLINE SMALLINT,
- DATA_MOVEMENT SMALLINT,
- DATA_NAME_LOCATION VARCHAR(255),
- SEARCH_QUERY VARCHAR(255),
- APP_ARGUMENT VARCHAR(255),
- PRIMARY KEY(NODE_INSTANCE_ID,OUTPUT_KEY),
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE JOB_DETAIL
-(
- JOB_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- JOB_DESCRIPTION LONGTEXT NOT NULL,
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- COMPUTE_RESOURCE_CONSUMED VARCHAR(255),
- JOBNAME VARCHAR (255),
- WORKING_DIR VARCHAR(255),
- PRIMARY KEY (TASK_ID, JOB_ID),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE DATA_TRANSFER_DETAIL
-(
- TRANSFER_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- TRANSFER_DESC VARCHAR(255) NOT NULL,
- PRIMARY KEY(TRANSFER_ID),
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ERROR_DETAIL
-(
- ERROR_ID INTEGER NOT NULL AUTO_INCREMENT,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- JOB_ID VARCHAR(255),
- CREATION_TIME TIMESTAMP DEFAULT NOW(),
- ACTUAL_ERROR_MESSAGE LONGTEXT,
- USER_FRIEDNLY_ERROR_MSG VARCHAR(255),
- TRANSIENT_OR_PERSISTENT SMALLINT,
- ERROR_CATEGORY VARCHAR(255),
- CORRECTIVE_ACTION VARCHAR(255),
- ACTIONABLE_GROUP VARCHAR(255),
- PRIMARY KEY(ERROR_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE STATUS
-(
- STATUS_ID INTEGER NOT NULL AUTO_INCREMENT,
- EXPERIMENT_ID VARCHAR(255),
- NODE_INSTANCE_ID VARCHAR(255),
- TRANSFER_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- JOB_ID VARCHAR(255),
- STATE VARCHAR(255),
- STATUS_UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ON UPDATE now(),
- STATUS_TYPE VARCHAR(255),
- PRIMARY KEY(STATUS_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
- FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE,
- FOREIGN KEY (TRANSFER_ID) REFERENCES DATA_TRANSFER_DETAIL(TRANSFER_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE CONFIG_DATA
-(
- EXPERIMENT_ID VARCHAR(255),
- AIRAVATA_AUTO_SCHEDULE SMALLINT NOT NULL,
- OVERRIDE_MANUAL_SCHEDULE_PARAMS SMALLINT NOT NULL,
- SHARE_EXPERIMENT SMALLINT,
- USER_DN VARCHAR(255),
- GENERATE_CERT SMALLINT,
- PRIMARY KEY(EXPERIMENT_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
-
-);
-
-CREATE TABLE COMPUTATIONAL_RESOURCE_SCHEDULING
-(
- RESOURCE_SCHEDULING_ID INTEGER NOT NULL AUTO_INCREMENT,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- RESOURCE_HOST_ID VARCHAR(255),
- CPU_COUNT INTEGER,
- NODE_COUNT INTEGER,
- NO_OF_THREADS INTEGER,
- QUEUE_NAME VARCHAR(255),
- WALLTIME_LIMIT INTEGER,
- JOB_START_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- TOTAL_PHYSICAL_MEMORY INTEGER,
- COMPUTATIONAL_PROJECT_ACCOUNT VARCHAR(255),
- CHESSIS_NAME VARCHAR(255),
- PRIMARY KEY(RESOURCE_SCHEDULING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ADVANCE_INPUT_DATA_HANDLING
-(
- INPUT_DATA_HANDLING_ID INTEGER NOT NULL AUTO_INCREMENT,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- WORKING_DIR_PARENT VARCHAR(255),
- UNIQUE_WORKING_DIR VARCHAR(255),
- STAGE_INPUT_FILES_TO_WORKING_DIR SMALLINT,
- CLEAN_AFTER_JOB SMALLINT,
- PRIMARY KEY(INPUT_DATA_HANDLING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE ADVANCE_OUTPUT_DATA_HANDLING
-(
- OUTPUT_DATA_HANDLING_ID INTEGER NOT NULL AUTO_INCREMENT,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- OUTPUT_DATA_DIR VARCHAR(255),
- DATA_REG_URL VARCHAR (255),
- PERSIST_OUTPUT_DATA SMALLINT,
- PRIMARY KEY(OUTPUT_DATA_HANDLING_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE QOS_PARAM
-(
- QOS_ID INTEGER NOT NULL AUTO_INCREMENT,
- EXPERIMENT_ID VARCHAR(255),
- TASK_ID VARCHAR(255),
- START_EXECUTION_AT VARCHAR(255),
- EXECUTE_BEFORE VARCHAR(255),
- NO_OF_RETRIES INTEGER,
- PRIMARY KEY(QOS_ID),
- FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
- FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
-);
-
-CREATE TABLE COMMUNITY_USER
-(
- GATEWAY_ID VARCHAR(256) NOT NULL,
- COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
- TOKEN_ID VARCHAR(256) NOT NULL,
- COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
- PRIMARY KEY (GATEWAY_ID, COMMUNITY_USER_NAME, TOKEN_ID)
-);
-
-CREATE TABLE CREDENTIALS
-(
- GATEWAY_ID VARCHAR(256) NOT NULL,
- TOKEN_ID VARCHAR(256) NOT NULL,
- CREDENTIAL BLOB NOT NULL,
- PORTAL_USER_ID VARCHAR(256) NOT NULL,
- TIME_PERSISTED TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
- PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
-);
-
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/AbstractResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/AbstractResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/AbstractResourceTest.java
deleted file mode 100644
index 35a3258..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/AbstractResourceTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- *
- * 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.common.utils.ServerSettings;
-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.UserResource;
-import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
-import org.apache.airavata.persistance.registry.jpa.util.Initialize;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-import java.sql.Timestamp;
-import java.util.Calendar;
-
-public abstract class AbstractResourceTest {
-
- private GatewayResource gatewayResource;
- private WorkerResource workerResource;
- private UserResource userResource;
- private ProjectResource projectResource;
-
- private static Initialize initialize;
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- initialize = new Initialize("registry-derby.sql");
- initialize.initializeDB();
- }
- @Before
- public void setUp() throws Exception {
- gatewayResource = (GatewayResource)ResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
- workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayName(), ServerSettings.getDefaultUser());
- userResource = (UserResource)ResourceUtils.getUser(ServerSettings.getDefaultUser());
- projectResource = workerResource.getProject("default");
- }
-
- public Timestamp getCurrentTimestamp() {
- Calendar calender = Calendar.getInstance();
- java.util.Date d = calender.getTime();
- return new Timestamp(d.getTime());
- }
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- initialize.stopDerbyServer();
- }
-
-
- public GatewayResource getGatewayResource() {
- return gatewayResource;
- }
-
- public WorkerResource getWorkerResource() {
- return workerResource;
- }
-
- public UserResource getUserResource() {
- return userResource;
- }
-
- public ProjectResource getProjectResource() {
- return projectResource;
- }
-
- public void setProjectResource(ProjectResource projectResource) {
- this.projectResource = projectResource;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ComputationalSchedulingTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ComputationalSchedulingTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ComputationalSchedulingTest.java
deleted file mode 100644
index 645b192..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ComputationalSchedulingTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * 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.ComputationSchedulingResource;
-import org.apache.airavata.persistance.registry.jpa.resources.ExperimentResource;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.sql.Timestamp;
-import java.util.Date;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class ComputationalSchedulingTest extends AbstractResourceTest {
- private ExperimentResource experimentResource;
- private ComputationSchedulingResource schedulingResource;
- private String experimentID = "testExpID";
-
- @Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
- experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- Timestamp currentDate = new Timestamp(new Date().getTime());
- experimentResource.setCreationTime(currentDate);
- experimentResource.setApplicationId("testApplication");
- experimentResource.setApplicationVersion("1.0");
- experimentResource.setDescription("Test Application");
- experimentResource.setExpName("TestExperiment");
- experimentResource.save();
-
- schedulingResource = (ComputationSchedulingResource)experimentResource.create(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING);
- schedulingResource.setResourceHostId("testResource");
- schedulingResource.setCpuCount(10);
- schedulingResource.setNodeCount(5);
- schedulingResource.setPhysicalMemory(1000);
- schedulingResource.setProjectName("project1");
- schedulingResource.setQueueName("testQueue");
- schedulingResource.save();
- System.out.println("scheduling id : " + schedulingResource.getSchedulingId());
- }
-
-
- @Test
- public void testSave() throws Exception {
- assertTrue("Computational schedule successfully", experimentResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, experimentID));
- }
-
- @Test
- public void testRemove() throws Exception {
- experimentResource.remove(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, experimentID);
- assertFalse("Computational schedule removed successfully", experimentResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, experimentID));
- }
-
- @After
- public void tearDown() throws Exception {
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java
deleted file mode 100644
index 693b130..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ConfigurationResourceTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-*
-* 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 static org.junit.Assert.*;
-
-import org.apache.airavata.persistance.registry.jpa.resources.ConfigurationResource;
-import org.junit.After;
-import org.junit.Test;
-
-import java.sql.Timestamp;
-import java.util.Calendar;
-
-public class ConfigurationResourceTest extends AbstractResourceTest {
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- }
- @Test
- public void testSave() throws Exception {
- ConfigurationResource configuration = ResourceUtils.createConfiguration("testConfigKey");
- configuration.setConfigVal("testConfigValue");
- Calendar calender = Calendar.getInstance();
- java.util.Date d = calender.getTime();
- Timestamp currentTime = new Timestamp(d.getTime());
- configuration.setExpireDate(currentTime);
- configuration.setCategoryID("SYSTEM");
- configuration.save();
-
- assertTrue("Configuration Save succuessful", ResourceUtils.isConfigurationExist("testConfigKey"));
- //remove test configuration
- ResourceUtils.removeConfiguration("testConfigKey");
- }
-
- @After
- public void tearDown() throws Exception {
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExecutionErrorResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExecutionErrorResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExecutionErrorResourceTest.java
deleted file mode 100644
index 2d1aeb5..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExecutionErrorResourceTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-///*
-//*
-//* 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.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class ExecutionErrorResourceTest extends AbstractResourceTest {
-// private WorkflowDataResource workflowDataResource;
-// private NodeDataResource nodeDataResource;
-// private ExperimentMetadataResource experimentResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// GatewayResource gatewayResource = super.getGatewayResource();
-// WorkerResource workerResource = super.getWorkerResource();
-//
-// ProjectResource project = new ProjectResource(workerResource, gatewayResource, "testProject");
-// project.save();
-//
-// experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExecutionUser(workerResource.getUser());
-//
-// experimentResource.setProject(project);
-// experimentResource.setDescription("testDescription");
-// experimentResource.setExperimentName("textExpID");
-// experimentResource.setSubmittedDate(getCurrentTimestamp());
-// experimentResource.setShareExp(true);
-// experimentResource.save();
-//
-// workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
-// workflowDataResource.setWorkflowInstanceID("testWFInstance");
-// workflowDataResource.setTemplateName("testTemplate");
-// workflowDataResource.setExperimentID("testExpID");
-// Timestamp timestamp = getCurrentTimestamp();
-// workflowDataResource.setLastUpdatedTime(timestamp);
-// workflowDataResource.save();
-//
-// nodeDataResource = workflowDataResource.createNodeData("testNodeID");
-// nodeDataResource.setWorkflowDataResource(workflowDataResource);
-// nodeDataResource.setInputs("testInput");
-// nodeDataResource.setOutputs("testOutput");
-// nodeDataResource.setStatus("testStatus");
-// nodeDataResource.save();
-// }
-//
-//
-// public void testSave() throws Exception {
-// ExecutionErrorResource executionErrorResource = (ExecutionErrorResource) workflowDataResource.create(ResourceType.EXECUTION_ERROR);
-// executionErrorResource.setErrorCode("testErrorCode");
-// executionErrorResource.setActionTaken("testAction");
-// executionErrorResource.setErrorLocation("testErrorLocation");
-// executionErrorResource.setErrorReference(0);
-// executionErrorResource.setWorkflowDataResource(workflowDataResource);
-//
-// executionErrorResource.setMetadataResource(experimentResource);
-// executionErrorResource.setNodeID(nodeDataResource.getNodeID());
-// executionErrorResource.setGfacJobID("testGfacJobID");
-// executionErrorResource.setErrorDes("testDes");
-// executionErrorResource.setErrorMsg("errorMsg");
-// executionErrorResource.save();
-// System.out.println(executionErrorResource.getErrorID());
-//
-// assertTrue("Execution Error saved successfully", workflowDataResource.isExists(ResourceType.EXECUTION_ERROR, executionErrorResource.getErrorID()));
-//
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentDataResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentDataResourceTest.java
deleted file mode 100644
index 487f977..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentDataResourceTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-///*
-//*
-//* 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.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class ExperimentDataResourceTest extends AbstractResourceTest {
-// private ExperimentDataResource experimentDataResource;
-// private ExperimentResource experimentResource;
-// private WorkflowDataResource workflowDataResource;
-// private ExperimentMetadataResource experimentMetadataResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// GatewayResource gatewayResource = super.getGatewayResource();
-// WorkerResource workerResource = super.getWorkerResource();
-//
-// experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setWorker(workerResource);
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.save();
-//
-// experimentDataResource = (ExperimentDataResource) experimentResource.create(ResourceType.EXPERIMENT_DATA);
-// experimentDataResource.setExpName("testExpID");
-// experimentDataResource.setUserName(workerResource.getUser());
-// experimentDataResource.save();
-//
-// experimentMetadataResource = experimentDataResource.createExperimentMetadata();
-// workflowDataResource = experimentDataResource.createWorkflowInstanceResource("testWorkflowInstance");
-//
-// experimentMetadataResource.setExpID("testExpID");
-// experimentMetadataResource.setMetadata("testMetadata");
-// experimentMetadataResource.save();
-//
-// workflowDataResource.setExperimentID("testExpID");
-// workflowDataResource.setStatus("testStatus");
-// workflowDataResource.setTemplateName("testWorkflowInstance");
-//
-// Calendar calender = Calendar.getInstance();
-// java.util.Date d = calender.getTime();
-// Timestamp currentTime = new Timestamp(d.getTime());
-//
-// workflowDataResource.setLastUpdatedTime(currentTime);
-// workflowDataResource.setStartTime(currentTime);
-// workflowDataResource.save();
-// }
-//
-// public void testCreate() throws Exception {
-// assertNotNull("workflowdata resource created", workflowDataResource);
-// assertNotNull("experimemt metadata resource created", experimentMetadataResource);
-// }
-//
-// public void testGet() throws Exception {
-// assertNotNull("workflow data retrieved successfully", experimentDataResource.getWorkflowInstance("testWorkflowInstance"));
-// assertNotNull("experiment meta data retrieved successfully", experimentDataResource.getExperimentMetadata());
-// }
-//
-// public void testGetList() throws Exception {
-// assertNotNull("workflow data retrieved successfully", experimentDataResource.get(ResourceType.WORKFLOW_DATA));
-// assertNotNull("experiment meta data retrieved successfully", experimentDataResource.get(ResourceType.EXPERIMENT_METADATA));
-// }
-//
-// public void testSave() throws Exception {
-// experimentDataResource.save();
-// assertTrue("experiment data saved successfully", experimentResource.isExists(ResourceType.EXPERIMENT_DATA, "testExpID"));
-// }
-//
-// public void testRemove() throws Exception {
-// experimentDataResource.remove(ResourceType.WORKFLOW_DATA, "testWFInstanceID");
-// assertTrue("workflow data resource removed successfully", !experimentResource.isExists(ResourceType.EXPERIMENT_DATA, "testWFInstanceID"));
-//
-// experimentDataResource.remove(ResourceType.EXPERIMENT_METADATA, "testExpID");
-// assertTrue("experiment meta data resource removed successfully", !experimentDataResource.isExists(ResourceType.EXPERIMENT_METADATA, "testExpID"));
-//
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-//
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentInputResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentInputResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentInputResourceTest.java
deleted file mode 100644
index 9e8d926..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentInputResourceTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-*
-* 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.*;
-import org.junit.After;
-import org.junit.Test;
-
-import java.util.List;
-
-import static org.junit.Assert.assertTrue;
-
-
-public class ExperimentInputResourceTest extends AbstractResourceTest {
- private ExperimentResource experimentResource;
- private String experimentID = "testExpID";
- ExperimentInputResource experimentInputResource;
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- experimentResource.setCreationTime(getCurrentTimestamp());
- experimentResource.setApplicationId("testApplication");
- experimentResource.setApplicationVersion("1.0");
- experimentResource.setDescription("Test Application");
- experimentResource.setExpName("TestExperiment");
- experimentResource.save();
-
- experimentInputResource = (ExperimentInputResource)experimentResource.create(ResourceType.EXPERIMENT_INPUT);
- experimentInputResource.setExperimentId(experimentID);
- experimentInputResource.setExperimentKey("testKey");
- experimentInputResource.setValue("testValue");
- experimentInputResource.setDataType("string");
- experimentInputResource.save();
- }
-
- @Test
- public void testSave() throws Exception {
- assertTrue("Experiment Input saved successfully", experimentResource.isExists(ResourceType.EXPERIMENT_INPUT, experimentID));
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testGet () throws Exception {
- List<ExperimentInputResource> experimentInputs = experimentResource.getExperimentInputs();
- System.out.println("input counts : " + experimentInputs.size());
- assertTrue("Experiment input retrieved successfully...", experimentInputs.size() > 0);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentMetadataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentMetadataResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentMetadataResourceTest.java
deleted file mode 100644
index 8d6e22e..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentMetadataResourceTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-///*
-//*
-//* 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.*;
-//
-//import java.sql.Date;
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class ExperimentMetadataResourceTest extends AbstractResourceTest {
-//
-// private GatewayResource gatewayResource;
-// private WorkflowDataResource workflowDataResource;
-// private ExperimentMetadataResource experimentResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// gatewayResource = super.getGatewayResource();
-// WorkerResource workerResource = super.getWorkerResource();
-// experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExecutionUser("admin");
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.setDescription("testDescription");
-// experimentResource.setExperimentName("textExpID");
-// experimentResource.setSubmittedDate(getCurrentTimestamp());
-// experimentResource.setShareExp(true);
-// experimentResource.save();
-//
-// ExperimentConfigDataResource exConfig = (ExperimentConfigDataResource)experimentResource.create(ResourceType.EXPERIMENT_CONFIG_DATA);
-// exConfig.setExpID("testExpID");
-// exConfig.setNodeCount(5);
-// exConfig.setCpuCount(10);
-// exConfig.setApplicationID("testApp");
-// exConfig.setApplicationVersion("testAppVersion");
-// exConfig.save();
-//
-// workflowDataResource = experimentResource.createWorkflowInstanceResource("testWFInstance");
-// workflowDataResource.setExperimentID("testExpID");
-// workflowDataResource.setStatus("testStatus");
-// workflowDataResource.setTemplateName("testWFInstance");
-// workflowDataResource.setLastUpdatedTime(getCurrentTimestamp());
-// workflowDataResource.setStartTime(getCurrentTimestamp());
-// workflowDataResource.save();
-// }
-//
-// public void testSave() throws Exception {
-// assertTrue("experiment meta data saved successfully", gatewayResource.isExists(ResourceType.EXPERIMENT_METADATA, "testExpID"));
-//
-// }
-//
-// public void testRemove() throws Exception {
-// experimentResource.remove(ResourceType.WORKFLOW_DATA, "testWFInstance");
-// assertTrue("workflow data resource removed successfully", !experimentResource.isExists(ResourceType.WORKFLOW_DATA, "testWFInstance"));
-// }
-//
-// public void testGet() throws Exception {
-// assertNotNull("experiment configuration retrieved successfully...", experimentResource.get(ResourceType.EXPERIMENT_CONFIG_DATA, "testExpID"));
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentOutputResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentOutputResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentOutputResourceTest.java
deleted file mode 100644
index bfd3d57..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentOutputResourceTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-*
-* 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.ExperimentOutputResource;
-import org.apache.airavata.persistance.registry.jpa.resources.ExperimentResource;
-import org.junit.After;
-import org.junit.Test;
-
-import java.util.List;
-
-import static org.junit.Assert.assertTrue;
-
-
-public class ExperimentOutputResourceTest extends AbstractResourceTest {
- private ExperimentResource experimentResource;
- private String experimentID = "testExpID";
- ExperimentOutputResource outputResource;
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- experimentResource.setCreationTime(getCurrentTimestamp());
- experimentResource.setApplicationId("testApplication");
- experimentResource.setApplicationVersion("1.0");
- experimentResource.setDescription("Test Application");
- experimentResource.setExpName("TestExperiment");
- experimentResource.save();
-
- outputResource = (ExperimentOutputResource)experimentResource.create(ResourceType.EXPERIMENT_OUTPUT);
- outputResource.setExperimentId(experimentResource.getExpID());
- outputResource.setExperimentKey("testKey");
- outputResource.setValue("testValue");
- outputResource.setDataType("string");
- outputResource.save();
- }
-
- @Test
- public void testSave() throws Exception {
- assertTrue("Experiment output saved successfully", experimentResource.isExists(ResourceType.EXPERIMENT_OUTPUT, experimentID));
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testGet () throws Exception {
- List<ExperimentOutputResource> outputs = experimentResource.getExperimentOutputs();
- System.out.println("output counts : " + outputs.size());
- assertTrue("Experiment output retrieved successfully...", outputs.size() > 0);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentResourceTest.java
deleted file mode 100644
index 477db6b..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ExperimentResourceTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-*
-* 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 static org.junit.Assert.*;
-
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.Date;
-
-import org.apache.airavata.persistance.registry.jpa.resources.ExperimentResource;
-import org.junit.After;
-import org.junit.Test;
-
-public class ExperimentResourceTest extends AbstractResourceTest {
- private ExperimentResource experimentResource;
- private String experimentID = "testExpID";
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
- experimentResource.setExpID(experimentID);
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- Timestamp currentDate = new Timestamp(new Date().getTime());
- experimentResource.setCreationTime(currentDate);
- experimentResource.setApplicationId("testApplication");
- experimentResource.setApplicationVersion("1.0");
- experimentResource.setDescription("Test Application");
- experimentResource.setExpName("TestExperiment");
- experimentResource.save();
- }
-
- @Test
- public void testCreate() throws Exception {
- assertNotNull("experiment data resource has being created ", experimentResource);
- }
-
- @Test
- public void testSave() throws Exception {
- assertTrue("experiment save successfully", getGatewayResource().isExists(ResourceType.EXPERIMENT, experimentID));
- }
-
- @Test
- public void testGet() throws Exception {
- assertNotNull("experiment data retrieved successfully", getGatewayResource().get(ResourceType.EXPERIMENT, experimentID));
- }
-
- @Test
- public void testRemove() throws Exception {
- getGatewayResource().remove(ResourceType.EXPERIMENT, experimentID);
- assertFalse("experiment data removed successfully", getGatewayResource().isExists(ResourceType.EXPERIMENT, experimentID));
- }
-
- @After
- public void tearDown() throws Exception {
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GFacJobDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GFacJobDataResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GFacJobDataResourceTest.java
deleted file mode 100644
index 7c6a191..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GFacJobDataResourceTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-///*
-//*
-//* 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.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class GFacJobDataResourceTest extends AbstractResourceTest {
-// private WorkerResource workerResource;
-// private WorkflowDataResource workflowDataResource;
-// private ExperimentMetadataResource experimentResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// GatewayResource gatewayResource = super.getGatewayResource();
-// workerResource = super.getWorkerResource();
-//
-// experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExperimentName("testExpID");
-// experimentResource.setExecutionUser(workerResource.getUser());
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.save();
-//
-// workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
-// workflowDataResource.setWorkflowInstanceID("testWFInstance");
-// workflowDataResource.setTemplateName("testTemplate");
-// workflowDataResource.setExperimentID("testExpID");
-// Calendar calender = Calendar.getInstance();
-// java.util.Date d = calender.getTime();
-// Timestamp timestamp = new Timestamp(d.getTime());
-// workflowDataResource.setLastUpdatedTime(timestamp);
-// workflowDataResource.save();
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-// public void testSave() throws Exception {
-// GFacJobDataResource resource = (GFacJobDataResource)workflowDataResource.create(ResourceType.GFAC_JOB_DATA);
-// resource.setLocalJobID("testJobID");
-// resource.setApplicationDescID("testApplication");
-// resource.setMetadataResource(experimentResource);
-// resource.setNodeID("testNode");
-// resource.setHostDescID("testHost");
-// resource.setServiceDescID("testService");
-// resource.setStatus("testStatus");
-// resource.setJobData("testJobData");
-// resource.save();
-// assertTrue("GFac job data saved successfully", workerResource.isGFacJobExists("testJobID"));
-//// workflowDataResource.remove(ResourceType.GFAC_JOB_DATA, "testJobID");
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GFacJobStatusResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GFacJobStatusResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GFacJobStatusResourceTest.java
deleted file mode 100644
index 1254e33..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GFacJobStatusResourceTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-///*
-//*
-//* 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.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//import java.util.List;
-//
-//public class GFacJobStatusResourceTest extends AbstractResourceTest {
-// private GFacJobDataResource gFacJobDataResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// GatewayResource gatewayResource = super.getGatewayResource();
-// WorkerResource workerResource = super.getWorkerResource();
-//
-// ExperimentMetadataResource experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExperimentName("testExpID");
-// experimentResource.setExecutionUser(workerResource.getUser());
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.save();
-//
-//
-// WorkflowDataResource workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
-// workflowDataResource.setWorkflowInstanceID("testWFInstance");
-// workflowDataResource.setTemplateName("testTemplate");
-// workflowDataResource.setExperimentID("testExpID");
-// Calendar calender = Calendar.getInstance();
-// java.util.Date d = calender.getTime();
-// Timestamp timestamp = new Timestamp(d.getTime());
-// workflowDataResource.setLastUpdatedTime(timestamp);
-// workflowDataResource.save();
-//
-// gFacJobDataResource = (GFacJobDataResource) workflowDataResource.create(ResourceType.GFAC_JOB_DATA);
-// gFacJobDataResource.setLocalJobID("testJobID");
-// gFacJobDataResource.setApplicationDescID("testApplication");
-// gFacJobDataResource.setMetadataResource(experimentResource);
-// gFacJobDataResource.setNodeID("testNode");
-// gFacJobDataResource.setHostDescID("testHost");
-// gFacJobDataResource.setServiceDescID("testService");
-// gFacJobDataResource.setStatus("testStatus");
-// gFacJobDataResource.setJobData("testJobData");
-// gFacJobDataResource.save();
-//
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-// public void testSave() throws Exception {
-// GFacJobStatusResource resource = (GFacJobStatusResource)gFacJobDataResource.create(ResourceType.GFAC_JOB_STATUS);
-// resource.setStatus("testStatus");
-// resource.setgFacJobDataResource(gFacJobDataResource);
-// Calendar calender = Calendar.getInstance();
-// java.util.Date d = calender.getTime();
-// Timestamp timestamp = new Timestamp(d.getTime());
-// resource.setStatusUpdateTime(timestamp);
-// resource.save();
-// List<Resource> resources = gFacJobDataResource.get(ResourceType.GFAC_JOB_STATUS);
-// assertTrue("GFac job status saved successfully", resources.size() != 0);
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
deleted file mode 100644
index 1c65a62..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
-*
-* 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 static org.junit.Assert.*;
-
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.persistance.registry.jpa.resources.*;
-import org.junit.After;
-import org.junit.Test;
-
-import java.sql.Timestamp;
-import java.util.Date;
-
-
-public class GatewayResourceTest extends AbstractResourceTest {
- private GatewayResource gatewayResource;
- private ProjectResource projectResource;
- private UserResource userResource;
- private WorkerResource workerResource;
- private ExperimentResource experimentResource;
-
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- Timestamp currentDate = new Timestamp(new Date().getTime());
-
- gatewayResource = super.getGatewayResource();
- workerResource = super.getWorkerResource();
- userResource = super.getUserResource();
- if (gatewayResource == null) {
- gatewayResource = (GatewayResource) ResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
- }
- projectResource = (ProjectResource) gatewayResource.create(ResourceType.PROJECT);
- projectResource.setId("testProject");
- projectResource.setName("testProject");
- projectResource.setWorker(workerResource);
- projectResource.save();
-
- experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
-
- experimentResource.setExpID("testExpID");
- experimentResource.setExecutionUser(getWorkerResource().getUser());
- experimentResource.setProjectId(getProjectResource().getId());
- experimentResource.setCreationTime(currentDate);
- experimentResource.setApplicationId("testApplication");
- experimentResource.setApplicationVersion("1.0");
- experimentResource.setDescription("Test Application");
- experimentResource.setExpName("TestExperiment");
- experimentResource.save();
- }
- @Test
- public void testSave() throws Exception {
- gatewayResource.setDomain("owner1");
- gatewayResource.save();
-
- boolean gatewayExist = ResourceUtils.isGatewayExist(ServerSettings.getDefaultUserGateway());
- assertTrue("The gateway exisits", gatewayExist);
-
- }
-
- @Test
- public void testCreate() throws Exception {
- assertNotNull("project resource cannot be null", projectResource);
- assertNotNull("user resource cannot be null", userResource);
- assertNotNull("worker resource cannot be null", workerResource);
- assertNotNull("experiment resource cannot be null", experimentResource);
- }
-
- @Test
- public void testIsExists() throws Exception {
- assertTrue(gatewayResource.isExists(ResourceType.GATEWAY_WORKER, ServerSettings.getDefaultUser()));
- assertTrue(gatewayResource.isExists(ResourceType.EXPERIMENT, "testExpID"));
- }
-
- @Test
- public void testGet() throws Exception {
- assertNotNull(gatewayResource.get(ResourceType.GATEWAY_WORKER, ServerSettings.getDefaultUser()));
- assertNotNull(gatewayResource.get(ResourceType.EXPERIMENT, "testExpID"));
- }
-
- @Test
- public void testGetList() throws Exception {
- assertNotNull(gatewayResource.get(ResourceType.GATEWAY_WORKER));
- assertNotNull(gatewayResource.get(ResourceType.PROJECT));
- assertNotNull(gatewayResource.get(ResourceType.EXPERIMENT));
- }
-
- @Test
- public void testRemove() throws Exception {
-
- gatewayResource.remove(ResourceType.EXPERIMENT, "testExpID");
- assertFalse(gatewayResource.isExists(ResourceType.EXPERIMENT, "testExpID"));
-
- }
-
- @After
- public void tearDown() throws Exception {
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GramDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GramDataResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GramDataResourceTest.java
deleted file mode 100644
index 4fd1894..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GramDataResourceTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-///*
-//*
-//* 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.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class GramDataResourceTest extends AbstractResourceTest {
-// private WorkflowDataResource workflowDataResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// GatewayResource gatewayResource = super.getGatewayResource();
-// WorkerResource workerResource = super.getWorkerResource();
-//
-// ExperimentMetadataResource experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExperimentName("testExpID");
-// experimentResource.setExecutionUser(workerResource.getUser());
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.save();
-//
-// workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
-// workflowDataResource.setWorkflowInstanceID("testWFInstance");
-// workflowDataResource.setTemplateName("testTemplate");
-// workflowDataResource.setExperimentID("testExpID");
-// Calendar calender = Calendar.getInstance();
-// java.util.Date d = calender.getTime();
-// Timestamp timestamp = new Timestamp(d.getTime());
-// workflowDataResource.setLastUpdatedTime(timestamp);
-// workflowDataResource.save();
-// }
-//
-// public void testSave() throws Exception {
-// GramDataResource gramDataResource = workflowDataResource.createGramData("testNode");
-// gramDataResource.setWorkflowDataResource(workflowDataResource);
-// gramDataResource.setInvokedHost("testhost");
-// gramDataResource.setRsl("testRSL");
-// gramDataResource.save();
-//
-// assertTrue("gram data saved successfully", workflowDataResource.isGramDataExists("testNode"));
-//
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/NodeDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/NodeDataResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/NodeDataResourceTest.java
deleted file mode 100644
index ff5cf7e..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/NodeDataResourceTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-///*
-//*
-//* 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.*;
-//
-//import java.sql.Timestamp;
-//import java.util.Calendar;
-//
-//public class NodeDataResourceTest extends AbstractResourceTest {
-// private WorkflowDataResource workflowDataResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// GatewayResource gatewayResource = super.getGatewayResource();
-// WorkerResource workerResource = super.getWorkerResource();
-//
-// ExperimentMetadataResource experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExperimentName("testExpID");
-// experimentResource.setExecutionUser(workerResource.getUser());
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.save();
-//
-// workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
-// workflowDataResource.setWorkflowInstanceID("testWFInstance");
-// workflowDataResource.setTemplateName("testTemplate");
-// workflowDataResource.setExperimentID("testExpID");
-// Calendar calender = Calendar.getInstance();
-// java.util.Date d = calender.getTime();
-// Timestamp timestamp = new Timestamp(d.getTime());
-// workflowDataResource.setLastUpdatedTime(timestamp);
-// workflowDataResource.save();
-// }
-//
-// public void testSave() throws Exception {
-// NodeDataResource nodeDataResource = workflowDataResource.createNodeData("testNodeID");
-// nodeDataResource.setInputs("testInput");
-//
-// nodeDataResource.setStatus("testStatus");
-// nodeDataResource.setExecutionIndex(0);
-// nodeDataResource.save();
-//
-// assertTrue("node data resource saved successfully", workflowDataResource.isNodeExists("testNodeID"));
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/OrchestratorDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/OrchestratorDataResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/OrchestratorDataResourceTest.java
deleted file mode 100644
index ad552e5..0000000
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/OrchestratorDataResourceTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-///*
-// *
-// * 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 java.util.UUID;
-//
-//import org.apache.airavata.common.utils.AiravataJobState;
-//import org.apache.airavata.persistance.registry.jpa.resources.*;
-//
-//public class OrchestratorDataResourceTest extends AbstractResourceTest{
-// private OrchestratorDataResource dataResource;
-// private ExperimentMetadataResource experimentResource;
-// private WorkerResource workerResource;
-//// private String experimentID = UUID.randomUUID().toString();
-// private String applicationName = "echo_test";
-// private GatewayResource gatewayResource;
-//
-// @Override
-// public void setUp() throws Exception {
-// super.setUp();
-// gatewayResource = super.getGatewayResource();
-// workerResource = super.getWorkerResource();
-//
-// experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
-// experimentResource.setExpID("testExpID");
-// experimentResource.setExperimentName("testExpID");
-// experimentResource.setExecutionUser(workerResource.getUser());
-// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
-// experimentResource.save();
-//
-// dataResource = (OrchestratorDataResource) gatewayResource.create(ResourceType.ORCHESTRATOR);
-//
-// }
-//
-// public void testSave() throws Exception {
-// dataResource.setExperimentID("testExpID");
-// dataResource.setStatus(AiravataJobState.State.CREATED.toString());
-// dataResource.setApplicationName(applicationName);
-// dataResource.save();
-// assertNotNull("Orchestrator data resource created successfully", dataResource);
-// // Get saved data
-// assertNotNull("Orchestrator data resource get successfully", gatewayResource.get(ResourceType.ORCHESTRATOR, "testExpID"));
-// }
-//
-// @Override
-// public void tearDown() throws Exception {
-// super.tearDown();
-// }
-//
-//
-//}
[02/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/main/resources/registry-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/main/resources/registry-mysql.sql b/modules/registry/experiment-catalog/src/main/resources/registry-mysql.sql
new file mode 100644
index 0000000..14d7fc8
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/main/resources/registry-mysql.sql
@@ -0,0 +1,392 @@
+/*
+ *
+ * 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.
+ *
+ */
+CREATE TABLE GATEWAY
+(
+ GATEWAY_ID VARCHAR(255),
+ GATEWAY_NAME VARCHAR(255),
+ DOMAIN VARCHAR(255),
+ EMAIL_ADDRESS VARCHAR(255),
+ PRIMARY KEY (GATEWAY_ID)
+);
+
+CREATE TABLE CONFIGURATION
+(
+ CONFIG_KEY VARCHAR(255),
+ CONFIG_VAL VARCHAR(255),
+ EXPIRE_DATE TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ CATEGORY_ID VARCHAR (255),
+ PRIMARY KEY(CONFIG_KEY, CONFIG_VAL, CATEGORY_ID)
+);
+
+INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL, EXPIRE_DATE, CATEGORY_ID) VALUES('registry.version', '0.15', CURRENT_TIMESTAMP ,'SYSTEM');
+
+CREATE TABLE USERS
+(
+ USER_NAME VARCHAR(255),
+ PASSWORD VARCHAR(255),
+ PRIMARY KEY(USER_NAME)
+);
+
+CREATE TABLE GATEWAY_WORKER
+(
+ GATEWAY_ID VARCHAR(255),
+ USER_NAME VARCHAR(255),
+ PRIMARY KEY (GATEWAY_ID, USER_NAME),
+ FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
+ FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE PROJECT
+(
+ GATEWAY_ID VARCHAR(255),
+ USER_NAME VARCHAR(255),
+ PROJECT_NAME VARCHAR(255) NOT NULL,
+ PROJECT_ID VARCHAR(255),
+ DESCRIPTION VARCHAR(255),
+ CREATION_TIME TIMESTAMP DEFAULT NOW(),
+ PRIMARY KEY (PROJECT_ID),
+ FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
+ FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE PROJECT_USER
+(
+ PROJECT_ID VARCHAR(255),
+ USER_NAME VARCHAR(255),
+ PRIMARY KEY (PROJECT_ID,USER_NAME),
+ FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (USER_NAME) REFERENCES USERS(USER_NAME) ON DELETE CASCADE
+);
+
+CREATE TABLE EXPERIMENT
+(
+ EXPERIMENT_ID VARCHAR(255),
+ GATEWAY_ID VARCHAR(255),
+ EXECUTION_USER VARCHAR(255) NOT NULL,
+ PROJECT_ID VARCHAR(255) NOT NULL,
+ CREATION_TIME TIMESTAMP DEFAULT NOW(),
+ EXPERIMENT_NAME VARCHAR(255) NOT NULL,
+ EXPERIMENT_DESCRIPTION VARCHAR(255),
+ APPLICATION_ID VARCHAR(255),
+ APPLICATION_VERSION VARCHAR(255),
+ WORKFLOW_TEMPLATE_ID VARCHAR(255),
+ WORKFLOW_TEMPLATE_VERSION VARCHAR(255),
+ WORKFLOW_EXECUTION_ID VARCHAR(255),
+ ALLOW_NOTIFICATION SMALLINT,
+ GATEWAY_EXECUTION_ID VARCHAR(255),
+ PRIMARY KEY(EXPERIMENT_ID),
+ FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE,
+ FOREIGN KEY (EXECUTION_USER) REFERENCES USERS(USER_NAME) ON DELETE CASCADE,
+ FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE EXPERIMENT_INPUT
+(
+ EXPERIMENT_ID VARCHAR(255),
+ INPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ STANDARD_INPUT SMALLINT,
+ USER_FRIENDLY_DESC VARCHAR(255),
+ METADATA VARCHAR(255),
+ VALUE LONGTEXT,
+ INPUT_ORDER INTEGER,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_STAGED SMALLINT,
+ PRIMARY KEY(EXPERIMENT_ID,INPUT_KEY),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE EXPERIMENT_OUTPUT
+(
+ EXPERIMENT_ID VARCHAR(255),
+ OUTPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ VALUE LONGTEXT,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_MOVEMENT SMALLINT,
+ DATA_NAME_LOCATION VARCHAR(255),
+ SEARCH_QUERY VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ PRIMARY KEY(EXPERIMENT_ID,OUTPUT_KEY),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE WORKFLOW_NODE_DETAIL
+(
+ EXPERIMENT_ID VARCHAR(255) NOT NULL,
+ NODE_INSTANCE_ID VARCHAR(255),
+ CREATION_TIME TIMESTAMP DEFAULT NOW(),
+ NODE_NAME VARCHAR(255) NOT NULL,
+ EXECUTION_UNIT VARCHAR(255) NOT NULL,
+ EXECUTION_UNIT_DATA VARCHAR(255),
+ PRIMARY KEY(NODE_INSTANCE_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE TASK_DETAIL
+(
+ TASK_ID VARCHAR(255),
+ NODE_INSTANCE_ID VARCHAR(255),
+ CREATION_TIME TIMESTAMP DEFAULT NOW(),
+ APPLICATION_ID VARCHAR(255),
+ APPLICATION_VERSION VARCHAR(255),
+ APPLICATION_DEPLOYMENT_ID VARCHAR(255),
+ ALLOW_NOTIFICATION SMALLINT,
+ PRIMARY KEY(TASK_ID),
+ FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE NOTIFICATION_EMAIL
+(
+ EMAIL_ID INTEGER NOT NULL AUTO_INCREMENT,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ EMAIL_ADDRESS VARCHAR(255),
+ PRIMARY KEY(EMAIL_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE APPLICATION_INPUT
+(
+ TASK_ID VARCHAR(255),
+ INPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ STANDARD_INPUT SMALLINT,
+ USER_FRIENDLY_DESC VARCHAR(255),
+ METADATA VARCHAR(255),
+ VALUE LONGTEXT,
+ INPUT_ORDER INTEGER,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_STAGED SMALLINT,
+ PRIMARY KEY(TASK_ID,INPUT_KEY),
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE APPLICATION_OUTPUT
+(
+ TASK_ID VARCHAR(255),
+ OUTPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ VALUE LONGTEXT,
+ DATA_MOVEMENT SMALLINT,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_NAME_LOCATION VARCHAR(255),
+ SEARCH_QUERY VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ PRIMARY KEY(TASK_ID,OUTPUT_KEY),
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE NODE_INPUT
+(
+ NODE_INSTANCE_ID VARCHAR(255),
+ INPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ STANDARD_INPUT SMALLINT,
+ USER_FRIENDLY_DESC VARCHAR(255),
+ METADATA VARCHAR(255),
+ VALUE VARCHAR(255),
+ INPUT_ORDER INTEGER,
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_STAGED SMALLINT,
+ PRIMARY KEY(NODE_INSTANCE_ID,INPUT_KEY),
+ FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE NODE_OUTPUT
+(
+ NODE_INSTANCE_ID VARCHAR(255),
+ OUTPUT_KEY VARCHAR(255) NOT NULL,
+ DATA_TYPE VARCHAR(255),
+ VALUE VARCHAR(255),
+ IS_REQUIRED SMALLINT,
+ REQUIRED_TO_COMMANDLINE SMALLINT,
+ DATA_MOVEMENT SMALLINT,
+ DATA_NAME_LOCATION VARCHAR(255),
+ SEARCH_QUERY VARCHAR(255),
+ APP_ARGUMENT VARCHAR(255),
+ PRIMARY KEY(NODE_INSTANCE_ID,OUTPUT_KEY),
+ FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE JOB_DETAIL
+(
+ JOB_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ JOB_DESCRIPTION LONGTEXT NOT NULL,
+ CREATION_TIME TIMESTAMP DEFAULT NOW(),
+ COMPUTE_RESOURCE_CONSUMED VARCHAR(255),
+ JOBNAME VARCHAR (255),
+ WORKING_DIR VARCHAR(255),
+ PRIMARY KEY (TASK_ID, JOB_ID),
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE DATA_TRANSFER_DETAIL
+(
+ TRANSFER_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ CREATION_TIME TIMESTAMP DEFAULT NOW(),
+ TRANSFER_DESC VARCHAR(255) NOT NULL,
+ PRIMARY KEY(TRANSFER_ID),
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE ERROR_DETAIL
+(
+ ERROR_ID INTEGER NOT NULL AUTO_INCREMENT,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ NODE_INSTANCE_ID VARCHAR(255),
+ JOB_ID VARCHAR(255),
+ CREATION_TIME TIMESTAMP DEFAULT NOW(),
+ ACTUAL_ERROR_MESSAGE LONGTEXT,
+ USER_FRIEDNLY_ERROR_MSG VARCHAR(255),
+ TRANSIENT_OR_PERSISTENT SMALLINT,
+ ERROR_CATEGORY VARCHAR(255),
+ CORRECTIVE_ACTION VARCHAR(255),
+ ACTIONABLE_GROUP VARCHAR(255),
+ PRIMARY KEY(ERROR_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
+ FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE STATUS
+(
+ STATUS_ID INTEGER NOT NULL AUTO_INCREMENT,
+ EXPERIMENT_ID VARCHAR(255),
+ NODE_INSTANCE_ID VARCHAR(255),
+ TRANSFER_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ JOB_ID VARCHAR(255),
+ STATE VARCHAR(255),
+ STATUS_UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ON UPDATE now(),
+ STATUS_TYPE VARCHAR(255),
+ PRIMARY KEY(STATUS_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE,
+ FOREIGN KEY (NODE_INSTANCE_ID) REFERENCES WORKFLOW_NODE_DETAIL(NODE_INSTANCE_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TRANSFER_ID) REFERENCES DATA_TRANSFER_DETAIL(TRANSFER_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE CONFIG_DATA
+(
+ EXPERIMENT_ID VARCHAR(255),
+ AIRAVATA_AUTO_SCHEDULE SMALLINT NOT NULL,
+ OVERRIDE_MANUAL_SCHEDULE_PARAMS SMALLINT NOT NULL,
+ SHARE_EXPERIMENT SMALLINT,
+ USER_DN VARCHAR(255),
+ GENERATE_CERT SMALLINT,
+ PRIMARY KEY(EXPERIMENT_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE
+
+);
+
+CREATE TABLE COMPUTATIONAL_RESOURCE_SCHEDULING
+(
+ RESOURCE_SCHEDULING_ID INTEGER NOT NULL AUTO_INCREMENT,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ RESOURCE_HOST_ID VARCHAR(255),
+ CPU_COUNT INTEGER,
+ NODE_COUNT INTEGER,
+ NO_OF_THREADS INTEGER,
+ QUEUE_NAME VARCHAR(255),
+ WALLTIME_LIMIT INTEGER,
+ JOB_START_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ TOTAL_PHYSICAL_MEMORY INTEGER,
+ COMPUTATIONAL_PROJECT_ACCOUNT VARCHAR(255),
+ CHESSIS_NAME VARCHAR(255),
+ PRIMARY KEY(RESOURCE_SCHEDULING_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE ADVANCE_INPUT_DATA_HANDLING
+(
+ INPUT_DATA_HANDLING_ID INTEGER NOT NULL AUTO_INCREMENT,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ WORKING_DIR_PARENT VARCHAR(255),
+ UNIQUE_WORKING_DIR VARCHAR(255),
+ STAGE_INPUT_FILES_TO_WORKING_DIR SMALLINT,
+ CLEAN_AFTER_JOB SMALLINT,
+ PRIMARY KEY(INPUT_DATA_HANDLING_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE ADVANCE_OUTPUT_DATA_HANDLING
+(
+ OUTPUT_DATA_HANDLING_ID INTEGER NOT NULL AUTO_INCREMENT,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ OUTPUT_DATA_DIR VARCHAR(255),
+ DATA_REG_URL VARCHAR (255),
+ PERSIST_OUTPUT_DATA SMALLINT,
+ PRIMARY KEY(OUTPUT_DATA_HANDLING_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE QOS_PARAM
+(
+ QOS_ID INTEGER NOT NULL AUTO_INCREMENT,
+ EXPERIMENT_ID VARCHAR(255),
+ TASK_ID VARCHAR(255),
+ START_EXECUTION_AT VARCHAR(255),
+ EXECUTE_BEFORE VARCHAR(255),
+ NO_OF_RETRIES INTEGER,
+ PRIMARY KEY(QOS_ID),
+ FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (TASK_ID) REFERENCES TASK_DETAIL(TASK_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE COMMUNITY_USER
+(
+ GATEWAY_ID VARCHAR(256) NOT NULL,
+ COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
+ TOKEN_ID VARCHAR(256) NOT NULL,
+ COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
+ PRIMARY KEY (GATEWAY_ID, COMMUNITY_USER_NAME, TOKEN_ID)
+);
+
+CREATE TABLE CREDENTIALS
+(
+ GATEWAY_ID VARCHAR(256) NOT NULL,
+ TOKEN_ID VARCHAR(256) NOT NULL,
+ CREDENTIAL BLOB NOT NULL,
+ PORTAL_USER_ID VARCHAR(256) NOT NULL,
+ TIME_PERSISTED TIMESTAMP DEFAULT NOW() ON UPDATE NOW(),
+ PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
+);
+
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java
new file mode 100644
index 0000000..021ff1a
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java
@@ -0,0 +1,91 @@
+/*
+ *
+ * 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.experiment.catalog;
+
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.experiment.catalog.resources.GatewayResource;
+import org.apache.airavata.experiment.catalog.resources.ProjectResource;
+import org.apache.airavata.experiment.catalog.resources.UserResource;
+import org.apache.airavata.experiment.catalog.resources.WorkerResource;
+import org.apache.airavata.experiment.catalog.util.Initialize;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+
+public abstract class AbstractResourceTest {
+
+ private GatewayResource gatewayResource;
+ private WorkerResource workerResource;
+ private UserResource userResource;
+ private ProjectResource projectResource;
+
+ private static Initialize initialize;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ initialize = new Initialize("registry-derby.sql");
+ initialize.initializeDB();
+ }
+ @Before
+ public void setUp() throws Exception {
+ gatewayResource = (GatewayResource) ResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
+ workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayName(), ServerSettings.getDefaultUser());
+ userResource = (UserResource)ResourceUtils.getUser(ServerSettings.getDefaultUser());
+ projectResource = workerResource.getProject("default");
+ }
+
+ public Timestamp getCurrentTimestamp() {
+ Calendar calender = Calendar.getInstance();
+ java.util.Date d = calender.getTime();
+ return new Timestamp(d.getTime());
+ }
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ initialize.stopDerbyServer();
+ }
+
+
+ public GatewayResource getGatewayResource() {
+ return gatewayResource;
+ }
+
+ public WorkerResource getWorkerResource() {
+ return workerResource;
+ }
+
+ public UserResource getUserResource() {
+ return userResource;
+ }
+
+ public ProjectResource getProjectResource() {
+ return projectResource;
+ }
+
+ public void setProjectResource(ProjectResource projectResource) {
+ this.projectResource = projectResource;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java
new file mode 100644
index 0000000..3f0115a
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java
@@ -0,0 +1,84 @@
+/*
+ *
+ * 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.experiment.catalog;
+
+import org.apache.airavata.experiment.catalog.resources.ComputationSchedulingResource;
+import org.apache.airavata.experiment.catalog.resources.ExperimentResource;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.sql.Timestamp;
+import java.util.Date;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class ComputationalSchedulingTest extends AbstractResourceTest {
+ private ExperimentResource experimentResource;
+ private ComputationSchedulingResource schedulingResource;
+ private String experimentID = "testExpID";
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
+ experimentResource.setExpID(experimentID);
+ experimentResource.setExecutionUser(getWorkerResource().getUser());
+ experimentResource.setProjectId(getProjectResource().getId());
+ Timestamp currentDate = new Timestamp(new Date().getTime());
+ experimentResource.setCreationTime(currentDate);
+ experimentResource.setApplicationId("testApplication");
+ experimentResource.setApplicationVersion("1.0");
+ experimentResource.setDescription("Test Application");
+ experimentResource.setExpName("TestExperiment");
+ experimentResource.save();
+
+ schedulingResource = (ComputationSchedulingResource)experimentResource.create(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING);
+ schedulingResource.setResourceHostId("testResource");
+ schedulingResource.setCpuCount(10);
+ schedulingResource.setNodeCount(5);
+ schedulingResource.setPhysicalMemory(1000);
+ schedulingResource.setProjectName("project1");
+ schedulingResource.setQueueName("testQueue");
+ schedulingResource.save();
+ System.out.println("scheduling id : " + schedulingResource.getSchedulingId());
+ }
+
+
+ @Test
+ public void testSave() throws Exception {
+ assertTrue("Computational schedule successfully", experimentResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, experimentID));
+ }
+
+ @Test
+ public void testRemove() throws Exception {
+ experimentResource.remove(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, experimentID);
+ assertFalse("Computational schedule removed successfully", experimentResource.isExists(ResourceType.COMPUTATIONAL_RESOURCE_SCHEDULING, experimentID));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java
new file mode 100644
index 0000000..66f025e
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java
@@ -0,0 +1,58 @@
+/*
+*
+* 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.experiment.catalog;
+
+import static org.junit.Assert.*;
+
+import org.apache.airavata.experiment.catalog.resources.ConfigurationResource;
+import org.junit.After;
+import org.junit.Test;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+
+public class ConfigurationResourceTest extends AbstractResourceTest {
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+ @Test
+ public void testSave() throws Exception {
+ ConfigurationResource configuration = ResourceUtils.createConfiguration("testConfigKey");
+ configuration.setConfigVal("testConfigValue");
+ Calendar calender = Calendar.getInstance();
+ java.util.Date d = calender.getTime();
+ Timestamp currentTime = new Timestamp(d.getTime());
+ configuration.setExpireDate(currentTime);
+ configuration.setCategoryID("SYSTEM");
+ configuration.save();
+
+ assertTrue("Configuration Save succuessful", ResourceUtils.isConfigurationExist("testConfigKey"));
+ //remove test configuration
+ ResourceUtils.removeConfiguration("testConfigKey");
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExecutionErrorResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExecutionErrorResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExecutionErrorResourceTest.java
new file mode 100644
index 0000000..b61a16c
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExecutionErrorResourceTest.java
@@ -0,0 +1,95 @@
+///*
+//*
+//* 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.experiment.registry.jpa;
+//
+//import org.apache.airavata.experiment.registry.jpa.resources.*;
+//
+//import java.sql.Timestamp;
+//import java.util.Calendar;
+//
+//public class ExecutionErrorResourceTest extends AbstractResourceTest {
+// private WorkflowDataResource workflowDataResource;
+// private NodeDataResource nodeDataResource;
+// private ExperimentMetadataResource experimentResource;
+//
+// @Override
+// public void setUp() throws Exception {
+// super.setUp();
+// GatewayResource gatewayResource = super.getGatewayResource();
+// WorkerResource workerResource = super.getWorkerResource();
+//
+// ProjectResource project = new ProjectResource(workerResource, gatewayResource, "testProject");
+// project.save();
+//
+// experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
+// experimentResource.setExpID("testExpID");
+// experimentResource.setExecutionUser(workerResource.getUser());
+//
+// experimentResource.setProject(project);
+// experimentResource.setDescription("testDescription");
+// experimentResource.setExperimentName("textExpID");
+// experimentResource.setSubmittedDate(getCurrentTimestamp());
+// experimentResource.setShareExp(true);
+// experimentResource.save();
+//
+// workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
+// workflowDataResource.setWorkflowInstanceID("testWFInstance");
+// workflowDataResource.setTemplateName("testTemplate");
+// workflowDataResource.setExperimentID("testExpID");
+// Timestamp timestamp = getCurrentTimestamp();
+// workflowDataResource.setLastUpdatedTime(timestamp);
+// workflowDataResource.save();
+//
+// nodeDataResource = workflowDataResource.createNodeData("testNodeID");
+// nodeDataResource.setWorkflowDataResource(workflowDataResource);
+// nodeDataResource.setInputs("testInput");
+// nodeDataResource.setOutputs("testOutput");
+// nodeDataResource.setStatus("testStatus");
+// nodeDataResource.save();
+// }
+//
+//
+// public void testSave() throws Exception {
+// ExecutionErrorResource executionErrorResource = (ExecutionErrorResource) workflowDataResource.create(ResourceType.EXECUTION_ERROR);
+// executionErrorResource.setErrorCode("testErrorCode");
+// executionErrorResource.setActionTaken("testAction");
+// executionErrorResource.setErrorLocation("testErrorLocation");
+// executionErrorResource.setErrorReference(0);
+// executionErrorResource.setWorkflowDataResource(workflowDataResource);
+//
+// executionErrorResource.setMetadataResource(experimentResource);
+// executionErrorResource.setNodeID(nodeDataResource.getNodeID());
+// executionErrorResource.setGfacJobID("testGfacJobID");
+// executionErrorResource.setErrorDes("testDes");
+// executionErrorResource.setErrorMsg("errorMsg");
+// executionErrorResource.save();
+// System.out.println(executionErrorResource.getErrorID());
+//
+// assertTrue("Execution Error saved successfully", workflowDataResource.isExists(ResourceType.EXECUTION_ERROR, executionErrorResource.getErrorID()));
+//
+// }
+//
+// @Override
+// public void tearDown() throws Exception {
+// super.tearDown();
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentDataResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentDataResourceTest.java
new file mode 100644
index 0000000..1df8091
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentDataResourceTest.java
@@ -0,0 +1,107 @@
+///*
+//*
+//* 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.experiment.registry.jpa;
+//
+//import org.apache.airavata.experiment.registry.jpa.resources.*;
+//
+//import java.sql.Timestamp;
+//import java.util.Calendar;
+//
+//public class ExperimentDataResourceTest extends AbstractResourceTest {
+// private ExperimentDataResource experimentDataResource;
+// private ExperimentResource experimentResource;
+// private WorkflowDataResource workflowDataResource;
+// private ExperimentMetadataResource experimentMetadataResource;
+//
+// @Override
+// public void setUp() throws Exception {
+// super.setUp();
+// GatewayResource gatewayResource = super.getGatewayResource();
+// WorkerResource workerResource = super.getWorkerResource();
+//
+// experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+// experimentResource.setExpID("testExpID");
+// experimentResource.setWorker(workerResource);
+// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+// experimentResource.save();
+//
+// experimentDataResource = (ExperimentDataResource) experimentResource.create(ResourceType.EXPERIMENT_DATA);
+// experimentDataResource.setExpName("testExpID");
+// experimentDataResource.setUserName(workerResource.getUser());
+// experimentDataResource.save();
+//
+// experimentMetadataResource = experimentDataResource.createExperimentMetadata();
+// workflowDataResource = experimentDataResource.createWorkflowInstanceResource("testWorkflowInstance");
+//
+// experimentMetadataResource.setExpID("testExpID");
+// experimentMetadataResource.setMetadata("testMetadata");
+// experimentMetadataResource.save();
+//
+// workflowDataResource.setExperimentID("testExpID");
+// workflowDataResource.setStatus("testStatus");
+// workflowDataResource.setTemplateName("testWorkflowInstance");
+//
+// Calendar calender = Calendar.getInstance();
+// java.util.Date d = calender.getTime();
+// Timestamp currentTime = new Timestamp(d.getTime());
+//
+// workflowDataResource.setLastUpdatedTime(currentTime);
+// workflowDataResource.setStartTime(currentTime);
+// workflowDataResource.save();
+// }
+//
+// public void testCreate() throws Exception {
+// assertNotNull("workflowdata resource created", workflowDataResource);
+// assertNotNull("experimemt metadata resource created", experimentMetadataResource);
+// }
+//
+// public void testGet() throws Exception {
+// assertNotNull("workflow data retrieved successfully", experimentDataResource.getWorkflowInstance("testWorkflowInstance"));
+// assertNotNull("experiment meta data retrieved successfully", experimentDataResource.getExperimentMetadata());
+// }
+//
+// public void testGetList() throws Exception {
+// assertNotNull("workflow data retrieved successfully", experimentDataResource.get(ResourceType.WORKFLOW_DATA));
+// assertNotNull("experiment meta data retrieved successfully", experimentDataResource.get(ResourceType.EXPERIMENT_METADATA));
+// }
+//
+// public void testSave() throws Exception {
+// experimentDataResource.save();
+// assertTrue("experiment data saved successfully", experimentResource.isExists(ResourceType.EXPERIMENT_DATA, "testExpID"));
+// }
+//
+// public void testRemove() throws Exception {
+// experimentDataResource.remove(ResourceType.WORKFLOW_DATA, "testWFInstanceID");
+// assertTrue("workflow data resource removed successfully", !experimentResource.isExists(ResourceType.EXPERIMENT_DATA, "testWFInstanceID"));
+//
+// experimentDataResource.remove(ResourceType.EXPERIMENT_METADATA, "testExpID");
+// assertTrue("experiment meta data resource removed successfully", !experimentDataResource.isExists(ResourceType.EXPERIMENT_METADATA, "testExpID"));
+//
+// }
+//
+// @Override
+// public void tearDown() throws Exception {
+// super.tearDown();
+// }
+//
+//
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java
new file mode 100644
index 0000000..5372877
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java
@@ -0,0 +1,75 @@
+/*
+*
+* 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.experiment.catalog;
+
+import org.apache.airavata.experiment.catalog.resources.*;
+import org.junit.After;
+import org.junit.Test;
+
+import java.util.List;
+
+import static org.junit.Assert.assertTrue;
+
+
+public class ExperimentInputResourceTest extends AbstractResourceTest {
+ private ExperimentResource experimentResource;
+ private String experimentID = "testExpID";
+ ExperimentInputResource experimentInputResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
+ experimentResource.setExpID(experimentID);
+ experimentResource.setExecutionUser(getWorkerResource().getUser());
+ experimentResource.setProjectId(getProjectResource().getId());
+ experimentResource.setCreationTime(getCurrentTimestamp());
+ experimentResource.setApplicationId("testApplication");
+ experimentResource.setApplicationVersion("1.0");
+ experimentResource.setDescription("Test Application");
+ experimentResource.setExpName("TestExperiment");
+ experimentResource.save();
+
+ experimentInputResource = (ExperimentInputResource)experimentResource.create(ResourceType.EXPERIMENT_INPUT);
+ experimentInputResource.setExperimentId(experimentID);
+ experimentInputResource.setExperimentKey("testKey");
+ experimentInputResource.setValue("testValue");
+ experimentInputResource.setDataType("string");
+ experimentInputResource.save();
+ }
+
+ @Test
+ public void testSave() throws Exception {
+ assertTrue("Experiment Input saved successfully", experimentResource.isExists(ResourceType.EXPERIMENT_INPUT, experimentID));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGet () throws Exception {
+ List<ExperimentInputResource> experimentInputs = experimentResource.getExperimentInputs();
+ System.out.println("input counts : " + experimentInputs.size());
+ assertTrue("Experiment input retrieved successfully...", experimentInputs.size() > 0);
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentMetadataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentMetadataResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentMetadataResourceTest.java
new file mode 100644
index 0000000..86ca3d6
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentMetadataResourceTest.java
@@ -0,0 +1,87 @@
+///*
+//*
+//* 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.experiment.registry.jpa;
+//
+//
+//import org.apache.airavata.experiment.registry.jpa.resources.*;
+//
+//import java.sql.Date;
+//import java.sql.Timestamp;
+//import java.util.Calendar;
+//
+//public class ExperimentMetadataResourceTest extends AbstractResourceTest {
+//
+// private GatewayResource gatewayResource;
+// private WorkflowDataResource workflowDataResource;
+// private ExperimentMetadataResource experimentResource;
+//
+// @Override
+// public void setUp() throws Exception {
+// super.setUp();
+// gatewayResource = super.getGatewayResource();
+// WorkerResource workerResource = super.getWorkerResource();
+// experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
+// experimentResource.setExpID("testExpID");
+// experimentResource.setExecutionUser("admin");
+// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+// experimentResource.setDescription("testDescription");
+// experimentResource.setExperimentName("textExpID");
+// experimentResource.setSubmittedDate(getCurrentTimestamp());
+// experimentResource.setShareExp(true);
+// experimentResource.save();
+//
+// ExperimentConfigDataResource exConfig = (ExperimentConfigDataResource)experimentResource.create(ResourceType.EXPERIMENT_CONFIG_DATA);
+// exConfig.setExpID("testExpID");
+// exConfig.setNodeCount(5);
+// exConfig.setCpuCount(10);
+// exConfig.setApplicationID("testApp");
+// exConfig.setApplicationVersion("testAppVersion");
+// exConfig.save();
+//
+// workflowDataResource = experimentResource.createWorkflowInstanceResource("testWFInstance");
+// workflowDataResource.setExperimentID("testExpID");
+// workflowDataResource.setStatus("testStatus");
+// workflowDataResource.setTemplateName("testWFInstance");
+// workflowDataResource.setLastUpdatedTime(getCurrentTimestamp());
+// workflowDataResource.setStartTime(getCurrentTimestamp());
+// workflowDataResource.save();
+// }
+//
+// public void testSave() throws Exception {
+// assertTrue("experiment meta data saved successfully", gatewayResource.isExists(ResourceType.EXPERIMENT_METADATA, "testExpID"));
+//
+// }
+//
+// public void testRemove() throws Exception {
+// experimentResource.remove(ResourceType.WORKFLOW_DATA, "testWFInstance");
+// assertTrue("workflow data resource removed successfully", !experimentResource.isExists(ResourceType.WORKFLOW_DATA, "testWFInstance"));
+// }
+//
+// public void testGet() throws Exception {
+// assertNotNull("experiment configuration retrieved successfully...", experimentResource.get(ResourceType.EXPERIMENT_CONFIG_DATA, "testExpID"));
+// }
+//
+// @Override
+// public void tearDown() throws Exception {
+// super.tearDown();
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java
new file mode 100644
index 0000000..605b0ae
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java
@@ -0,0 +1,76 @@
+/*
+*
+* 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.experiment.catalog;
+
+import org.apache.airavata.experiment.catalog.resources.ExperimentOutputResource;
+import org.apache.airavata.experiment.catalog.resources.ExperimentResource;
+import org.junit.After;
+import org.junit.Test;
+
+import java.util.List;
+
+import static org.junit.Assert.assertTrue;
+
+
+public class ExperimentOutputResourceTest extends AbstractResourceTest {
+ private ExperimentResource experimentResource;
+ private String experimentID = "testExpID";
+ ExperimentOutputResource outputResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
+ experimentResource.setExpID(experimentID);
+ experimentResource.setExecutionUser(getWorkerResource().getUser());
+ experimentResource.setProjectId(getProjectResource().getId());
+ experimentResource.setCreationTime(getCurrentTimestamp());
+ experimentResource.setApplicationId("testApplication");
+ experimentResource.setApplicationVersion("1.0");
+ experimentResource.setDescription("Test Application");
+ experimentResource.setExpName("TestExperiment");
+ experimentResource.save();
+
+ outputResource = (ExperimentOutputResource)experimentResource.create(ResourceType.EXPERIMENT_OUTPUT);
+ outputResource.setExperimentId(experimentResource.getExpID());
+ outputResource.setExperimentKey("testKey");
+ outputResource.setValue("testValue");
+ outputResource.setDataType("string");
+ outputResource.save();
+ }
+
+ @Test
+ public void testSave() throws Exception {
+ assertTrue("Experiment output saved successfully", experimentResource.isExists(ResourceType.EXPERIMENT_OUTPUT, experimentID));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGet () throws Exception {
+ List<ExperimentOutputResource> outputs = experimentResource.getExperimentOutputs();
+ System.out.println("output counts : " + outputs.size());
+ assertTrue("Experiment output retrieved successfully...", outputs.size() > 0);
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java
new file mode 100644
index 0000000..ac39f41
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java
@@ -0,0 +1,77 @@
+/*
+*
+* 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.experiment.catalog;
+
+import static org.junit.Assert.*;
+
+import java.sql.Timestamp;
+import java.util.Date;
+
+import org.apache.airavata.experiment.catalog.resources.ExperimentResource;
+import org.junit.After;
+import org.junit.Test;
+
+public class ExperimentResourceTest extends AbstractResourceTest {
+ private ExperimentResource experimentResource;
+ private String experimentID = "testExpID";
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ experimentResource = (ExperimentResource) getGatewayResource().create(ResourceType.EXPERIMENT);
+ experimentResource.setExpID(experimentID);
+ experimentResource.setExecutionUser(getWorkerResource().getUser());
+ experimentResource.setProjectId(getProjectResource().getId());
+ Timestamp currentDate = new Timestamp(new Date().getTime());
+ experimentResource.setCreationTime(currentDate);
+ experimentResource.setApplicationId("testApplication");
+ experimentResource.setApplicationVersion("1.0");
+ experimentResource.setDescription("Test Application");
+ experimentResource.setExpName("TestExperiment");
+ experimentResource.save();
+ }
+
+ @Test
+ public void testCreate() throws Exception {
+ assertNotNull("experiment data resource has being created ", experimentResource);
+ }
+
+ @Test
+ public void testSave() throws Exception {
+ assertTrue("experiment save successfully", getGatewayResource().isExists(ResourceType.EXPERIMENT, experimentID));
+ }
+
+ @Test
+ public void testGet() throws Exception {
+ assertNotNull("experiment data retrieved successfully", getGatewayResource().get(ResourceType.EXPERIMENT, experimentID));
+ }
+
+ @Test
+ public void testRemove() throws Exception {
+ getGatewayResource().remove(ResourceType.EXPERIMENT, experimentID);
+ assertFalse("experiment data removed successfully", getGatewayResource().isExists(ResourceType.EXPERIMENT, experimentID));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GFacJobDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GFacJobDataResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GFacJobDataResourceTest.java
new file mode 100644
index 0000000..c546aca
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GFacJobDataResourceTest.java
@@ -0,0 +1,77 @@
+///*
+//*
+//* 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.experiment.registry.jpa;
+//
+//import org.apache.airavata.experiment.registry.jpa.resources.*;
+//
+//import java.sql.Timestamp;
+//import java.util.Calendar;
+//
+//public class GFacJobDataResourceTest extends AbstractResourceTest {
+// private WorkerResource workerResource;
+// private WorkflowDataResource workflowDataResource;
+// private ExperimentMetadataResource experimentResource;
+//
+// @Override
+// public void setUp() throws Exception {
+// super.setUp();
+// GatewayResource gatewayResource = super.getGatewayResource();
+// workerResource = super.getWorkerResource();
+//
+// experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
+// experimentResource.setExpID("testExpID");
+// experimentResource.setExperimentName("testExpID");
+// experimentResource.setExecutionUser(workerResource.getUser());
+// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+// experimentResource.save();
+//
+// workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
+// workflowDataResource.setWorkflowInstanceID("testWFInstance");
+// workflowDataResource.setTemplateName("testTemplate");
+// workflowDataResource.setExperimentID("testExpID");
+// Calendar calender = Calendar.getInstance();
+// java.util.Date d = calender.getTime();
+// Timestamp timestamp = new Timestamp(d.getTime());
+// workflowDataResource.setLastUpdatedTime(timestamp);
+// workflowDataResource.save();
+// }
+//
+// @Override
+// public void tearDown() throws Exception {
+// super.tearDown();
+// }
+//
+// public void testSave() throws Exception {
+// GFacJobDataResource resource = (GFacJobDataResource)workflowDataResource.create(ResourceType.GFAC_JOB_DATA);
+// resource.setLocalJobID("testJobID");
+// resource.setApplicationDescID("testApplication");
+// resource.setMetadataResource(experimentResource);
+// resource.setNodeID("testNode");
+// resource.setHostDescID("testHost");
+// resource.setServiceDescID("testService");
+// resource.setStatus("testStatus");
+// resource.setJobData("testJobData");
+// resource.save();
+// assertTrue("GFac job data saved successfully", workerResource.isGFacJobExists("testJobID"));
+//// workflowDataResource.remove(ResourceType.GFAC_JOB_DATA, "testJobID");
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GFacJobStatusResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GFacJobStatusResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GFacJobStatusResourceTest.java
new file mode 100644
index 0000000..9cf648e
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GFacJobStatusResourceTest.java
@@ -0,0 +1,87 @@
+///*
+//*
+//* 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.experiment.registry.jpa;
+//
+//import org.apache.airavata.experiment.registry.jpa.resources.*;
+//
+//import java.sql.Timestamp;
+//import java.util.Calendar;
+//import java.util.List;
+//
+//public class GFacJobStatusResourceTest extends AbstractResourceTest {
+// private GFacJobDataResource gFacJobDataResource;
+//
+// @Override
+// public void setUp() throws Exception {
+// super.setUp();
+// GatewayResource gatewayResource = super.getGatewayResource();
+// WorkerResource workerResource = super.getWorkerResource();
+//
+// ExperimentMetadataResource experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
+// experimentResource.setExpID("testExpID");
+// experimentResource.setExperimentName("testExpID");
+// experimentResource.setExecutionUser(workerResource.getUser());
+// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+// experimentResource.save();
+//
+//
+// WorkflowDataResource workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
+// workflowDataResource.setWorkflowInstanceID("testWFInstance");
+// workflowDataResource.setTemplateName("testTemplate");
+// workflowDataResource.setExperimentID("testExpID");
+// Calendar calender = Calendar.getInstance();
+// java.util.Date d = calender.getTime();
+// Timestamp timestamp = new Timestamp(d.getTime());
+// workflowDataResource.setLastUpdatedTime(timestamp);
+// workflowDataResource.save();
+//
+// gFacJobDataResource = (GFacJobDataResource) workflowDataResource.create(ResourceType.GFAC_JOB_DATA);
+// gFacJobDataResource.setLocalJobID("testJobID");
+// gFacJobDataResource.setApplicationDescID("testApplication");
+// gFacJobDataResource.setMetadataResource(experimentResource);
+// gFacJobDataResource.setNodeID("testNode");
+// gFacJobDataResource.setHostDescID("testHost");
+// gFacJobDataResource.setServiceDescID("testService");
+// gFacJobDataResource.setStatus("testStatus");
+// gFacJobDataResource.setJobData("testJobData");
+// gFacJobDataResource.save();
+//
+// }
+//
+// @Override
+// public void tearDown() throws Exception {
+// super.tearDown();
+// }
+//
+// public void testSave() throws Exception {
+// GFacJobStatusResource resource = (GFacJobStatusResource)gFacJobDataResource.create(ResourceType.GFAC_JOB_STATUS);
+// resource.setStatus("testStatus");
+// resource.setgFacJobDataResource(gFacJobDataResource);
+// Calendar calender = Calendar.getInstance();
+// java.util.Date d = calender.getTime();
+// Timestamp timestamp = new Timestamp(d.getTime());
+// resource.setStatusUpdateTime(timestamp);
+// resource.save();
+// List<Resource> resources = gFacJobDataResource.get(ResourceType.GFAC_JOB_STATUS);
+// assertTrue("GFac job status saved successfully", resources.size() != 0);
+// }
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java
new file mode 100644
index 0000000..bd11353
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java
@@ -0,0 +1,120 @@
+/*
+*
+* 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.experiment.catalog;
+
+import static org.junit.Assert.*;
+
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.experiment.catalog.resources.*;
+import org.junit.After;
+import org.junit.Test;
+
+import java.sql.Timestamp;
+import java.util.Date;
+
+
+public class GatewayResourceTest extends AbstractResourceTest {
+ private GatewayResource gatewayResource;
+ private ProjectResource projectResource;
+ private UserResource userResource;
+ private WorkerResource workerResource;
+ private ExperimentResource experimentResource;
+
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ Timestamp currentDate = new Timestamp(new Date().getTime());
+
+ gatewayResource = super.getGatewayResource();
+ workerResource = super.getWorkerResource();
+ userResource = super.getUserResource();
+ if (gatewayResource == null) {
+ gatewayResource = (GatewayResource) ResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
+ }
+ projectResource = (ProjectResource) gatewayResource.create(ResourceType.PROJECT);
+ projectResource.setId("testProject");
+ projectResource.setName("testProject");
+ projectResource.setWorker(workerResource);
+ projectResource.save();
+
+ experimentResource = (ExperimentResource) gatewayResource.create(ResourceType.EXPERIMENT);
+
+ experimentResource.setExpID("testExpID");
+ experimentResource.setExecutionUser(getWorkerResource().getUser());
+ experimentResource.setProjectId(getProjectResource().getId());
+ experimentResource.setCreationTime(currentDate);
+ experimentResource.setApplicationId("testApplication");
+ experimentResource.setApplicationVersion("1.0");
+ experimentResource.setDescription("Test Application");
+ experimentResource.setExpName("TestExperiment");
+ experimentResource.save();
+ }
+ @Test
+ public void testSave() throws Exception {
+ gatewayResource.setDomain("owner1");
+ gatewayResource.save();
+
+ boolean gatewayExist = ResourceUtils.isGatewayExist(ServerSettings.getDefaultUserGateway());
+ assertTrue("The gateway exisits", gatewayExist);
+
+ }
+
+ @Test
+ public void testCreate() throws Exception {
+ assertNotNull("project resource cannot be null", projectResource);
+ assertNotNull("user resource cannot be null", userResource);
+ assertNotNull("worker resource cannot be null", workerResource);
+ assertNotNull("experiment resource cannot be null", experimentResource);
+ }
+
+ @Test
+ public void testIsExists() throws Exception {
+ assertTrue(gatewayResource.isExists(ResourceType.GATEWAY_WORKER, ServerSettings.getDefaultUser()));
+ assertTrue(gatewayResource.isExists(ResourceType.EXPERIMENT, "testExpID"));
+ }
+
+ @Test
+ public void testGet() throws Exception {
+ assertNotNull(gatewayResource.get(ResourceType.GATEWAY_WORKER, ServerSettings.getDefaultUser()));
+ assertNotNull(gatewayResource.get(ResourceType.EXPERIMENT, "testExpID"));
+ }
+
+ @Test
+ public void testGetList() throws Exception {
+ assertNotNull(gatewayResource.get(ResourceType.GATEWAY_WORKER));
+ assertNotNull(gatewayResource.get(ResourceType.PROJECT));
+ assertNotNull(gatewayResource.get(ResourceType.EXPERIMENT));
+ }
+
+ @Test
+ public void testRemove() throws Exception {
+
+ gatewayResource.remove(ResourceType.EXPERIMENT, "testExpID");
+ assertFalse(gatewayResource.isExists(ResourceType.EXPERIMENT, "testExpID"));
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GramDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GramDataResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GramDataResourceTest.java
new file mode 100644
index 0000000..47f8399
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/GramDataResourceTest.java
@@ -0,0 +1,72 @@
+///*
+//*
+//* 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.experiment.registry.jpa;
+//
+//import org.apache.airavata.experiment.registry.jpa.resources.*;
+//
+//import java.sql.Timestamp;
+//import java.util.Calendar;
+//
+//public class GramDataResourceTest extends AbstractResourceTest {
+// private WorkflowDataResource workflowDataResource;
+//
+// @Override
+// public void setUp() throws Exception {
+// super.setUp();
+// GatewayResource gatewayResource = super.getGatewayResource();
+// WorkerResource workerResource = super.getWorkerResource();
+//
+// ExperimentMetadataResource experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
+// experimentResource.setExpID("testExpID");
+// experimentResource.setExperimentName("testExpID");
+// experimentResource.setExecutionUser(workerResource.getUser());
+// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+// experimentResource.save();
+//
+// workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
+// workflowDataResource.setWorkflowInstanceID("testWFInstance");
+// workflowDataResource.setTemplateName("testTemplate");
+// workflowDataResource.setExperimentID("testExpID");
+// Calendar calender = Calendar.getInstance();
+// java.util.Date d = calender.getTime();
+// Timestamp timestamp = new Timestamp(d.getTime());
+// workflowDataResource.setLastUpdatedTime(timestamp);
+// workflowDataResource.save();
+// }
+//
+// public void testSave() throws Exception {
+// GramDataResource gramDataResource = workflowDataResource.createGramData("testNode");
+// gramDataResource.setWorkflowDataResource(workflowDataResource);
+// gramDataResource.setInvokedHost("testhost");
+// gramDataResource.setRsl("testRSL");
+// gramDataResource.save();
+//
+// assertTrue("gram data saved successfully", workflowDataResource.isGramDataExists("testNode"));
+//
+// }
+//
+// @Override
+// public void tearDown() throws Exception {
+// super.tearDown();
+// }
+//
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/NodeDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/NodeDataResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/NodeDataResourceTest.java
new file mode 100644
index 0000000..e13c1ff
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/NodeDataResourceTest.java
@@ -0,0 +1,72 @@
+///*
+//*
+//* 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.experiment.registry.jpa;
+//
+//import org.apache.airavata.experiment.registry.jpa.resources.*;
+//
+//import java.sql.Timestamp;
+//import java.util.Calendar;
+//
+//public class NodeDataResourceTest extends AbstractResourceTest {
+// private WorkflowDataResource workflowDataResource;
+//
+// @Override
+// public void setUp() throws Exception {
+// super.setUp();
+// GatewayResource gatewayResource = super.getGatewayResource();
+// WorkerResource workerResource = super.getWorkerResource();
+//
+// ExperimentMetadataResource experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
+// experimentResource.setExpID("testExpID");
+// experimentResource.setExperimentName("testExpID");
+// experimentResource.setExecutionUser(workerResource.getUser());
+// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+// experimentResource.save();
+//
+// workflowDataResource = (WorkflowDataResource) experimentResource.create(ResourceType.WORKFLOW_DATA);
+// workflowDataResource.setWorkflowInstanceID("testWFInstance");
+// workflowDataResource.setTemplateName("testTemplate");
+// workflowDataResource.setExperimentID("testExpID");
+// Calendar calender = Calendar.getInstance();
+// java.util.Date d = calender.getTime();
+// Timestamp timestamp = new Timestamp(d.getTime());
+// workflowDataResource.setLastUpdatedTime(timestamp);
+// workflowDataResource.save();
+// }
+//
+// public void testSave() throws Exception {
+// NodeDataResource nodeDataResource = workflowDataResource.createNodeData("testNodeID");
+// nodeDataResource.setInputs("testInput");
+//
+// nodeDataResource.setStatus("testStatus");
+// nodeDataResource.setExecutionIndex(0);
+// nodeDataResource.save();
+//
+// assertTrue("node data resource saved successfully", workflowDataResource.isNodeExists("testNodeID"));
+// }
+//
+// @Override
+// public void tearDown() throws Exception {
+// super.tearDown();
+// }
+//
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/OrchestratorDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/OrchestratorDataResourceTest.java b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/OrchestratorDataResourceTest.java
new file mode 100644
index 0000000..e545965
--- /dev/null
+++ b/modules/registry/experiment-catalog/src/test/java/org/apache/airavata/experiment/catalog/OrchestratorDataResourceTest.java
@@ -0,0 +1,69 @@
+///*
+// *
+// * 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.experiment.registry.jpa;
+//
+//import java.util.UUID;
+//
+//import org.apache.airavata.common.utils.AiravataJobState;
+//import org.apache.airavata.experiment.registry.jpa.resources.*;
+//
+//public class OrchestratorDataResourceTest extends AbstractResourceTest{
+// private OrchestratorDataResource dataResource;
+// private ExperimentMetadataResource experimentResource;
+// private WorkerResource workerResource;
+//// private String experimentID = UUID.randomUUID().toString();
+// private String applicationName = "echo_test";
+// private GatewayResource gatewayResource;
+//
+// @Override
+// public void setUp() throws Exception {
+// super.setUp();
+// gatewayResource = super.getGatewayResource();
+// workerResource = super.getWorkerResource();
+//
+// experimentResource = (ExperimentMetadataResource) gatewayResource.create(ResourceType.EXPERIMENT_METADATA);
+// experimentResource.setExpID("testExpID");
+// experimentResource.setExperimentName("testExpID");
+// experimentResource.setExecutionUser(workerResource.getUser());
+// experimentResource.setProject(new ProjectResource(workerResource, gatewayResource, "testProject"));
+// experimentResource.save();
+//
+// dataResource = (OrchestratorDataResource) gatewayResource.create(ResourceType.ORCHESTRATOR);
+//
+// }
+//
+// public void testSave() throws Exception {
+// dataResource.setExperimentID("testExpID");
+// dataResource.setStatus(AiravataJobState.State.CREATED.toString());
+// dataResource.setApplicationName(applicationName);
+// dataResource.save();
+// assertNotNull("Orchestrator data resource created successfully", dataResource);
+// // Get saved data
+// assertNotNull("Orchestrator data resource get successfully", gatewayResource.get(ResourceType.ORCHESTRATOR, "testExpID"));
+// }
+//
+// @Override
+// public void tearDown() throws Exception {
+// super.tearDown();
+// }
+//
+//
+//}
[22/25] airavata git commit: rename airavata-jpa-registry module to
experiment-catalog
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/GatewayRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/GatewayRegistry.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/GatewayRegistry.java
deleted file mode 100644
index d38b5df..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/GatewayRegistry.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- *
- * 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.impl;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.model.workspace.Gateway;
-import org.apache.airavata.persistance.registry.jpa.Resource;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
-import org.apache.airavata.persistance.registry.jpa.utils.ThriftDataModelConversion;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class GatewayRegistry {
-
- private final static Logger logger = LoggerFactory.getLogger(GatewayRegistry.class);
- public GatewayResource getDefaultGateway () throws ApplicationSettingsException, RegistryException {
- return (GatewayResource)ResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
- }
-
- public GatewayResource getExistingGateway (String gatewayName) throws RegistryException {
- return (GatewayResource)ResourceUtils.getGateway(gatewayName);
- }
-
- public String addGateway (Gateway gateway) throws RegistryException{
- try {
- GatewayResource resource = (GatewayResource)ResourceUtils.createGateway(gateway.getGatewayId());
- resource.setGatewayName(gateway.getGatewayName());
- resource.setEmailAddress(gateway.getEmailAddress());
- resource.setDomain(gateway.getDomain());
- resource.save();
- return gateway.getGatewayId();
- }catch (RegistryException e){
- logger.error("Error while saving gateway to registry", e);
- throw new RegistryException(e);
- }
- }
-
- public void updateGateway (String gatewayId, Gateway updatedGateway) throws RegistryException{
- try {
- GatewayResource existingGateway = (GatewayResource)ResourceUtils.getGateway(gatewayId);
- existingGateway.setGatewayName(updatedGateway.getGatewayName());
- existingGateway.setEmailAddress(updatedGateway.getEmailAddress());
- existingGateway.setDomain(updatedGateway.getDomain());
- existingGateway.save();
- }catch (RegistryException e){
- logger.error("Error while updating gateway to registry", e);
- throw new RegistryException(e);
- }
- }
-
- public Gateway getGateway (String gatewayId) throws RegistryException{
- try {
- GatewayResource resource = (GatewayResource)ResourceUtils.getGateway(gatewayId);
- return ThriftDataModelConversion.getGateway(resource);
- }catch (RegistryException e){
- logger.error("Error while getting gateway", e);
- throw new RegistryException(e);
- }
- }
-
- public boolean isGatewayExist (String gatewayId) throws RegistryException{
- try {
- return ResourceUtils.isGatewayExist(gatewayId);
- }catch (RegistryException e){
- logger.error("Error while checking gateway exists", e);
- throw new RegistryException(e);
- }
- }
-
- public boolean removeGateway (String gatewayId) throws RegistryException{
- try {
- return ResourceUtils.removeGateway(gatewayId);
- }catch (Exception e){
- logger.error("Error while removing the gateway", e);
- throw new RegistryException(e);
- }
- }
-
- public List<Gateway> getAllGateways () throws RegistryException {
- List<Gateway> gatewayList = new ArrayList<Gateway>();
- try {
- List<Resource> allGateways = ResourceUtils.getAllGateways();
- return ThriftDataModelConversion.getAllGateways(allGateways);
- }catch (Exception e){
- logger.error("Error while getting all the gateways", e);
- throw new RegistryException(e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/LoggingRegistryImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/LoggingRegistryImpl.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/LoggingRegistryImpl.java
deleted file mode 100644
index 0274518..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/LoggingRegistryImpl.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *
- * 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.impl;
-
-import org.apache.airavata.registry.cpi.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.Map;
-
-public class LoggingRegistryImpl implements Registry {
- private final static Logger logger = LoggerFactory.getLogger(LoggingRegistryImpl.class);
-
- @Override
- public Object add(ParentDataType dataType, Object newObjectToAdd, String gatewayId) throws RegistryException {
- return null;
- }
-
- @Override
- public Object add(ChildDataType dataType, Object newObjectToAdd, Object dependentIdentifiers) throws RegistryException {
- return null;
- }
-
- @Override
- public void update(RegistryModelType dataType, Object newObjectToUpdate, Object identifier) throws RegistryException {
-
- }
-
- @Override
- public void update(RegistryModelType dataType, Object identifier, String fieldName, Object value) throws RegistryException {
-
- }
-
- @Override
- public Object get(RegistryModelType dataType, Object identifier) throws RegistryException {
- return null;
- }
-
- @Override
- public List<Object> get(RegistryModelType dataType, String fieldName, Object value) throws RegistryException {
- return null;
- }
-
- @Override
- public List<Object> get(RegistryModelType dataType, String fieldName, Object value, int limit, int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- return null;
- }
-
- @Override
- public List<Object> search(RegistryModelType dataType, Map<String, String> filters) throws RegistryException {
- return null;
- }
-
- @Override
- public List<Object> search(RegistryModelType dataType, Map<String, String> filters, int limit, int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- return null;
- }
-
- @Override
- public Object getValue(RegistryModelType dataType, Object identifier, String field) throws RegistryException {
- return null;
- }
-
- @Override
- public List<String> getIds(RegistryModelType dataType, String fieldName, Object value) throws RegistryException {
- return null;
- }
-
- @Override
- public void remove(RegistryModelType dataType, Object identifier) throws RegistryException {
-
- }
-
- @Override
- public boolean isExist(RegistryModelType dataType, Object identifier) throws RegistryException {
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ProjectRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ProjectRegistry.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ProjectRegistry.java
deleted file mode 100644
index ba324a8..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ProjectRegistry.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- *
- * 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.impl;
-
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.model.workspace.Project;
-import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.resources.*;
-import org.apache.airavata.persistance.registry.jpa.utils.ThriftDataModelConversion;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.ResultOrderType;
-import org.apache.airavata.registry.cpi.utils.Constants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.*;
-
-public class ProjectRegistry {
- private GatewayResource gatewayResource;
- private WorkerResource workerResource;
- private final static Logger logger = LoggerFactory.getLogger(ProjectRegistry.class);
-
- public ProjectRegistry(GatewayResource gatewayResource, UserResource user) throws RegistryException {
- if (!ResourceUtils.isGatewayExist(gatewayResource.getGatewayId())){
- this.gatewayResource = gatewayResource;
- }else {
- this.gatewayResource = (GatewayResource)ResourceUtils.getGateway(gatewayResource.getGatewayId());
- }
- if (!gatewayResource.isExists(ResourceType.GATEWAY_WORKER, user.getUserName())){
- workerResource = ResourceUtils.addGatewayWorker(gatewayResource, user);
- }else {
- workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayId(),
- user.getUserName());
- }
- }
-
- public String addProject (Project project, String gatewayId) throws RegistryException{
- String projectId;
- try {
- if (!ResourceUtils.isUserExist(project.getOwner())){
- ResourceUtils.addUser(project.getOwner(), null);
- }
- ProjectResource projectResource = new ProjectResource();
- projectId = getProjectId(project.getName());
- projectResource.setId(projectId);
- project.setProjectID(projectId);
- projectResource.setName(project.getName());
- projectResource.setDescription(project.getDescription());
- projectResource.setCreationTime(AiravataUtils.getTime(project.getCreationTime()));
- projectResource.setGatewayId(gatewayId);
- WorkerResource worker = new WorkerResource(project.getOwner(), gatewayId);
- projectResource.setWorker(worker);
- projectResource.save();
- ProjectUserResource resource = (ProjectUserResource)projectResource.create(
- ResourceType.PROJECT_USER);
- resource.setProjectId(project.getProjectID());
- resource.setUserName(project.getOwner());
- resource.save();
- List<String> sharedGroups = project.getSharedGroups();
- if (sharedGroups != null && !sharedGroups.isEmpty()){
- for (String group : sharedGroups){
- //TODO - add shared groups
- logger.info("Groups are not supported at the moment...");
- }
- }
-
- List<String> sharedUsers = project.getSharedUsers();
- if (sharedUsers != null && !sharedUsers.isEmpty()){
- for (String username : sharedUsers){
- ProjectUserResource pr = (ProjectUserResource)projectResource.
- create(ResourceType.PROJECT_USER);
- pr.setUserName(username);
- pr.save();
- }
- }
- }catch (Exception e){
- logger.error("Error while saving project to registry", e);
- throw new RegistryException(e);
- }
- return projectId;
- }
-
- private String getProjectId (String projectName){
- String pro = projectName.replaceAll("\\s", "");
- return pro + "_" + UUID.randomUUID();
- }
-
- public void updateProject (Project project, String projectId) throws RegistryException{
- try {
- ProjectResource existingProject = workerResource.getProject(projectId);
- existingProject.setDescription(project.getDescription());
- existingProject.setName(project.getName());
-// existingProject.setGateway(gatewayResource);
- UserResource user = (UserResource)ResourceUtils.getUser(project.getOwner());
- if (!gatewayResource.isExists(ResourceType.GATEWAY_WORKER, user.getUserName())){
- workerResource = ResourceUtils.addGatewayWorker(gatewayResource, user);
- }else {
- workerResource = (WorkerResource)ResourceUtils.getWorker(
- gatewayResource.getGatewayName(), user.getUserName());
- }
- WorkerResource worker = new WorkerResource(project.getOwner(), gatewayResource.getGatewayId());
- existingProject.setWorker(worker);
- existingProject.save();
- ProjectUserResource resource = (ProjectUserResource)existingProject.create(
- ResourceType.PROJECT_USER);
- resource.setProjectId(projectId);
- resource.setUserName(project.getOwner());
- resource.save();
- List<String> sharedGroups = project.getSharedGroups();
- if (sharedGroups != null && !sharedGroups.isEmpty()){
- for (String group : sharedGroups){
- //TODO - add shared groups
- logger.info("Groups are not supported at the moment...");
- }
- }
-
- List<String> sharedUsers = project.getSharedUsers();
- if (sharedUsers != null && !sharedUsers.isEmpty()){
- for (String username : sharedUsers){
- ProjectUserResource pr = (ProjectUserResource)existingProject.create(
- ResourceType.PROJECT_USER);
- pr.setUserName(username);
- pr.save();
- }
- }
- }catch (Exception e){
- logger.error("Error while saving project to registry", e);
- throw new RegistryException(e);
- }
- }
-
- public Project getProject (String projectId) throws RegistryException{
- try {
- ProjectResource project = workerResource.getProject(projectId);
- if (project != null){
- return ThriftDataModelConversion.getProject(project);
- }
- }catch (Exception e){
- logger.error("Error while retrieving project from registry", e);
- throw new RegistryException(e);
- }
- return null;
- }
-
- /**
- * Get list of projects of the user
- * @param fieldName
- * @param value
- * @return
- * @throws RegistryException
- */
- public List<Project> getProjectList (String fieldName, Object value) throws RegistryException{
- return getProjectList(fieldName, value, -1, -1, null, null);
- }
-
- /**
- * Get projects list with pagination and result ordering
- * @param fieldName
- * @param value
- * @param limit
- * @param offset
- * @param orderByIdentifier
- * @param resultOrderType
- * @return
- * @throws RegistryException
- */
- public List<Project> getProjectList (String fieldName, Object value, int limit, int offset,
- Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException{
- List<Project> projects = new ArrayList<Project>();
- try {
- if (fieldName.equals(Constants.FieldConstants.ProjectConstants.OWNER)){
- workerResource.setUser((String)value);
- List<ProjectResource> projectList = workerResource.getProjects();
- if (projectList != null && !projectList.isEmpty()){
- for (ProjectResource pr : projectList){
- projects.add(ThriftDataModelConversion.getProject(pr));
- }
- }
- return projects;
- }
- }catch (Exception e){
- logger.error("Error while retrieving project from registry", e);
- throw new RegistryException(e);
- }
- return projects;
- }
-
- /**
- * To search projects of user with the given filter criteria. All the matching results will be sent.
- * Results are not ordered in any order
- * @param filters
- * @return
- * @throws RegistryException
- */
- public List<Project> searchProjects (Map<String, String> filters) throws RegistryException{
- return searchProjects(filters, -1, -1, null, null);
- }
-
- /**
- * To search the projects of user with the given filter criteria and retrieve the results with
- * pagination support. Results can be ordered based on an identifier (i.e column) either ASC or
- * DESC.
- *
- * @param filters
- * @param limit
- * @param offset
- * @param orderByIdentifier
- * @param resultOrderType
- * @return
- * @throws RegistryException
- */
- public List<Project> searchProjects(Map<String, String> filters, int limit,
- int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- Map<String, String> fil = new HashMap<String, String>();
- if (filters != null && filters.size() != 0){
- List<Project> projects = new ArrayList<Project>();
- try {
- for (String field : filters.keySet()){
- if (field.equals(Constants.FieldConstants.ProjectConstants.PROJECT_NAME)){
- fil.put(AbstractResource.ProjectConstants.PROJECT_NAME, filters.get(field));
- }else if (field.equals(Constants.FieldConstants.ProjectConstants.OWNER)){
- fil.put(AbstractResource.ProjectConstants.USERNAME, filters.get(field));
- }else if (field.equals(Constants.FieldConstants.ProjectConstants.DESCRIPTION)){
- fil.put(AbstractResource.ProjectConstants.DESCRIPTION, filters.get(field));
- }else if (field.equals(Constants.FieldConstants.ProjectConstants.GATEWAY_ID)){
- fil.put(AbstractResource.ProjectConstants.GATEWAY_ID, filters.get(field));
- }
- }
- List<ProjectResource> projectResources = workerResource
- .searchProjects(fil, limit, offset, orderByIdentifier, resultOrderType);
- if (projectResources != null && !projectResources.isEmpty()){
- for (ProjectResource pr : projectResources){
- projects.add(ThriftDataModelConversion.getProject(pr));
- }
- }
- return projects;
- }catch (Exception e){
- logger.error("Error while retrieving project from registry", e);
- throw new RegistryException(e);
- }
- }
- return null;
- }
-
- public List<String> getProjectIDs (String fieldName, Object value) throws RegistryException{
- List<String> projectIds = new ArrayList<String>();
- try {
- if (fieldName.equals(Constants.FieldConstants.ProjectConstants.OWNER)){
- workerResource.setUser((String)value);
- List<ProjectResource> projectList = workerResource.getProjects();
- if (projectList != null && !projectList.isEmpty()){
- for (ProjectResource pr : projectList){
- projectIds.add(pr.getName());
- }
- }
- return projectIds;
- }
- }catch (Exception e){
- logger.error("Error while retrieving projects from registry", e);
- throw new RegistryException(e);
- }
- return projectIds;
- }
-
- public void removeProject (String projectId) throws RegistryException {
- try {
- workerResource.removeProject(projectId);
- } catch (Exception e) {
- logger.error("Error while removing the project..", e);
- throw new RegistryException(e);
- }
- }
-
- public boolean isProjectExist(String projectId) throws RegistryException {
- try {
- return workerResource.isProjectExists(projectId);
- } catch (Exception e) {
- logger.error("Error while retrieving project...", e);
- throw new RegistryException(e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryFactory.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryFactory.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryFactory.java
deleted file mode 100644
index 8af4f19..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryFactory.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *
- * 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.impl;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.registry.cpi.Registry;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RegistryFactory {
- private static Registry registry;
- private static Logger logger = LoggerFactory.getLogger(RegistryFactory.class);
-
- public static Registry getRegistry(String gateway, String username, String password) throws RegistryException {
- try {
- if (registry == null) {
- registry = new RegistryImpl(gateway, username, password);
- }
- } catch (RegistryException e) {
- logger.error("Unable to create registry instance", e);
- throw new RegistryException(e);
- }
- return registry;
- }
-
- public static Registry getRegistry(String gateway) throws RegistryException {
- try {
- if (registry == null) {
- registry = new RegistryImpl(gateway, ServerSettings.getDefaultUser(), ServerSettings.getDefaultUserPassword());
- }
- } catch (RegistryException e) {
- logger.error("Unable to create registry instance", e);
- throw new RegistryException(e);
- } catch (ApplicationSettingsException e) {
- logger.error("Unable to create registry instance", e);
- throw new RegistryException(e);
- }
- return registry;
- }
-
- public static Registry getDefaultRegistry () throws RegistryException {
- try {
- if (registry == null) {
- registry = new RegistryImpl();
- }
- } catch (RegistryException e) {
- logger.error("Unable to create registry instance", e);
- throw new RegistryException(e);
- }
- return registry;
- }
-
- public static Registry getLoggingRegistry() {
- if(registry == null) {
- registry = new LoggingRegistryImpl();
- }
- return registry;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java
deleted file mode 100644
index 953b11e..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java
+++ /dev/null
@@ -1,735 +0,0 @@
-/*
- *
- * 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.impl;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
-import org.apache.airavata.model.workspace.Gateway;
-import org.apache.airavata.model.workspace.Project;
-import org.apache.airavata.model.workspace.experiment.*;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
-import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
-import org.apache.airavata.registry.cpi.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public class RegistryImpl implements Registry {
- private GatewayResource gatewayResource;
- private UserResource user;
- private final static Logger logger = LoggerFactory.getLogger(RegistryImpl.class);
- private ExperimentRegistry experimentRegistry = null;
- private ProjectRegistry projectRegistry = null;
- private GatewayRegistry gatewayRegistry = null;
-
- public RegistryImpl() throws RegistryException{
- try {
- if (!ResourceUtils.isGatewayExist(ServerSettings.getDefaultUserGateway())){
- gatewayResource = (GatewayResource) ResourceUtils.createGateway(ServerSettings.getDefaultUserGateway());
- gatewayResource.setGatewayName(ServerSettings.getDefaultUserGateway());
- gatewayResource.save();
- }else {
- gatewayResource = (GatewayResource)ResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
- }
-
- if (!ResourceUtils.isUserExist(ServerSettings.getDefaultUser())){
- user = ResourceUtils.createUser(ServerSettings.getDefaultUser(), ServerSettings.getDefaultUserPassword());
- user.save();
- }else {
- user = (UserResource)ResourceUtils.getUser(ServerSettings.getDefaultUser());
- }
- experimentRegistry = new ExperimentRegistry(gatewayResource, user);
- projectRegistry = new ProjectRegistry(gatewayResource, user);
- gatewayRegistry = new GatewayRegistry();
- } catch (ApplicationSettingsException e) {
- logger.error("Unable to read airavata server properties..", e);
- throw new RegistryException("Unable to read airavata server properties..", e);
- }
- }
-
- public RegistryImpl(String gateway, String username, String password) throws RegistryException{
- if (!ResourceUtils.isGatewayExist(gateway)){
- gatewayResource = (GatewayResource) ResourceUtils.createGateway(gateway);
- gatewayResource.save();
- }else {
- gatewayResource = (GatewayResource)ResourceUtils.getGateway(gateway);
- }
-
- if (!ResourceUtils.isUserExist(username)){
- user = ResourceUtils.createUser(username, password);
- user.save();
- }else {
- user = (UserResource)ResourceUtils.getUser(username);
- }
- experimentRegistry = new ExperimentRegistry(gatewayResource, user);
- projectRegistry = new ProjectRegistry(gatewayResource, user);
- }
-
- /**
- * This method is to add an object in to the registry
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param newObjectToAdd Object which contains the fields that need to be saved in to registry. This object is a
- * thrift model object. In experiment case this object can be BasicMetadata, ConfigurationData
- * etc
- * @return return the identifier to identify the object
- */
- @Override
- public Object add(ParentDataType dataType, Object newObjectToAdd, String gatewayId) throws RegistryException {
- try {
- switch (dataType) {
- case PROJECT:
- return projectRegistry.addProject((Project)newObjectToAdd, gatewayId);
- case EXPERIMENT:
- return experimentRegistry.addExperiment((Experiment) newObjectToAdd, gatewayId);
- case GATEWAY:
- return gatewayRegistry.addGateway((Gateway)newObjectToAdd);
- default:
- logger.error("Unsupported top level type..", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while adding the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while adding the resource " + dataType.toString(), e);
- }
- }
-
- /**
- * This method is to add an object in to the registry
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param newObjectToAdd Object which contains the fields that need to be saved in to registry. This object is a
- * thrift model object. In experiment case this object can be BasicMetadata, ConfigurationData
- * etc
- * @param dependentIdentifier Object which contains the identifier if the object that is going to add is not a top
- * level object in the data model. If it is a top level object, programmer can pass it as
- * null
- */
- @Override
- public Object add(ChildDataType dataType, Object newObjectToAdd, Object dependentIdentifier) throws RegistryException {
- try {
- switch (dataType) {
- case EXPERIMENT_CONFIGURATION_DATA:
- return experimentRegistry.addUserConfigData((UserConfigurationData) newObjectToAdd, (String) dependentIdentifier);
- case EXPERIMENT_OUTPUT:
- return experimentRegistry.addExpOutputs((List<OutputDataObjectType>) newObjectToAdd, (String) dependentIdentifier);
- case EXPERIMENT_STATUS:
- return experimentRegistry.updateExperimentStatus((ExperimentStatus) newObjectToAdd, (String) dependentIdentifier);
- case WORKFLOW_NODE_DETAIL:
- return experimentRegistry.addWorkflowNodeDetails((WorkflowNodeDetails) newObjectToAdd, (String) dependentIdentifier);
- case WORKFLOW_NODE_STATUS:
- return experimentRegistry.addWorkflowNodeStatus((WorkflowNodeStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case NODE_OUTPUT:
- return experimentRegistry.addNodeOutputs((List<OutputDataObjectType>) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case TASK_DETAIL:
- return experimentRegistry.addTaskDetails((TaskDetails) newObjectToAdd, (String) dependentIdentifier);
- case APPLICATION_OUTPUT:
- return experimentRegistry.addApplicationOutputs((List<OutputDataObjectType>) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case TASK_STATUS:
- return experimentRegistry.addTaskStatus((TaskStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case JOB_DETAIL:
- return experimentRegistry.addJobDetails((JobDetails) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case JOB_STATUS:
- return experimentRegistry.addJobStatus((JobStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case APPLICATION_STATUS:
- return experimentRegistry.addApplicationStatus((ApplicationStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case DATA_TRANSFER_DETAIL:
- return experimentRegistry.addDataTransferDetails((DataTransferDetails) newObjectToAdd, (String) dependentIdentifier);
- case TRANSFER_STATUS:
- return experimentRegistry.addTransferStatus((TransferStatus) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- return experimentRegistry.addComputationalResourceScheduling((ComputationalResourceScheduling) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case ADVANCE_OUTPUT_DATA_HANDLING:
- return experimentRegistry.addOutputDataHandling((AdvancedOutputDataHandling) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case ADVANCE_INPUT_DATA_HANDLING:
- return experimentRegistry.addInputDataHandling((AdvancedInputDataHandling) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case QOS_PARAM:
- return experimentRegistry.addQosParams((QualityOfServiceParams) newObjectToAdd, (CompositeIdentifier) dependentIdentifier);
- case ERROR_DETAIL:
- return experimentRegistry.addErrorDetails((ErrorDetails) newObjectToAdd, dependentIdentifier);
- default:
- logger.error("Unsupported dependent data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while adding " + dataType.toString() , new RegistryException(e));
- throw new RegistryException("Error while adding " + dataType.toString(), e);
- }
-
- }
-
- /**
- * This method is to update the whole object in registry
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param newObjectToUpdate Object which contains the fields that need to be updated in to registry. This object is a
- * thrift model object. In experiment case this object can be BasicMetadata, ConfigurationData
- * etc. CPI programmer can only fill necessary fields that need to be updated. He does not
- * have to fill the whole object. He needs to only fill the mandatory fields and whatever the
- * other fields that need to be updated.
- */
- @Override
- public void update(RegistryModelType dataType, Object newObjectToUpdate, Object identifier) throws RegistryException {
- try {
- switch (dataType) {
- case PROJECT:
- projectRegistry.updateProject((Project)newObjectToUpdate, (String)identifier);
- break;
- case GATEWAY:
- gatewayRegistry.updateGateway((String)identifier, (Gateway)newObjectToUpdate);
- break;
- case EXPERIMENT:
- experimentRegistry.updateExperiment((Experiment) newObjectToUpdate, (String) identifier);
- break;
- case EXPERIMENT_CONFIGURATION_DATA:
- experimentRegistry.updateUserConfigData((UserConfigurationData) newObjectToUpdate, (String) identifier);
- break;
- case EXPERIMENT_OUTPUT:
- experimentRegistry.updateExpOutputs((List<OutputDataObjectType>) newObjectToUpdate, (String) identifier);
- break;
- case EXPERIMENT_STATUS:
- experimentRegistry.updateExperimentStatus((ExperimentStatus) newObjectToUpdate, (String) identifier);
- break;
- case WORKFLOW_NODE_DETAIL:
- experimentRegistry.updateWorkflowNodeDetails((WorkflowNodeDetails) newObjectToUpdate, (String) identifier);
- break;
- case WORKFLOW_NODE_STATUS:
- experimentRegistry.updateWorkflowNodeStatus((WorkflowNodeStatus) newObjectToUpdate, (String) identifier);
- break;
- case NODE_OUTPUT:
- experimentRegistry.updateNodeOutputs((List<OutputDataObjectType>) newObjectToUpdate, (String) identifier);
- break;
- case TASK_DETAIL:
- experimentRegistry.updateTaskDetails((TaskDetails) newObjectToUpdate, (String) identifier);
- break;
- case APPLICATION_OUTPUT:
- experimentRegistry.updateAppOutputs((List<OutputDataObjectType>) newObjectToUpdate, (String) identifier);
- break;
- case TASK_STATUS:
- experimentRegistry.updateTaskStatus((TaskStatus) newObjectToUpdate, (String) identifier);
- break;
- case JOB_DETAIL:
- experimentRegistry.updateJobDetails((JobDetails) newObjectToUpdate, (CompositeIdentifier) identifier);
- break;
- case JOB_STATUS:
- experimentRegistry.updateJobStatus((JobStatus) newObjectToUpdate, (CompositeIdentifier) identifier);
- break;
- case APPLICATION_STATUS:
- experimentRegistry.updateApplicationStatus((ApplicationStatus) newObjectToUpdate, (String) identifier);
- break;
- case DATA_TRANSFER_DETAIL:
- experimentRegistry.updateDataTransferDetails((DataTransferDetails) newObjectToUpdate, (String) identifier);
- break;
- case TRANSFER_STATUS:
- experimentRegistry.updateTransferStatus((TransferStatus) newObjectToUpdate, (String) identifier);
- break;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- experimentRegistry.updateScheduling((ComputationalResourceScheduling) newObjectToUpdate, (String) identifier, dataType.toString());
- break;
- case ADVANCE_INPUT_DATA_HANDLING:
- experimentRegistry.updateInputDataHandling((AdvancedInputDataHandling) newObjectToUpdate, (String) identifier, dataType.toString());
- break;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- experimentRegistry.updateOutputDataHandling((AdvancedOutputDataHandling) newObjectToUpdate, (String) identifier, dataType.toString());
- break;
- case QOS_PARAM:
- experimentRegistry.updateQOSParams((QualityOfServiceParams) newObjectToUpdate, (String) identifier, dataType.toString());
- break;
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while updating the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while updating the resource.." + dataType.toString(), e);
- }
-
- }
-
- /**
- * This method is to update a specific field of the data model
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
- * identifier will be generated experimentID
- * @param fieldName Field which need to be updated in the registry. In Experiment_Basic_Type, if you want to update the
- * description, field will be "description". Field names are defined in
- * org.apache.airavata.registry.cpi.utils.Constants
- * @param value Value by which the given field need to be updated. If the field is "description", that field will be
- * updated by given value
- */
- @Override
- public void update(RegistryModelType dataType, Object identifier, String fieldName, Object value) throws RegistryException {
- try {
- switch (dataType) {
- case EXPERIMENT:
- experimentRegistry.updateExperimentField((String) identifier, fieldName, value);
- break;
- case EXPERIMENT_CONFIGURATION_DATA:
- experimentRegistry.updateExpConfigDataField((String) identifier, fieldName, value);
- break;
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while updating the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while updating the resource " + dataType.toString(), e);
- }
-
- }
-
- /**
- * This method is to retrieve object according to the identifier. In the experiment basic data type, if you give the
- * experiment id, this method will return the BasicMetadata object
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
- * identifier will be generated experimentID
- * @return object according to the given identifier.
- */
- @Override
- public Object get(RegistryModelType dataType, Object identifier) throws RegistryException {
- try {
- switch (dataType) {
- case PROJECT:
- return projectRegistry.getProject((String)identifier);
- case GATEWAY:
- return gatewayRegistry.getGateway((String)identifier);
- case EXPERIMENT:
- return experimentRegistry.getExperiment((String) identifier, null);
- case EXPERIMENT_CONFIGURATION_DATA:
- return experimentRegistry.getConfigData((String) identifier, null);
- case EXPERIMENT_OUTPUT:
- return experimentRegistry.getExperimentOutputs((String) identifier);
- case EXPERIMENT_STATUS:
- return experimentRegistry.getExperimentStatus((String) identifier);
- case WORKFLOW_NODE_DETAIL:
- return experimentRegistry.getWorkflowNodeDetails((String) identifier);
- case WORKFLOW_NODE_STATUS:
- return experimentRegistry.getWorkflowNodeStatus((String) identifier);
- case NODE_OUTPUT:
- return experimentRegistry.getNodeOutputs((String) identifier);
- case TASK_DETAIL:
- return experimentRegistry.getTaskDetails((String) identifier);
- case APPLICATION_OUTPUT:
- return experimentRegistry.getApplicationOutputs((String) identifier);
- case TASK_STATUS:
- return experimentRegistry.getTaskStatus((String) identifier);
- case JOB_DETAIL:
- return experimentRegistry.getJobDetails((CompositeIdentifier) identifier);
- case JOB_STATUS:
- return experimentRegistry.getJobStatus((CompositeIdentifier) identifier);
- case APPLICATION_STATUS:
- return experimentRegistry.getApplicationStatus((CompositeIdentifier) identifier);
- case DATA_TRANSFER_DETAIL:
- return experimentRegistry.getDataTransferDetails((String) identifier);
- case TRANSFER_STATUS:
- return experimentRegistry.getDataTransferStatus((String) identifier);
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- return experimentRegistry.getComputationalScheduling(dataType, (String) identifier);
- case ADVANCE_INPUT_DATA_HANDLING:
- return experimentRegistry.getInputDataHandling(dataType, (String) identifier);
- case ADVANCE_OUTPUT_DATA_HANDLING:
- return experimentRegistry.getOutputDataHandling(dataType, (String) identifier);
- case QOS_PARAM:
- return experimentRegistry.getQosParams(dataType, (String) identifier);
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while retrieving the resource " + dataType.toString() , e);
- }
- }
-
- /**
- * This method is to retrieve list of objects according to a given criteria
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param fieldName FieldName is the field that filtering should be done. For example, if we want to retrieve all
- * the experiments for a given user, filterBy will be "userName"
- * @param value value for the filtering field. In the experiment case, value for "userName" can be "admin"
- * @return List of objects according to the given criteria
- */
- @Override
- public List<Object> get(RegistryModelType dataType, String fieldName, Object value) throws RegistryException {
- try {
- List<Object> result = new ArrayList<Object>();
- switch (dataType) {
- case PROJECT:
- List<Project> projectList = projectRegistry.getProjectList(fieldName, value);
- for (Project project : projectList ){
- result.add(project);
- }
- return result;
- case GATEWAY:
- List<Gateway> allGateways = gatewayRegistry.getAllGateways();
- for (Gateway gateway : allGateways){
- result.add(gateway);
- }
- return result;
- case EXPERIMENT:
- List<Experiment> experimentList = experimentRegistry.getExperimentList(fieldName, value);
- for (Experiment experiment : experimentList) {
- result.add(experiment);
- }
- return result;
- case WORKFLOW_NODE_DETAIL:
- List<WorkflowNodeDetails> wfNodeDetails = experimentRegistry.getWFNodeDetails(fieldName, value);
- for (WorkflowNodeDetails wf : wfNodeDetails) {
- result.add(wf);
- }
- return result;
- case WORKFLOW_NODE_STATUS:
- List<WorkflowNodeStatus> wfNodeStatusList = experimentRegistry.getWFNodeStatusList(fieldName, value);
- for (WorkflowNodeStatus wfs : wfNodeStatusList) {
- result.add(wfs);
- }
- return result;
- case TASK_DETAIL:
- List<TaskDetails> taskDetails = experimentRegistry.getTaskDetails(fieldName, value);
- for (TaskDetails task : taskDetails) {
- result.add(task);
- }
- return result;
- case JOB_DETAIL:
- List<JobDetails> jobDetails = experimentRegistry.getJobDetails(fieldName, value);
- for (JobDetails job : jobDetails) {
- result.add(job);
- }
- return result;
- case DATA_TRANSFER_DETAIL:
- List<DataTransferDetails> dataTransferDetails = experimentRegistry.getDataTransferDetails(fieldName, value);
- for (DataTransferDetails transferDetails : dataTransferDetails) {
- result.add(transferDetails);
- }
- return result;
- case ERROR_DETAIL:
- List<ErrorDetails> errorDetails = experimentRegistry.getErrorDetails(fieldName, value);
- for (ErrorDetails error : errorDetails) {
- result.add(error);
- }
- return result;
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while retrieving the resource " + dataType.toString(), e);
- }
-
- }
-
- /**
- * This method is to retrieve list of objects according to a given criteria with pagination and ordering
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param fieldName FieldName is the field that filtering should be done. For example, if we want to retrieve all
- * the experiments for a given user, filterBy will be "userName"
- * @param value value for the filtering field. In the experiment case, value for "userName" can be "admin"
- * @param limit Size of the results to be returned
- * @param offset Start position of the results to be retrieved
- * @param orderByIdentifier Named of the column in which the ordering is based
- * @param resultOrderType Type of ordering i.e ASC or DESC
- * @return
- * @throws RegistryException
- */
- @Override
- public List<Object> get(RegistryModelType dataType, String fieldName, Object value, int limit,
- int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- try {
- List<Object> result = new ArrayList<Object>();
- switch (dataType) {
- case PROJECT:
- List<Project> projectList = projectRegistry
- .getProjectList(fieldName, value, limit, offset, orderByIdentifier, resultOrderType);
- for (Project project : projectList ){
- result.add(project);
- }
- return result;
- case EXPERIMENT:
- List<Experiment> experimentList = experimentRegistry.getExperimentList(fieldName, value,
- limit, offset, orderByIdentifier, resultOrderType);
- for (Experiment experiment : experimentList) {
- result.add(experiment);
- }
- return result;
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while retrieving the resource " + dataType.toString(), e);
- }
- }
-
- /**
- * This method is to retrieve list of objects according to a given criteria
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param filters filters is a map of field name and value that you need to use for search filtration
- * @return List of objects according to the given criteria
- */
- @Override
- public List<Object> search(RegistryModelType dataType, Map<String, String> filters) throws RegistryException {
- return search(dataType, filters, -1, -1, null, null);
- }
-
- /**
- * This method is to retrieve list of objects with pagination according to a given criteria sorted
- * according by the specified identified and specified ordering (i.e either ASC or DESC)
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param filters filters is a map of field name and value that you need to use for search filtration
- * @param limit amount of the results to be returned
- * @param offset offset of the results from the sorted list to be fetched from
- * @param orderByIdentifier identifier (i.e the column) which will be used as the basis to sort the results
- * @param resultOrderType The type of ordering (i.e ASC or DESC) that has to be used when retrieving the results
- * @return List of objects according to the given criteria
- */
- @Override
- public List<Object> search(RegistryModelType dataType, Map<String, String> filters, int limit,
- int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- try {
- List<Object> result = new ArrayList<Object>();
- switch (dataType) {
- case PROJECT:
- List<Project> projectList
- = projectRegistry.searchProjects(filters, limit, offset,
- orderByIdentifier, resultOrderType);
- for (Project project : projectList ){
- result.add(project);
- }
- return result;
- case EXPERIMENT:
- List<ExperimentSummary> experimentSummaries = experimentRegistry
- .searchExperiments(filters, limit, offset, orderByIdentifier,
- resultOrderType);
- for (ExperimentSummary ex : experimentSummaries){
- result.add(ex);
- }
- return result;
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while retrieving the resource " + dataType.toString(), e);
- }
- }
-
- /**
- * This method is to retrieve a specific value for a given field.
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
- * identifier will be generated experimentID
- * @param field field that filtering should be done. For example, if we want to execution user for a given
- * experiment, field will be "userName"
- * @return return the value for the specific field where data model is identified by the unique identifier that has
- * given
- */
- @Override
- public Object getValue(RegistryModelType dataType, Object identifier, String field) throws RegistryException {
- try {
- switch (dataType) {
- case EXPERIMENT:
- return experimentRegistry.getExperiment((String) identifier, field);
- case EXPERIMENT_CONFIGURATION_DATA:
- return experimentRegistry.getConfigData((String) identifier, field);
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while retrieving the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while retrieving the resource " + dataType.toString(), e);
- }
-
- }
-
- /**
- * This method is to retrieve all the identifiers according to given filtering criteria. For an example, if you want
- * to get all the experiment ids for a given gateway, your field name will be "gateway" and the value will be the
- * name of the gateway ("default"). Similar manner you can retrieve all the experiment ids for a given user.
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param fieldName FieldName is the field that filtering should be done. For example, if we want to retrieve all
- * the experiments for a given user, filterBy will be "userName"
- * @param value value for the filtering field. In the experiment case, value for "userName" can be "admin"
- * @return id list according to the filtering criteria
- */
- @Override
- public List<String> getIds(RegistryModelType dataType, String fieldName, Object value) throws RegistryException {
- try {
- switch (dataType) {
- case PROJECT:
- return projectRegistry.getProjectIDs(fieldName, value);
- case EXPERIMENT:
- return experimentRegistry.getExperimentIDs(fieldName, value);
- case EXPERIMENT_CONFIGURATION_DATA:
- return experimentRegistry.getExperimentIDs(fieldName, value);
- case WORKFLOW_NODE_DETAIL:
- return experimentRegistry.getWorkflowNodeIds(fieldName, value);
- case TASK_DETAIL:
- return experimentRegistry.getTaskDetailIds(fieldName, value);
- case JOB_DETAIL:
- return experimentRegistry.getJobDetailIds(fieldName, value);
- case DATA_TRANSFER_DETAIL:
- return experimentRegistry.getTransferDetailIds(fieldName, value);
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while retrieving the ids for" + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while retrieving the ids for " + dataType.toString(), e);
- }
-
- }
-
- /**
- * This method is to remove a item from the registry
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
- * identifier will be generated experimentID
- */
- @Override
- public void remove(RegistryModelType dataType, Object identifier) throws RegistryException {
- try {
- switch (dataType) {
- case PROJECT:
- projectRegistry.removeProject((String)identifier);
- break;
- case GATEWAY:
- gatewayRegistry.removeGateway((String)identifier);
- break;
- case EXPERIMENT:
- experimentRegistry.removeExperiment((String) identifier);
- break;
- case EXPERIMENT_CONFIGURATION_DATA:
- experimentRegistry.removeExperimentConfigData((String) identifier);
- break;
- case WORKFLOW_NODE_DETAIL:
- experimentRegistry.removeWorkflowNode((String) identifier);
- break;
- case TASK_DETAIL:
- experimentRegistry.removeTaskDetails((String) identifier);
- break;
- case JOB_DETAIL:
- experimentRegistry.removeJobDetails((CompositeIdentifier) identifier);
- break;
- case DATA_TRANSFER_DETAIL:
- experimentRegistry.removeDataTransferDetails((String) identifier);
- break;
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- experimentRegistry.removeComputationalScheduling(dataType, (String) identifier);
- break;
- case ADVANCE_OUTPUT_DATA_HANDLING:
- experimentRegistry.removeOutputDataHandling(dataType, (String) identifier);
- break;
- case ADVANCE_INPUT_DATA_HANDLING:
- experimentRegistry.removeInputDataHandling(dataType, (String) identifier);
- break;
- case QOS_PARAM:
- experimentRegistry.removeQOSParams(dataType, (String) identifier);
- break;
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while removing the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while removing the resource " + dataType.toString(), e);
- }
-
- }
-
- /**
- * This method will check whether a given data type which can be identified with the identifier exists or not
- *
- * @param dataType Data type is a predefined type which the programmer should choose according to the object he
- * is going to save in to registry
- * @param identifier Identifier which will uniquely identify the data model. For example, in Experiment_Basic_Type,
- * identifier will be generated experimentID
- * @return whether the given data type exists or not
- */
- @Override
- public boolean isExist(RegistryModelType dataType, Object identifier) throws RegistryException {
- try {
- switch (dataType) {
- case PROJECT:
- return projectRegistry.isProjectExist((String)identifier);
- case GATEWAY:
- return gatewayRegistry.isGatewayExist((String)identifier);
- case EXPERIMENT:
- return experimentRegistry.isExperimentExist((String) identifier);
- case EXPERIMENT_CONFIGURATION_DATA:
- return experimentRegistry.isExperimentConfigDataExist((String) identifier);
- case WORKFLOW_NODE_DETAIL:
- return experimentRegistry.isWFNodeExist((String) identifier);
- case TASK_DETAIL:
- return experimentRegistry.isTaskDetailExist((String) identifier);
- case JOB_DETAIL:
- return experimentRegistry.isJobDetailExist((CompositeIdentifier) identifier);
- case DATA_TRANSFER_DETAIL:
- return experimentRegistry.isTransferDetailExist((String) identifier);
- case COMPUTATIONAL_RESOURCE_SCHEDULING:
- return experimentRegistry.isComputationalSchedulingExist(dataType, (String) identifier);
- case ADVANCE_INPUT_DATA_HANDLING:
- return experimentRegistry.isInputDataHandlingExist(dataType, (String) identifier);
- case ADVANCE_OUTPUT_DATA_HANDLING:
- return experimentRegistry.isOutputDataHandlingExist(dataType, (String) identifier);
- case QOS_PARAM:
- return experimentRegistry.isQOSParamsExist(dataType, (String) identifier);
- default:
- logger.error("Unsupported data type...", new UnsupportedOperationException());
- throw new UnsupportedOperationException();
- }
- } catch (Exception e) {
- logger.error("Error while checking existence of the resource " + dataType.toString(), new RegistryException(e));
- throw new RegistryException("Error while checking existence of the resource " + dataType.toString(), e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/UserReg.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/UserReg.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/UserReg.java
deleted file mode 100644
index ef544b2..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/UserReg.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * 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.impl;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
-import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
-import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
-import org.apache.airavata.registry.cpi.RegistryException;
-
-public class UserReg {
- public WorkerResource getSystemUser() throws ApplicationSettingsException, RegistryException {
- return (WorkerResource)ResourceUtils.getWorker(ServerSettings.getDefaultUserGateway(), ServerSettings.getDefaultUser());
- }
-
- public WorkerResource getExistingUser (String gatewayName, String userName) throws RegistryException {
- return (WorkerResource)ResourceUtils.getWorker(gatewayName, userName);
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/AdvancedInputDataHandling.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/AdvancedInputDataHandling.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/AdvancedInputDataHandling.java
deleted file mode 100644
index 79ca0a8..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/AdvancedInputDataHandling.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "ADVANCE_INPUT_DATA_HANDLING")
-public class AdvancedInputDataHandling implements Serializable {
- @Id
- @GeneratedValue
- @Column(name = "INPUT_DATA_HANDLING_ID")
- private int dataHandlingId;
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "WORKING_DIR_PARENT")
- private String parentWorkingDir;
- @Column(name = "UNIQUE_WORKING_DIR")
- private String workingDir;
- @Column(name = "STAGE_INPUT_FILES_TO_WORKING_DIR")
- private boolean stageInputsToWorkingDir;
- @Column(name = "CLEAN_AFTER_JOB")
- private boolean cleanAfterJob;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- public int getDataHandlingId() {
- return dataHandlingId;
- }
-
- public void setDataHandlingId(int dataHandlingId) {
- this.dataHandlingId = dataHandlingId;
- }
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getParentWorkingDir() {
- return parentWorkingDir;
- }
-
- public void setParentWorkingDir(String parentWorkingDir) {
- this.parentWorkingDir = parentWorkingDir;
- }
-
- public String getWorkingDir() {
- return workingDir;
- }
-
- public void setWorkingDir(String workingDir) {
- this.workingDir = workingDir;
- }
-
- public boolean isStageInputsToWorkingDir() {
- return stageInputsToWorkingDir;
- }
-
- public void setStageInputsToWorkingDir(boolean stageInputsToWorkingDir) {
- this.stageInputsToWorkingDir = stageInputsToWorkingDir;
- }
-
- public boolean isCleanAfterJob() {
- return cleanAfterJob;
- }
-
- public void setCleanAfterJob(boolean cleanAfterJob) {
- this.cleanAfterJob = cleanAfterJob;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/AdvancedOutputDataHandling.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/AdvancedOutputDataHandling.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/AdvancedOutputDataHandling.java
deleted file mode 100644
index 73a70e2..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/AdvancedOutputDataHandling.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "ADVANCE_OUTPUT_DATA_HANDLING")
-public class AdvancedOutputDataHandling implements Serializable {
- @Id
- @GeneratedValue
- @Column(name = "OUTPUT_DATA_HANDLING_ID")
- private int outputDataHandlingId;
- @Column(name = "EXPERIMENT_ID")
- private String expId;
- @Column(name = "TASK_ID")
- private String taskId;
- @Column(name = "OUTPUT_DATA_DIR")
- private String outputDataDir;
- @Column(name = "DATA_REG_URL")
- private String dataRegUrl;
- @Column(name = "PERSIST_OUTPUT_DATA")
- private boolean persistOutputData;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "EXPERIMENT_ID")
- private Experiment experiment;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- public int getOutputDataHandlingId() {
- return outputDataHandlingId;
- }
-
- public void setOutputDataHandlingId(int outputDataHandlingId) {
- this.outputDataHandlingId = outputDataHandlingId;
- }
-
- public String getExpId() {
- return expId;
- }
-
- public void setExpId(String expId) {
- this.expId = expId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getOutputDataDir() {
- return outputDataDir;
- }
-
- public void setOutputDataDir(String outputDataDir) {
- this.outputDataDir = outputDataDir;
- }
-
- public String getDataRegUrl() {
- return dataRegUrl;
- }
-
- public void setDataRegUrl(String dataRegUrl) {
- this.dataRegUrl = dataRegUrl;
- }
-
- public boolean isPersistOutputData() {
- return persistOutputData;
- }
-
- public void setPersistOutputData(boolean persistOutputData) {
- this.persistOutputData = persistOutputData;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ApplicationInput.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ApplicationInput.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ApplicationInput.java
deleted file mode 100644
index 0488778..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ApplicationInput.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import org.apache.openjpa.persistence.DataCache;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@DataCache
-@Entity
-@Table(name = "APPLICATION_INPUT")
-@IdClass(ApplicationInput_PK.class)
-public class ApplicationInput implements Serializable {
- @Id
- @Column(name = "TASK_ID")
- private String taskId;
- @Id
- @Column(name = "INPUT_KEY")
- private String inputKey;
- @Column(name = "DATA_TYPE")
- private String dataType;
- @Column(name = "METADATA")
- private String metadata;
- @Lob
- @Column(name = "VALUE")
- private char[] value;
- @Column(name = "APP_ARGUMENT")
- private String appArgument;
-
- @Column(name = "INPUT_ORDER")
- private int inputOrder;
-
- @Column(name = "STANDARD_INPUT")
- private boolean standardInput;
-
- @Column(name = "USER_FRIENDLY_DESC")
- private String userFriendlyDesc;
-
- @Column(name="IS_REQUIRED")
- private boolean isRequired;
- @Column(name="REQUIRED_TO_COMMANDLINE")
- private boolean requiredToCMD;
- @Column(name = "DATA_STAGED")
- private boolean dataStaged;
-
- @ManyToOne(cascade= CascadeType.MERGE)
- @JoinColumn(name = "TASK_ID")
- private TaskDetail task;
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getMetadata() {
- return metadata;
- }
-
- public void setMetadata(String metadata) {
- this.metadata = metadata;
- }
-
- public char[] getValue() {
- return value;
- }
-
- public void setValue(char[] value) {
- this.value = value;
- }
-
- public String getAppArgument() {
- return appArgument;
- }
-
- public void setAppArgument(String appArgument) {
- this.appArgument = appArgument;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public boolean isRequired() {
- return isRequired;
- }
-
- public void setRequired(boolean isRequired) {
- this.isRequired = isRequired;
- }
-
- public boolean isRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- public boolean isDataStaged() {
- return dataStaged;
- }
-
- public void setDataStaged(boolean dataStaged) {
- this.dataStaged = dataStaged;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/22bcbb40/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ApplicationInput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ApplicationInput_PK.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ApplicationInput_PK.java
deleted file mode 100644
index e99cbd2..0000000
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ApplicationInput_PK.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.persistance.registry.jpa.model;
-
-import java.io.Serializable;
-
-public class ApplicationInput_PK implements Serializable {
- private String taskId;
- private String inputKey;
-
- public ApplicationInput_PK(String inputKey, String taskId) {
- this.inputKey = inputKey;
- this.taskId = taskId;
- }
-
- public ApplicationInput_PK() {
- ;
- }
-
- @Override
- public boolean equals(Object o) {
- return false;
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getInputKey() {
- return inputKey;
- }
-
- public void setInputKey(String inputKey) {
- this.inputKey = inputKey;
- }
-}