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/05 17:03:00 UTC
[01/22] airavata git commit: adding registry changes
Repository: airavata
Updated Branches:
refs/heads/master 13c2e79e4 -> 093643ac3
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkerResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkerResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkerResourceTest.java
deleted file mode 100644
index 8a9caee..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowDataResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowDataResourceTest.java
deleted file mode 100644
index 7aac186..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailExperimentCatResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailExperimentCatResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailExperimentCatResourceTest.java
index e26e880..887066b 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailExperimentCatResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailExperimentCatResourceTest.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.airavata.experiment.catalog;
+package org.apache.airavata.registry.core.experiment.catalog;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/WorkflowNodeDetailResourceTest.java
deleted file mode 100644
index 37b98cb..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java
index c148c89..52b30aa 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/util/Initialize.java
@@ -19,7 +19,7 @@
*
*/
-package org.apache.airavata.experiment.catalog.util;
+package org.apache.airavata.registry.core.experiment.catalog.util;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/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 0c4a4a1..c115239 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-experiment-catalog</artifactId>
+ <artifactId.airavata.registry.core.experiment.catalog</artifactId>
<version>${project.version}</version>
</dependency>
<!-- JCR Support -->
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/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 1957da7..875aec1 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.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.ExperimentCatalog;
import org.apache.airavata.registry.cpi.ExperimentCatalogModelType;
import org.apache.airavata.registry.cpi.RegistryException;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/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 ea75bec..054e195 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.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.ExpCatChildDataType;
import org.apache.airavata.registry.cpi.ExperimentCatalog;
import org.apache.airavata.registry.cpi.ExperimentCatalogModelType;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/workflow/workflow-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/workflow/workflow-core/pom.xml b/modules/workflow/workflow-core/pom.xml
index 9f6e056..103ce93 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-experiment-catalog</artifactId>
+ <artifactId.airavata.registry.core.experiment.catalog</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/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 6b9b5b4..a2befd5 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.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.registry.core.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/5a648a60/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 5842211..a41040c 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.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.registry.core.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/5a648a60/modules/xbaya-gui/pom.xml
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/pom.xml b/modules/xbaya-gui/pom.xml
index f1d1819..a1eeb7e 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-experiment-catalog</artifactId>
+ <artifactId.airavata.registry.core.experiment.catalog</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/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 3987773..092ba58 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.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.registry.core.experiment.catalog.ResourceType;
+import org.apache.airavata.registry.core.experiment.catalog.ResourceUtils;
+import org.apache.airavata.registry.core.experiment.catalog.resources.GatewayResource;
+import org.apache.airavata.registry.core.experiment.catalog.resources.UserResource;
+import org.apache.airavata.registry.core.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/5a648a60/samples/java-client/experiment/pom.xml
----------------------------------------------------------------------
diff --git a/samples/java-client/experiment/pom.xml b/samples/java-client/experiment/pom.xml
index e0bf817..472b660 100644
--- a/samples/java-client/experiment/pom.xml
+++ b/samples/java-client/experiment/pom.xml
@@ -18,7 +18,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>airavata-experiment-sample</artifactId>
+ <artifactId.airavata.registry.core.experiment.sample</artifactId>
<name>Samples - Single application experiment</name>
<url>http://airavata.apache.org/</url>
[09/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Experiment_Input.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Experiment_Input.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Experiment_Input.java
deleted file mode 100644
index c074889..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Experiment_Input_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Experiment_Input_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Experiment_Input_PK.java
deleted file mode 100644
index 4a9886f..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Experiment_Output.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Experiment_Output.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Experiment_Output.java
deleted file mode 100644
index d9d728f..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Experiment_Output_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Experiment_Output_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Experiment_Output_PK.java
deleted file mode 100644
index 822021a..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Gateway.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Gateway.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Gateway.java
deleted file mode 100644
index f3e693c..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Gateway_Worker.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Gateway_Worker.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Gateway_Worker.java
deleted file mode 100644
index d4ef9b9..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Gateway_Worker_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Gateway_Worker_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Gateway_Worker_PK.java
deleted file mode 100644
index 49ca862..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/JobDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/JobDetail.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/JobDetail.java
deleted file mode 100644
index 7142313..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/JobDetail.java
+++ /dev/null
@@ -1,135 +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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/JobDetails_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/JobDetails_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/JobDetails_PK.java
deleted file mode 100644
index a68a1a0..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/NodeInput.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/NodeInput.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/NodeInput.java
deleted file mode 100644
index 1109774..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/NodeInput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/NodeInput_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/NodeInput_PK.java
deleted file mode 100644
index 3aeb980..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/NodeOutput.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/NodeOutput.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/NodeOutput.java
deleted file mode 100644
index 9831805..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/NodeOutput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/NodeOutput_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/NodeOutput_PK.java
deleted file mode 100644
index fcbd4cf..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Notification_Email.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Notification_Email.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Notification_Email.java
deleted file mode 100644
index 8c8606e..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Project.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Project.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Project.java
deleted file mode 100644
index 96bbf54..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ProjectUser.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ProjectUser.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ProjectUser.java
deleted file mode 100644
index 5bb8804..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ProjectUser_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ProjectUser_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ProjectUser_PK.java
deleted file mode 100644
index 0d0fb40..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/QosParam.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/QosParam.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/QosParam.java
deleted file mode 100644
index 9b3f081..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Status.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Status.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Status.java
deleted file mode 100644
index 52e088a..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/TaskDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/TaskDetail.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/TaskDetail.java
deleted file mode 100644
index 423b189..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/TaskDetail.java
+++ /dev/null
@@ -1,221 +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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Users.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Users.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Users.java
deleted file mode 100644
index f0b9b49..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/WorkflowNodeDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/WorkflowNodeDetail.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/WorkflowNodeDetail.java
deleted file mode 100644
index 7d38322..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/WorkflowNodeDetail.java
+++ /dev/null
@@ -1,155 +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.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;
- }
-}
[21/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
adding registry changes
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/5a648a60
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/5a648a60
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/5a648a60
Branch: refs/heads/master
Commit: 5a648a60fb8d6f736406fea001cc73c4d500b060
Parents: ec8c620
Author: Chathuri Wimalasena <ch...@apache.org>
Authored: Fri Jun 5 11:00:54 2015 -0400
Committer: Chathuri Wimalasena <ch...@apache.org>
Committed: Fri Jun 5 11:00:54 2015 -0400
----------------------------------------------------------------------
airavata-api/airavata-api-server/pom.xml | 2 +-
.../server/handler/AiravataServerHandler.java | 4 +-
.../client_samples/createExperiment.cpp | 4 +-
.../resources/client_samples/createProject.cpp | 4 +-
.../client_samples/getExperimentOutputs.cpp | 4 +-
.../client_samples/getExperimentStatus.cpp | 4 +-
.../client_samples/launchExperiment.cpp | 4 +-
.../lib/apache/airavata/api/Airavata.py | 8 +-
.../airavata-api/airavataAPI.thrift | 4 +-
.../airavata-api/experimentModel.thrift | 2 +-
.../main/resources/airavata-client.properties | 14 +-
modules/gfac/gfac-core/pom.xml | 2 +-
.../services/impl/BigRed2TestWithSSHAuth.java | 2 +-
.../impl/GSISSHProviderTestWithMyProxyAuth.java | 2 +-
.../gfac/services/impl/LocalProviderTest.java | 2 +-
modules/gfac/gfac-service/pom.xml | 2 +-
modules/integration-tests/pom.xml | 2 +-
modules/orchestrator/orchestrator-core/pom.xml | 2 +-
.../orchestrator/core/ValidatorTest.java | 2 +-
.../app/catalog/model/DataMovementProtocol.java | 76 -
.../catalog/model/DataMovementProtocolPK.java | 74 -
.../catalog/model/JobSubmissionProtocol.java | 77 -
.../catalog/model/JobSubmissionProtocolPK.java | 74 -
.../app/catalog/resources/AbstractResource.java | 382 ---
.../resources/AppDeploymentResource.java | 446 ---
.../resources/AppEnvironmentResource.java | 293 --
.../catalog/resources/AppInterfaceResource.java | 363 ---
.../resources/AppModuleMappingResource.java | 317 --
.../catalog/resources/AppModuleResource.java | 344 --
.../resources/ApplicationInputResource.java | 454 ---
.../resources/ApplicationOutputResource.java | 432 ---
.../catalog/resources/BatchQueueResource.java | 357 ---
.../resources/CloudSubmissionResource.java | 298 --
.../ComputeHostPreferenceResource.java | 413 ---
.../ComputeResourceFileSystemResource.java | 307 --
.../resources/ComputeResourceResource.java | 351 ---
.../DataMovementInterfaceResource.java | 339 --
.../resources/DataMovementProtocolResource.java | 360 ---
.../catalog/resources/GSISSHExportResource.java | 324 --
.../resources/GSISSHSubmissionResource.java | 373 ---
.../resources/GatewayProfileResource.java | 318 --
.../resources/GlobusGKEndpointResource.java | 321 --
.../resources/GlobusJobSubmissionResource.java | 315 --
.../resources/GridftpDataMovementResource.java | 279 --
.../resources/GridftpEndpointResource.java | 317 --
.../catalog/resources/HostAliasResource.java | 317 --
.../resources/HostIPAddressResource.java | 318 --
.../resources/JobManagerCommandResource.java | 307 --
.../JobSubmissionInterfaceResource.java | 339 --
.../JobSubmissionProtocolResource.java | 359 ---
.../resources/LibraryApendPathResource.java | 292 --
.../resources/LibraryPrepandPathResource.java | 291 --
.../resources/LocalDataMovementResource.java | 249 --
.../resources/LocalSubmissionResource.java | 293 --
.../resources/ModuleLoadCmdResource.java | 300 --
.../resources/PostJobCommandResource.java | 333 --
.../resources/PreJobCommandResource.java | 333 --
.../core/app/catalog/resources/Resource.java | 89 -
.../resources/ResourceJobManagerResource.java | 301 --
.../resources/ScpDataMovementResource.java | 308 --
.../resources/SshJobSubmissionResource.java | 332 --
.../resources/UnicoreDataMovementResource.java | 255 --
.../resources/UnicoreJobSubmissionResource.java | 328 --
.../resources/WorkflowInputResource.java | 451 ---
.../resources/WorkflowOutputResource.java | 410 ---
.../app/catalog/resources/WorkflowResource.java | 382 ---
.../catalog/impl/ExperimentCatalogImpl.java | 2 +-
.../catalog/impl/ExperimentRegistry.java | 2 +-
.../catalog/impl/GatewayRegistry.java | 2 +-
.../impl/LoggingExperimentCatalogImpl.java | 2 +-
.../catalog/impl/ProjectRegistry.java | 2 +-
.../catalog/impl/RegistryFactory.java | 2 +-
.../core/experiment/catalog/impl/UserReg.java | 2 +-
.../core/experimet/catalog/JPAConstants.java | 33 -
.../core/experimet/catalog/Resource.java | 71 -
.../core/experimet/catalog/ResourceType.java | 50 -
.../core/experimet/catalog/ResourceUtils.java | 525 ---
.../catalog/impl/ExperimentCatalogImpl.java | 735 -----
.../catalog/impl/ExperimentRegistry.java | 2983 ------------------
.../experimet/catalog/impl/GatewayRegistry.java | 115 -
.../impl/LoggingExperimentCatalogImpl.java | 97 -
.../experimet/catalog/impl/ProjectRegistry.java | 303 --
.../experimet/catalog/impl/RegistryFactory.java | 80 -
.../core/experimet/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 -
.../experimet/catalog/model/Configuration.java | 80 -
.../catalog/model/Configuration_PK.java | 74 -
.../catalog/model/DataTransferDetail.java | 91 -
.../experimet/catalog/model/ErrorDetail.java | 176 --
.../experimet/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 -
.../core/experimet/catalog/model/Gateway.java | 76 -
.../experimet/catalog/model/Gateway_Worker.java | 82 -
.../catalog/model/Gateway_Worker_PK.java | 64 -
.../core/experimet/catalog/model/JobDetail.java | 135 -
.../experimet/catalog/model/JobDetails_PK.java | 64 -
.../core/experimet/catalog/model/NodeInput.java | 163 -
.../experimet/catalog/model/NodeInput_PK.java | 64 -
.../experimet/catalog/model/NodeOutput.java | 140 -
.../experimet/catalog/model/NodeOutput_PK.java | 64 -
.../catalog/model/Notification_Email.java | 81 -
.../core/experimet/catalog/model/Project.java | 125 -
.../experimet/catalog/model/ProjectUser.java | 81 -
.../experimet/catalog/model/ProjectUser_PK.java | 64 -
.../core/experimet/catalog/model/QosParam.java | 103 -
.../core/experimet/catalog/model/Status.java | 146 -
.../experimet/catalog/model/TaskDetail.java | 221 --
.../core/experimet/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 --
.../core/experimet/catalog/resources/Utils.java | 1011 ------
.../catalog/resources/WorkerResource.java | 725 -----
.../resources/WorkflowNodeDetailResource.java | 515 ---
.../experimet/catalog/utils/QueryGenerator.java | 128 -
.../utils/ThriftDataModelConversion.java | 686 ----
.../src/main/resources/META-INF/app-catalog.xml | 67 -
.../src/main/resources/META-INF/persistence.xml | 29 -
.../app/catalog/ComputeResourceTest.java | 297 --
.../catalog/AbstractResourceTest.java | 4 +-
.../catalog/ComputationalSchedulingTest.java | 2 +-
.../ConfigurationExperimentCatResourceTest.java | 2 +-
.../catalog/ConfigurationResourceTest.java | 58 -
.../catalog/ExecutionErrorResourceTest.java | 95 -
.../catalog/ExperimentCatalogUseCaseTest.java | 6 +-
.../catalog/ExperimentDataResourceTest.java | 107 -
.../ExperimentExperimentCatResourceTest.java | 2 +-
...xperimentInputExperimentCatResourceTest.java | 2 +-
.../catalog/ExperimentInputResourceTest.java | 75 -
.../catalog/ExperimentMetadataResourceTest.java | 87 -
...perimentOutputExperimentCatResourceTest.java | 2 +-
.../catalog/ExperimentOutputResourceTest.java | 76 -
.../catalog/ExperimentResourceTest.java | 77 -
.../catalog/GFacJobDataResourceTest.java | 77 -
.../catalog/GFacJobStatusResourceTest.java | 87 -
.../GatewayExperimentCatResourceTest.java | 2 +-
.../experiment/catalog/GatewayResourceTest.java | 120 -
.../catalog/GramDataResourceTest.java | 72 -
.../catalog/NodeDataResourceTest.java | 72 -
.../catalog/OrchestratorDataResourceTest.java | 69 -
.../TaskDetailExperimentCatResourceTest.java | 2 +-
.../catalog/TaskDetailResourceTest.java | 93 -
.../catalog/UserExperimentCatResourceTest.java | 2 +-
.../experiment/catalog/UserResourceTest.java | 54 -
.../experiment/catalog/WorkerResourceTest.java | 122 -
.../catalog/WorkflowDataResourceTest.java | 106 -
...flowNodeDetailExperimentCatResourceTest.java | 2 +-
.../catalog/WorkflowNodeDetailResourceTest.java | 85 -
.../experiment/catalog/util/Initialize.java | 2 +-
modules/workflow-model/workflow-engine/pom.xml | 2 +-
.../workflow/engine/WorkflowEngineImpl.java | 2 +-
.../engine/interpretor/WorkflowInterpreter.java | 2 +-
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 +-
samples/java-client/experiment/pom.xml | 2 +-
191 files changed, 70 insertions(+), 35522 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/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 64ca836..3f0537a 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-experiment-catalog</artifactId>
+ <artifactId.airavata.registry.core.experiment.catalog</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/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 de29085..940210a 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
@@ -1145,7 +1145,7 @@ public class AiravataServerHandler implements Airavata.Iface {
* has to subsequently configure and launch the created experiment. No action is taken on Airavata Server except
* registering the experiment in a persistent store.
*
- * @param experiment@return The server-side generated airavata experiment globally unique identifier.
+ * @param experiment@return The server-side generated.airavata.registry.core.experiment.globally unique identifier.
* @throws org.apache.airavata.model.error.InvalidRequestException For any incorrect forming of the request itself.
* @throws org.apache.airavata.model.error.AiravataClientException The following list of exceptions are thrown which Airavata Client can take corrective actions to resolve:
* <p/>
@@ -1685,7 +1685,7 @@ public class AiravataServerHandler implements Airavata.Iface {
* experiment name that should be used in the cloned experiment
*
* @return
- * The server-side generated airavata experiment globally unique identifier for the newly cloned experiment.
+ * The server-side generated.airavata.registry.core.experiment.globally unique identifier for the newly cloned experiment.
*
* @throws org.apache.airavata.model.error.InvalidRequestException
* For any incorrect forming of the request itself.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/createExperiment.cpp
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/createExperiment.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/createExperiment.cpp
index f4bff07..bf8c4d1 100644
--- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/createExperiment.cpp
+++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/createExperiment.cpp
@@ -37,8 +37,8 @@
#include "../lib/airavata/airavataDataModel_types.cpp"
#include "../lib/airavata/airavataErrors_types.h"
#include "../lib/airavata/airavataErrors_types.cpp"
-#include "../lib/airavata/experimentModel_types.h"
-#include "../lib/airavata/experimentModel_types.cpp"
+#include "../lib.airavata.registry.core.experiment.odel_types.h"
+#include "../lib.airavata.registry.core.experiment.odel_types.cpp"
#include "../lib/airavata/workspaceModel_types.h"
#include "../lib/airavata/workspaceModel_types.cpp"
#include "../lib/airavata/airavataAPI_types.h"
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/createProject.cpp
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/createProject.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/createProject.cpp
index 348e9ce..da2d02c 100644
--- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/createProject.cpp
+++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/createProject.cpp
@@ -37,8 +37,8 @@
#include "../lib/airavata/airavataDataModel_types.cpp"
#include "../lib/airavata/airavataErrors_types.h"
#include "../lib/airavata/airavataErrors_types.cpp"
-#include "../lib/airavata/experimentModel_types.h"
-#include "../lib/airavata/experimentModel_types.cpp"
+#include "../lib.airavata.registry.core.experiment.odel_types.h"
+#include "../lib.airavata.registry.core.experiment.odel_types.cpp"
#include "../lib/airavata/workspaceModel_types.h"
#include "../lib/airavata/workspaceModel_types.cpp"
#include "../lib/airavata/airavataAPI_types.h"
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/getExperimentOutputs.cpp
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/getExperimentOutputs.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/getExperimentOutputs.cpp
index b3cb28e..a4b9797 100644
--- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/getExperimentOutputs.cpp
+++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/getExperimentOutputs.cpp
@@ -37,8 +37,8 @@
#include "../lib/airavata/airavataDataModel_types.cpp"
#include "../lib/airavata/airavataErrors_types.h"
#include "../lib/airavata/airavataErrors_types.cpp"
-#include "../lib/airavata/experimentModel_types.h"
-#include "../lib/airavata/experimentModel_types.cpp"
+#include "../lib.airavata.registry.core.experiment.odel_types.h"
+#include "../lib.airavata.registry.core.experiment.odel_types.cpp"
#include "../lib/airavata/workspaceModel_types.h"
#include "../lib/airavata/workspaceModel_types.cpp"
#include "../lib/airavata/airavataAPI_types.h"
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/getExperimentStatus.cpp
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/getExperimentStatus.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/getExperimentStatus.cpp
index 36af323..f340734 100644
--- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/getExperimentStatus.cpp
+++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/getExperimentStatus.cpp
@@ -37,8 +37,8 @@
#include "../lib/airavata/airavataDataModel_types.cpp"
#include "../lib/airavata/airavataErrors_types.h"
#include "../lib/airavata/airavataErrors_types.cpp"
-#include "../lib/airavata/experimentModel_types.h"
-#include "../lib/airavata/experimentModel_types.cpp"
+#include "../lib.airavata.registry.core.experiment.odel_types.h"
+#include "../lib.airavata.registry.core.experiment.odel_types.cpp"
#include "../lib/airavata/workspaceModel_types.h"
#include "../lib/airavata/workspaceModel_types.cpp"
#include "../lib/airavata/airavataAPI_types.h"
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/launchExperiment.cpp
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/launchExperiment.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/launchExperiment.cpp
index bf4ce7c..2dc95a6 100644
--- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/launchExperiment.cpp
+++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/client_samples/launchExperiment.cpp
@@ -37,8 +37,8 @@
#include "../lib/airavata/airavataDataModel_types.cpp"
#include "../lib/airavata/airavataErrors_types.h"
#include "../lib/airavata/airavataErrors_types.cpp"
-#include "../lib/airavata/experimentModel_types.h"
-#include "../lib/airavata/experimentModel_types.cpp"
+#include "../lib.airavata.registry.core.experiment.odel_types.h"
+#include "../lib.airavata.registry.core.experiment.odel_types.cpp"
#include "../lib/airavata/workspaceModel_types.h"
#include "../lib/airavata/workspaceModel_types.cpp"
#include "../lib/airavata/airavataAPI_types.h"
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py
index 6a81820..cd0638c 100644
--- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py
+++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py
@@ -619,7 +619,7 @@ class Iface:
the ExperimentMetadata is a required field.
@return
- The server-side generated airavata experiment globally unique identifier.
+ The server-side generated.airavata.registry.core.experiment.globally unique identifier.
@throws org.apache.airavata.model.error.InvalidRequestException
For any incorrect forming of the request itself.
@@ -870,7 +870,7 @@ class Iface:
should be shared public by default.
@return
- The server-side generated airavata experiment globally unique identifier for the newly cloned experiment.
+ The server-side generated.airavata.registry.core.experiment.globally unique identifier for the newly cloned experiment.
@throws org.apache.airavata.model.error.InvalidRequestException
For any incorrect forming of the request itself.
@@ -3832,7 +3832,7 @@ class Client(Iface):
the ExperimentMetadata is a required field.
@return
- The server-side generated airavata experiment globally unique identifier.
+ The server-side generated.airavata.registry.core.experiment.globally unique identifier.
@throws org.apache.airavata.model.error.InvalidRequestException
For any incorrect forming of the request itself.
@@ -4467,7 +4467,7 @@ class Client(Iface):
should be shared public by default.
@return
- The server-side generated airavata experiment globally unique identifier for the newly cloned experiment.
+ The server-side generated.airavata.registry.core.experiment.globally unique identifier for the newly cloned experiment.
@throws org.apache.airavata.model.error.InvalidRequestException
For any incorrect forming of the request itself.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/component-interface-descriptions/airavata-api/airavataAPI.thrift
----------------------------------------------------------------------
diff --git a/component-interface-descriptions/airavata-api/airavataAPI.thrift b/component-interface-descriptions/airavata-api/airavataAPI.thrift
index 9251a56..699e96b 100644
--- a/component-interface-descriptions/airavata-api/airavataAPI.thrift
+++ b/component-interface-descriptions/airavata-api/airavataAPI.thrift
@@ -605,7 +605,7 @@ service Airavata {
* the ExperimentMetadata is a required field.
*
* @return
- * The server-side generated airavata experiment globally unique identifier.
+ * The server-side generated.airavata.registry.core.experiment.globally unique identifier.
*
* @throws org.apache.airavata.model.error.InvalidRequestException
* For any incorrect forming of the request itself.
@@ -842,7 +842,7 @@ service Airavata {
* should be shared public by default.
*
* @return
- * The server-side generated airavata experiment globally unique identifier for the newly cloned experiment.
+ * The server-side generated.airavata.registry.core.experiment.globally unique identifier for the newly cloned experiment.
*
* @throws org.apache.airavata.model.error.InvalidRequestException
* For any incorrect forming of the request itself.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/component-interface-descriptions/airavata-api/experimentModel.thrift
----------------------------------------------------------------------
diff --git a/component-interface-descriptions/airavata-api/experimentModel.thrift b/component-interface-descriptions/airavata-api/experimentModel.thrift
index d0d50f9..7bc2dc7 100644
--- a/component-interface-descriptions/airavata-api/experimentModel.thrift
+++ b/component-interface-descriptions/airavata-api/experimentModel.thrift
@@ -27,7 +27,7 @@ namespace cpp apache.airavata.model.workspace.experiment
namespace py apache.airavata.model.workspace.experiment
/*
- * This file describes the definitions of the Airavata Experiment Data Structures. Each of the
+ * This file describes the definitions of the.airavata.registry.core.experiment.Data Structures. Each of the
* language specific Airavata Client SDK's will translate this neutral data model into an
* appropriate form for passing to the Airavata Server Execution API Calls.
*
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/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 14d37c7..e8bb332 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.experimentregistry.impl.AiravataJPARegistry
+#class.registry.accessor=org.apache.airavata.registry.core.experiment.egistry.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.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
+#class.provenance.registry.accessor=org.apache.airavata.registry.core.experiment.egistry.jpa.impl.AiravataJPARegistry
+#class.configuration.registry.accessor=org.apache.airavata.registry.core.experiment.egistry.jpa.impl.AiravataJPARegistry
+#class.descriptor.registry.accessor=org.apache.airavata.registry.core.experiment.egistry.jpa.impl.AiravataJPARegistry
+#class.project.registry.accessor=org.apache.airavata.registry.core.experiment.egistry.jpa.impl.AiravataJPARegistry
+#class.user.workflow.registry.accessor=org.apache.airavata.registry.core.experiment.egistry.jpa.impl.AiravataJPARegistry
+#class.published.workflow.registry.accessor=org.apache.airavata.registry.core.experiment.egistry.jpa.impl.AiravataJPARegistry
########################Registry Rest Implementation Settings########################
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/gfac/gfac-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/pom.xml b/modules/gfac/gfac-core/pom.xml
index 079fe36..f1de99c 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-experiment-catalog</artifactId>
+ <artifactId.airavata.registry.core.experiment.catalog</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java b/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
index 38981aa..2c15c5e 100644
--- a/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
+++ b/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
@@ -42,7 +42,7 @@
//import org.apache.airavata.gfac.ssh.impl.authentication.DefaultPublicKeyFileAuthentication;
//import org.apache.airavata.gfac.ssh.util.CommonUtils;
//import org.apache.airavata.model.workspace.experiment.TaskDetails;
-//import org.apache.airavata.experiment.registry.jpa.impl.RegistryFactory;
+//import org.apache.airavata.registry.core.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/5a648a60/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java b/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
index 61db417..9b922dd 100644
--- a/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
+++ b/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
@@ -49,7 +49,7 @@
//import org.apache.airavata.gfac.ssh.util.CommonUtils;
//import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
//import org.apache.airavata.model.workspace.experiment.TaskDetails;
-//import org.apache.airavata.experiment.registry.jpa.impl.RegistryFactory;
+//import org.apache.airavata.registry.core.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/5a648a60/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java b/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java
index b3974d2..0ff53fd 100644
--- a/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java
+++ b/modules/gfac/gfac-impl/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.experiment.registry.jpa.impl.LoggingRegistryImpl;
+//import org.apache.airavata.registry.core.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/5a648a60/modules/gfac/gfac-service/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-service/pom.xml b/modules/gfac/gfac-service/pom.xml
index 83999e3..f3b794b 100644
--- a/modules/gfac/gfac-service/pom.xml
+++ b/modules/gfac/gfac-service/pom.xml
@@ -52,7 +52,7 @@
</dependency>
<dependency>
<groupId>org.apache.airavata</groupId>
- <artifactId>airavata-experiment-catalog</artifactId>
+ <artifactId.airavata.registry.core.experiment.catalog</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/modules/integration-tests/pom.xml b/modules/integration-tests/pom.xml
index 7dc520a..b4700ec 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-experiment-catalog</artifactId>
+ <artifactId.airavata.registry.core.experiment.catalog</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/orchestrator/orchestrator-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/pom.xml b/modules/orchestrator/orchestrator-core/pom.xml
index 43ae617..4882e58 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-experiment-catalog</artifactId>
+ <artifactId.airavata.registry.core.experiment.catalog</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/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 2b3e935..2ef4dc5 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.experiment.registry.jpa.impl.RegistryFactory;
+//import org.apache.airavata.registry.core.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementProtocol.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementProtocol.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementProtocol.java
deleted file mode 100644
index d45c4e8..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementProtocol.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.aiaravata.application.catalog.data.model;
-//
-//import javax.persistence.*;
-//import java.io.Serializable;
-//
-//@Entity
-//@Table(name = "DATA_MOVEMENT_PROTOCOL")
-//@IdClass(DataMovementProtocolPK.class)
-//public class DataMovementProtocol implements Serializable {
-// @Id
-// @Column(name = "RESOURCE_ID")
-// private String resourceID;
-// @Id
-// @Column(name = "DATA_MOVE_ID")
-// private String dataMoveID;
-// @Id
-// @Column(name = "DATA_MOVE_TYPE")
-// private String dataMoveType;
-//
-// @ManyToOne(cascade= CascadeType.MERGE)
-// @JoinColumn(name = "RESOURCE_ID")
-// private ComputeResource computeResource;
-//
-// public String getResourceID() {
-// return resourceID;
-// }
-//
-// public void setResourceID(String resourceID) {
-// this.resourceID = resourceID;
-// }
-//
-// public String getDataMoveID() {
-// return dataMoveID;
-// }
-//
-// public void setDataMoveID(String dataMoveID) {
-// this.dataMoveID = dataMoveID;
-// }
-//
-// public String getDataMoveType() {
-// return dataMoveType;
-// }
-//
-// public void setDataMoveType(String dataMoveType) {
-// this.dataMoveType = dataMoveType;
-// }
-//
-// public ComputeResource getComputeResource() {
-// return computeResource;
-// }
-//
-// public void setComputeResource(ComputeResource computeResource) {
-// this.computeResource = computeResource;
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementProtocolPK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementProtocolPK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementProtocolPK.java
deleted file mode 100644
index 9e53d1f..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/DataMovementProtocolPK.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.aiaravata.application.catalog.data.model;
-//
-//import java.io.Serializable;
-//
-//public class DataMovementProtocolPK implements Serializable {
-// private String resourceID;
-// private String dataMoveID;
-// private String dataMoveType;
-//
-// public DataMovementProtocolPK(String resourceID, String dataMoveID, String dataMoveType) {
-// this.resourceID = resourceID;
-// this.dataMoveID = dataMoveID;
-// this.dataMoveType = dataMoveType;
-// }
-//
-// public DataMovementProtocolPK() {
-// ;
-// }
-//
-// @Override
-// public boolean equals(Object o) {
-// return false;
-// }
-//
-// @Override
-// public int hashCode() {
-// return 1;
-// }
-//
-// public String getResourceID() {
-// return resourceID;
-// }
-//
-// public void setResourceID(String resourceID) {
-// this.resourceID = resourceID;
-// }
-//
-// public String getDataMoveID() {
-// return dataMoveID;
-// }
-//
-// public void setDataMoveID(String dataMoveID) {
-// this.dataMoveID = dataMoveID;
-// }
-//
-// public String getDataMoveType() {
-// return dataMoveType;
-// }
-//
-// public void setDataMoveType(String dataMoveType) {
-// this.dataMoveType = dataMoveType;
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionProtocol.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionProtocol.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionProtocol.java
deleted file mode 100644
index d913e58..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionProtocol.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.aiaravata.application.catalog.data.model;
-//
-//import javax.persistence.*;
-//import java.io.Serializable;
-//
-//@Entity
-//@Table(name = "JOB_SUBMISSION_PROTOCOL")
-//@IdClass(JobSubmissionProtocolPK.class)
-//public class JobSubmissionProtocol implements Serializable {
-// @Id
-// @Column(name = "RESOURCE_ID")
-// private String resourceID;
-// @Id
-// @Column(name = "SUBMISSION_ID")
-// private String submissionID;
-//
-// @Id
-// @Column(name = "JOB_TYPE")
-// private String jobType;
-//
-// @ManyToOne(cascade= CascadeType.MERGE)
-// @JoinColumn(name = "RESOURCE_ID")
-// private ComputeResource computeResource;
-//
-// public String getResourceID() {
-// return resourceID;
-// }
-//
-// public void setResourceID(String resourceID) {
-// this.resourceID = resourceID;
-// }
-//
-// public String getSubmissionID() {
-// return submissionID;
-// }
-//
-// public void setSubmissionID(String submissionID) {
-// this.submissionID = submissionID;
-// }
-//
-// public String getJobType() {
-// return jobType;
-// }
-//
-// public void setJobType(String jobType) {
-// this.jobType = jobType;
-// }
-//
-// public ComputeResource getComputeResource() {
-// return computeResource;
-// }
-//
-// public void setComputeResource(ComputeResource computeResource) {
-// this.computeResource = computeResource;
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionProtocolPK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionProtocolPK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionProtocolPK.java
deleted file mode 100644
index aefe87a..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/JobSubmissionProtocolPK.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.aiaravata.application.catalog.data.model;
-//
-//import java.io.Serializable;
-//
-//public class JobSubmissionProtocolPK implements Serializable {
-// private String resourceID;
-// private String submissionID;
-// private String jobType;
-//
-// public JobSubmissionProtocolPK(String resourceID, String submissionID, String jobType) {
-// this.resourceID = resourceID;
-// this.submissionID = submissionID;
-// this.jobType = jobType;
-// }
-//
-// public JobSubmissionProtocolPK() {
-// ;
-// }
-//
-// @Override
-// public boolean equals(Object o) {
-// return false;
-// }
-//
-// @Override
-// public int hashCode() {
-// return 1;
-// }
-//
-// public String getResourceID() {
-// return resourceID;
-// }
-//
-// public void setResourceID(String resourceID) {
-// this.resourceID = resourceID;
-// }
-//
-// public String getSubmissionID() {
-// return submissionID;
-// }
-//
-// public void setSubmissionID(String submissionID) {
-// this.submissionID = submissionID;
-// }
-//
-// public String getJobType() {
-// return jobType;
-// }
-//
-// public void setJobType(String jobType) {
-// this.jobType = jobType;
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AbstractResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AbstractResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AbstractResource.java
deleted file mode 100644
index e1b042d..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AbstractResource.java
+++ /dev/null
@@ -1,382 +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.aiaravata.application.catalog.data.resources;
-
-public abstract class AbstractResource implements Resource {
- // table names
- public static final String COMPUTE_RESOURCE = "ComputeResource";
- public static final String HOST_ALIAS = "HostAlias";
- public static final String HOST_IPADDRESS = "HostIPAddress";
- public static final String GSISSH_SUBMISSION = "GSISSHSubmission";
- public static final String GSISSH_EXPORT = "GSISSHExport";
- public static final String PRE_JOBCOMMAND = "PreJobCommand";
- public static final String POST_JOBCOMMAND = "PostJobCommand";
- public static final String GLOBUS_SUBMISSION = "GlobusJobSubmission";
- public static final String UNICORE_JOB_SUBMISSION = "UnicoreJobSubmission";
- public static final String UNICORE_DATA_MOVEMENT = "UnicoreDataMovement";
- public static final String GLOBUS_GK_ENDPOINT = "GlobusGKEndpoint";
- public static final String SSH_SUBMISSION = "SSHSubmission";
- public static final String SCP_DATA_MOVEMENT = "ScpDataMovement";
- public static final String GRIDFTP_DATA_MOVEMENT = "GridftpDataMovement";
- public static final String GRIDFTP_ENDPOINT = "GridftpEndpoint";
- public static final String JOB_SUBMISSION_PROTOCOL = "JobSubmissionProtocol";
- public static final String DATA_MOVEMENT_PROTOCOL = "DataMovementProtocol";
- public static final String APPLICATION_MODULE = "ApplicationModule";
- public static final String APPLICATION_DEPLOYMENT = "ApplicationDeployment";
- public static final String LIBRARY_PREPAND_PATH = "LibraryPrepandPath";
- public static final String LIBRARY_APEND_PATH = "LibraryApendPath";
- public static final String APP_ENVIRONMENT = "AppEnvironment";
- public static final String APPLICATION_INTERFACE = "ApplicationInterface";
- public static final String APP_MODULE_MAPPING = "AppModuleMapping";
- public static final String APPLICATION_INPUT = "ApplicationInput";
- public static final String WORKFLOW_INPUT = "WorkflowInput";
- public static final String APPLICATION_OUTPUT = "ApplicationOutput";
- public static final String WORKFLOW_OUTPUT = "WorkflowOutput";
- public static final String GATEWAY_PROFILE = "GatewayProfile";
- public static final String COMPUTE_RESOURCE_PREFERENCE = "ComputeResourcePreference";
- public static final String BATCH_QUEUE = "BatchQueue";
- public static final String COMPUTE_RESOURCE_FILE_SYSTEM = "ComputeResourceFileSystem";
- public static final String JOB_SUBMISSION_INTERFACE = "JobSubmissionInterface";
- public static final String DATA_MOVEMENT_INTERFACE = "DataMovementInterface";
- public static final String RESOURCE_JOB_MANAGER = "ResourceJobManager";
- public static final String JOB_MANAGER_COMMAND = "JobManagerCommand";
- public static final String LOCAL_SUBMISSION = "LocalSubmission";
- public static final String LOCAL_DATA_MOVEMENT = "LocalDataMovement";
- public static final String SSH_JOB_SUBMISSION = "SshJobSubmission";
- public static final String EMAIL_PROPERTY = "EmailMonitorProperty";
- public static final String CLOUD_JOB_SUBMISSION = "CloudJobSubmission";
- public static final String MODULE_LOAD_CMD = "ModuleLoadCmd";
- public static final String WORKFLOW = "Workflow";
-
- public final class EmailMonitorPropertyConstants {
- public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionId";
- }
-
- // Compute Resource Table
- public final class ComputeResourceConstants {
- public static final String RESOURCE_DESCRIPTION = "resourceDescription";
- public static final String RESOURCE_ID = "resourceId";
- public static final String HOST_NAME = "hostName";
- }
-
- // Host Alias Table
- public final class HostAliasConstants {
- public static final String RESOURCE_ID = "resourceID";
- public static final String ALIAS = "alias";
- }
-
- // Host IPAddress Table
- public final class HostIPAddressConstants {
- public static final String RESOURCE_ID = "resourceID";
- public static final String IP_ADDRESS = "ipaddress";
- }
-
- // GSSISSH Submission Table
- public final class GSISSHSubmissionConstants {
- public static final String SUBMISSION_ID = "submissionID";
- public static final String RESOURCE_JOB_MANAGER = "resourceJobManager";
- public static final String SSH_PORT = "sshPort";
- public static final String INSTALLED_PATH = "installedPath";
- public static final String MONITOR_MODE = "monitorMode";
- }
-
- // GSSISSH Export Table
- public final class GSISSHExportConstants {
- public static final String SUBMISSION_ID = "submissionID";
- public static final String EXPORT = "export";
- }
-
- // GSSISSH Pre Job Command Table
- public final class PreJobCommandConstants {
- public static final String DEPLOYMENT_ID = "deploymentId";
- public static final String COMMAND = "command";
- }
-
- // GSSISSH Post Job Command Table
- public final class PostJobCommandConstants {
- public static final String DEPLOYMENT_ID = "deploymentId";
- public static final String COMMAND = "command";
- }
-
- // GSSISSH Post Job Command Table
- public final class GlobusJobSubmissionConstants {
- public static final String SUBMISSION_ID = "submissionID";
- public static final String RESOURCE_JOB_MANAGER = "resourceJobManager";
- public static final String SECURITY_PROTOCAL = "securityProtocol";
- public static final String GLOBUS_GATEKEEPER_EP = "globusEP";
- }
-
- // Unicore Post Job Command Table
- public final class UnicoreJobSubmissionConstants {
- public static final String SUBMISSION_ID = "submissionID";
- public static final String SECURITY_PROTOCAL = "securityProtocol";
- public static final String UNICORE_ENDPOINT_URL = "unicoreEndpointUrl";
-
- }
-
- public final class UnicoreDataMovementConstants {
- public static final String DATAMOVEMENT_ID = "dataMovementId";
- public static final String SECURITY_PROTOCAL = "securityProtocol";
- public static final String UNICORE_ENDPOINT_URL = "unicoreEndpointUrl";
- }
-
-
- public final class GlobusEPConstants{
- public static final String SUBMISSION_ID = "submissionID";
- public static final String ENDPOINT = "endpoint";
- }
-
- // GSSISSH Post Job Command Table
- public final class SSHSubmissionConstants {
- public static final String SUBMISSION_ID = "submissionID";
- public static final String RESOURCE_JOB_MANAGER = "resourceJobManager";
- public static final String SSH_PORT = "sshPort";
- }
-
- // Scp Data Movement Table
- public final class ScpDataMovementConstants {
- public static final String QUEUE_DESCRIPTION = "queueDescription";
- public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
- public static final String SECURITY_PROTOCOL = "securityProtocol";
- public static final String ALTERNATIVE_SCP_HOSTNAME = "alternativeScpHostname";
- public static final String SSH_PORT = "sshPort";
- }
-
- public final class GridFTPDataMovementConstants {
- public static final String DATA_MOVE_ID = "dataMoveID";
- public static final String SECURITY_PROTOCOL = "securityProtocol";
- public static final String GRID_FTP_EP = "gridFTPEP";
- }
-
- public final class GridFTPDMEPConstants{
- public static final String DATA_MOVE_ID = "dataMoveId";
- public static final String ENDPOINT = "endpoint";
- }
-
- public final class JobSubmissionProtocolConstants {
- public static final String RESOURCE_ID = "resourceID";
- public static final String SUBMISSION_ID = "submissionID";
- public static final String JOB_TYPE = "jobType";
- }
-
- public final class DataMoveProtocolConstants {
- public static final String RESOURCE_ID = "resourceID";
- public static final String DATA_MOVE_ID = "dataMoveID";
- public static final String DATA_MOVE_TYPE = "dataMoveType";
- }
-
- public final class ApplicationModuleConstants {
- public static final String MODULE_ID = "moduleID";
- public static final String GATEWAY_ID = "gatewayId";
- public static final String MODULE_NAME = "moduleName";
- public static final String MODULE_VERSION = "moduleVersion";
- public static final String MODULE_DESC = "moduleDesc";
- }
-
- public final class ApplicationDeploymentConstants {
- public static final String APP_MODULE_ID = "appModuleID";
- public static final String DEPLOYMENT_ID = "deploymentID";
- public static final String COMPUTE_HOST_ID = "hostID";
- public static final String GATEWAY_ID = "gatewayId";
- public static final String EXECUTABLE_PATH = "executablePath";
- public static final String APPLICATION_DESC = "applicationDesc";
- public static final String ENV_MODULE_LOAD_CMD = "envModuleLoaString";
- public static final String PARALLELISM = "parallelism";
- }
-
- public final class LibraryPrepandPathConstants {
- public static final String DEPLOYMENT_ID = "deploymentID";
- public static final String NAME = "name";
- public static final String VALUE = "value";
- }
-
- public final class LibraryApendPathConstants {
- public static final String DEPLOYMENT_ID = "deploymentID";
- public static final String NAME = "name";
- public static final String VALUE = "value";
- }
-
- public final class AppEnvironmentConstants {
- public static final String DEPLOYMENT_ID = "deploymentID";
- public static final String NAME = "name";
- public static final String VALUE = "value";
- }
-
- public final class ApplicationInterfaceConstants {
- public static final String INTERFACE_ID = "interfaceID";
- public static final String APPLICATION_NAME = "appName";
- public static final String GATEWAY_ID = "gatewayId";
- }
-
- public final class AppModuleMappingConstants {
- public static final String INTERFACE_ID = "interfaceID";
- public static final String MODULE_ID = "moduleID";
- }
-
- public final class AppInputConstants {
- public static final String INTERFACE_ID = "interfaceID";
- public static final String INPUT_KEY = "inputKey";
- public static final String INPUT_VALUE = "inputVal";
- public static final String DATA_TYPE = "dataType";
- public static final String METADATA = "metadata";
- public static final String APP_ARGUMENT = "appArgument";
- public static final String USER_FRIENDLY_DESC = "userFriendlyDesc";
- public static final String STANDARD_INPUT = "standardInput";
- }
-
- public final class AppOutputConstants {
- public static final String INTERFACE_ID = "interfaceID";
- public static final String OUTPUT_KEY = "outputKey";
- public static final String OUTPUT_VALUE = "outputVal";
- public static final String DATA_TYPE = "dataType";
- }
-
- public final class WFInputConstants {
- public static final String WF_TEMPLATE_ID = "wfTemplateId";
- public static final String INPUT_KEY = "inputKey";
- public static final String INPUT_VALUE = "inputVal";
- public static final String DATA_TYPE = "dataType";
- public static final String METADATA = "metadata";
- public static final String APP_ARGUMENT = "appArgument";
- public static final String USER_FRIENDLY_DESC = "userFriendlyDesc";
- public static final String STANDARD_INPUT = "standardInput";
- }
-
- public final class WFOutputConstants {
- public static final String WF_TEMPLATE_ID = "wfTemplateId";
- public static final String OUTPUT_KEY = "outputKey";
- public static final String OUTPUT_VALUE = "outputVal";
- public static final String DATA_TYPE = "dataType";
- }
-
- public final class GatewayProfileConstants {
- public static final String GATEWAY_ID = "gatewayID";
- public static final String GATEWAY_DESC = "gatewayDesc";
- }
-
- public final class ComputeResourcePreferenceConstants {
- public static final String GATEWAY_ID = "gatewayId";
- public static final String RESOURCE_ID = "resourceId";
- public static final String OVERRIDE_BY_AIRAVATA = "overrideByAiravata";
- public static final String PREFERED_JOB_SUB_PROTOCOL = "preferedJobSubmissionProtocol";
- public static final String PREFERED_DATA_MOVE_PROTOCOL = "preferedDataMoveProtocol";
- public static final String PREFERED_BATCH_QUEUE = "batchQueue";
- public static final String SCRATCH_LOCATION = "scratchLocation";
- public static final String ALLOCATION_PROJECT_NUMBER = "projectNumber";
- }
-
- // Batch Queue Table
- public final class BatchQueueConstants {
- public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
- public static final String MAX_RUNTIME = "maxRuntime";
- public static final String MAX_JOB_IN_QUEUE = "maxJobInQueue";
- public static final String QUEUE_DESCRIPTION = "queueDescription";
- public static final String QUEUE_NAME = "queueName";
- public static final String MAX_PROCESSORS = "maxProcessors";
- public static final String MAX_NODES = "maxNodes";
- }
-
- // Compute Resource File System Table
- public final class ComputeResourceFileSystemConstants {
- public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
- public static final String PATH = "path";
- public static final String FILE_SYSTEM = "fileSystem";
- }
-
- // Job Submission Interface Table
- public final class JobSubmissionInterfaceConstants {
- public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionInterfaceId";
- public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
- public static final String JOB_SUBMISSION_PROTOCOL = "jobSubmissionProtocol";
- public static final String PRIORITY_ORDER = "priorityOrder";
- }
-
- // Data Movement Interface Table
- public final class DataMovementInterfaceConstants {
- public static final String COMPUTE_RESOURCE_ID = "computeResourceId";
- public static final String DATA_MOVEMENT_PROTOCOL = "dataMovementProtocol";
- public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
- public static final String PRIORITY_ORDER = "priorityOrder";
- }
-
- // Resource Job Manager Table
- public final class ResourceJobManagerConstants {
- public static final String RESOURCE_JOB_MANAGER_ID = "resourceJobManagerId";
- public static final String PUSH_MONITORING_ENDPOINT = "pushMonitoringEndpoint";
- public static final String JOB_MANAGER_BIN_PATH = "jobManagerBinPath";
- public static final String RESOURCE_JOB_MANAGER_TYPE = "resourceJobManagerType";
- }
-
- // Job Manager Command Table
- public final class JobManagerCommandConstants {
- public static final String RESOURCE_JOB_MANAGER_ID = "resourceJobManagerId";
- public static final String COMMAND_TYPE = "commandType";
- public static final String COMMAND = "command";
- }
-
- // Gridftp Data Movement Table
- public final class GridftpDataMovementConstants {
- public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
- public static final String SECURITY_PROTOCOL = "securityProtocol";
- }
-
- // Gridftp Endpoint Table
- public final class GridftpEndpointConstants {
- public static final String ENDPOINT = "endpoint";
- public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
- }
-
- // Local Submission Table
- public final class LocalSubmissionConstants {
- public static final String RESOURCE_JOB_MANAGER_ID = "resourceJobManagerId";
- public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionInterfaceId";
- }
-
- // Local Data Movement Table
- public final class LocalDataMovementConstants {
- public static final String DATA_MOVEMENT_INTERFACE_ID = "dataMovementInterfaceId";
- }
-
- // Ssh Job Submission Table
- public final class SshJobSubmissionConstants {
- public static final String RESOURCE_JOB_MANAGER_ID = "resourceJobManagerId";
- public static final String JOB_SUBMISSION_INTERFACE_ID = "jobSubmissionInterfaceId";
- public static final String ALTERNATIVE_SSH_HOSTNAME = "alternativeSshHostname";
- public static final String SECURITY_PROTOCOL = "securityProtocol";
- public static final String SSH_PORT = "sshPort";
- }
-
- // Module Load Cmd Table
- public final class ModuleLoadCmdConstants {
- public static final String CMD = "cmd";
- public static final String APP_DEPLOYMENT_ID = "appDeploymentId";
- }
-
- // Workflow Table
- public final class WorkflowConstants {
- public static final String WF_NAME = "wfName";
- public static final String CREATED_USER = "createdUser";
- public static final String GRAPH = "graph";
- public static final String WF_TEMPLATE_ID = "wfTemplateId";
- public static final String GATEWAY_ID = "gatewayId";
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppDeploymentResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppDeploymentResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppDeploymentResource.java
deleted file mode 100644
index a635666..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppDeploymentResource.java
+++ /dev/null
@@ -1,446 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationModule;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-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 AppDeploymentResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(AppDeploymentResource.class);
- private String deploymentId;
- private String appModuleId;
- private String hostId;
- private String executablePath;
- private String parallelism;
- private String appDes;
- private String gatewayId;
- private ComputeResourceResource hostResource;
- private AppModuleResource moduleResource;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- public String getDeploymentId() {
- return deploymentId;
- }
-
- public void setDeploymentId(String deploymentId) {
- this.deploymentId = deploymentId;
- }
-
- public String getAppModuleId() {
- return appModuleId;
- }
-
- public void setAppModuleId(String appModuleId) {
- this.appModuleId = appModuleId;
- }
-
- public String getHostId() {
- return hostId;
- }
-
- public void setHostId(String hostId) {
- this.hostId = hostId;
- }
-
- public String getExecutablePath() {
- return executablePath;
- }
-
- public void setExecutablePath(String executablePath) {
- this.executablePath = executablePath;
- }
-
- public String getAppDes() {
- return appDes;
- }
-
- public void setAppDes(String appDes) {
- this.appDes = appDes;
- }
-
- public ComputeResourceResource getHostResource() {
- return hostResource;
- }
-
- public void setHostResource(ComputeResourceResource hostResource) {
- this.hostResource = hostResource;
- }
-
- public AppModuleResource getModuleResource() {
- return moduleResource;
- }
-
- public void setModuleResource(AppModuleResource moduleResource) {
- this.moduleResource = moduleResource;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
- generator.setParameter(ApplicationDeploymentConstants.DEPLOYMENT_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
- generator.setParameter(ApplicationDeploymentConstants.DEPLOYMENT_ID, identifier);
- Query q = generator.selectQuery(em);
- ApplicationDeployment deployment = (ApplicationDeployment) q.getSingleResult();
- AppDeploymentResource deploymentResource =
- (AppDeploymentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
- em.getTransaction().commit();
- em.close();
- return deploymentResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> appDeployments = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
- List results;
- if (fieldName.equals(ApplicationDeploymentConstants.APP_MODULE_ID)) {
- generator.setParameter(ApplicationDeploymentConstants.APP_MODULE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationDeployment deployment = (ApplicationDeployment) result;
- AppDeploymentResource deploymentResource =
- (AppDeploymentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
- appDeployments.add(deploymentResource);
- }
- }
- } else if (fieldName.equals(ApplicationDeploymentConstants.COMPUTE_HOST_ID)) {
- generator.setParameter(ApplicationDeploymentConstants.COMPUTE_HOST_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationDeployment deployment = (ApplicationDeployment) result;
- AppDeploymentResource deploymentResource =
- (AppDeploymentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
- appDeployments.add(deploymentResource);
- }
- }
- }else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for app deployment resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for app deployment resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return appDeployments;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- List<Resource> appDeployments = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
- generator.setParameter(ApplicationDeploymentConstants.GATEWAY_ID, gatewayId);
- Query q = generator.selectQuery(em);
- List results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationDeployment deployment = (ApplicationDeployment) result;
- AppDeploymentResource deploymentResource =
- (AppDeploymentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_DEPLOYMENT, deployment);
- appDeployments.add(deploymentResource);
- }
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return appDeployments;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- List<String> appDeployments = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
- Query q = generator.selectQuery(em);
- List results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationDeployment deployment = (ApplicationDeployment) result;
- appDeployments.add(deployment.getDeploymentID());
- }
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return appDeployments;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> appDeployments = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_DEPLOYMENT);
- List results;
- if (fieldName.equals(ApplicationDeploymentConstants.APP_MODULE_ID)) {
- generator.setParameter(ApplicationDeploymentConstants.APP_MODULE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationDeployment deployment = (ApplicationDeployment) result;
- appDeployments.add(deployment.getDeploymentID());
- }
- }
- } else if (fieldName.equals(ApplicationDeploymentConstants.COMPUTE_HOST_ID)) {
- generator.setParameter(ApplicationDeploymentConstants.COMPUTE_HOST_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationDeployment deployment = (ApplicationDeployment) result;
- appDeployments.add(deployment.getDeploymentID());
- }
- }
- }else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for app deployment resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for app deployment resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return appDeployments;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationDeployment existingDeployment = em.find(ApplicationDeployment.class, deploymentId);
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- ApplicationModule applicationModule = em.find(ApplicationModule.class, appModuleId);
- ComputeResource computeHost = em.find(ComputeResource.class, hostId);
- if (existingDeployment != null){
- existingDeployment.setDeploymentID(deploymentId);
- existingDeployment.setApplicationDesc(appDes);
- existingDeployment.setAppModuleID(appModuleId);
- existingDeployment.setApplicationModule(applicationModule);
- existingDeployment.setComputeResource(computeHost);
- existingDeployment.setHostID(hostId);
- existingDeployment.setExecutablePath(executablePath);
- existingDeployment.setParallelism(parallelism);
- existingDeployment.setGatewayId(gatewayId);
- existingDeployment.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- em.merge(existingDeployment);
- }else {
- ApplicationDeployment deployment = new ApplicationDeployment();
- deployment.setApplicationDesc(appDes);
- deployment.setDeploymentID(deploymentId);
- deployment.setAppModuleID(appModuleId);
- deployment.setHostID(hostId);
- deployment.setApplicationModule(applicationModule);
- deployment.setComputeResource(computeHost);
- deployment.setExecutablePath(executablePath);
- deployment.setParallelism(parallelism);
- deployment.setGatewayId(gatewayId);
- deployment.setCreationTime(AiravataUtils.getCurrentTimestamp());
- em.persist(deployment);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationDeployment deployment = em.find(ApplicationDeployment.class, identifier);
- em.close();
- return deployment != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getParallelism() {
- return parallelism;
- }
-
- public void setParallelism(String parallelism) {
- this.parallelism = parallelism;
- }
-}
[11/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/ExperimentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/ExperimentRegistry.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/ExperimentRegistry.java
deleted file mode 100644
index 9b3713a..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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.ExperimentCatalogModelType;
-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 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();
- }
-
-
<TRUNCATED>
[06/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/JobDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/JobDetailResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/JobDetailResource.java
deleted file mode 100644
index b8ee0fa..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/NodeInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/NodeInputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/NodeInputResource.java
deleted file mode 100644
index 92aba23..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/NodeInputResource.java
+++ /dev/null
@@ -1,227 +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.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();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/NodeOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/NodeOutputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/NodeOutputResource.java
deleted file mode 100644
index 5edc314..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/NodeOutputResource.java
+++ /dev/null
@@ -1,207 +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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/NotificationEmailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/NotificationEmailResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/NotificationEmailResource.java
deleted file mode 100644
index 1bcce9c..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ProjectResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ProjectResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ProjectResource.java
deleted file mode 100644
index 687a8cb..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ProjectUserResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ProjectUserResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ProjectUserResource.java
deleted file mode 100644
index f272433..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/QosParamResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/QosParamResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/QosParamResource.java
deleted file mode 100644
index 1d00a5c..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/QosParamResource.java
+++ /dev/null
@@ -1,144 +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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/StatusResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/StatusResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/StatusResource.java
deleted file mode 100644
index 257b657..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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();
- }
- }
- }
-}
[15/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalDataMovementResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalDataMovementResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalDataMovementResource.java
deleted file mode 100644
index a909122..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalDataMovementResource.java
+++ /dev/null
@@ -1,249 +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.aiaravata.application.catalog.data.resources;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.LocalDataMovement;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LocalDataMovementResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(LocalDataMovementResource.class);
- private String dataMovementInterfaceId;
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
- generator.setParameter(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
- generator.setParameter(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
- Query q = generator.selectQuery(em);
- LocalDataMovement localDataMovement = (LocalDataMovement) q.getSingleResult();
- LocalDataMovementResource localDataMovementResource = (LocalDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_DATA_MOVEMENT, localDataMovement);
- em.getTransaction().commit();
- em.close();
- return localDataMovementResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> localDataMovementResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
- Query q;
- if ((fieldName.equals(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- LocalDataMovement localDataMovement = (LocalDataMovement) result;
- LocalDataMovementResource localDataMovementResource = (LocalDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_DATA_MOVEMENT, localDataMovement);
- localDataMovementResources.add(localDataMovementResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Local Data Movement Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Local Data Movement Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return localDataMovementResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> localDataMovementResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_DATA_MOVEMENT);
- Query q;
- if ((fieldName.equals(LocalDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- LocalDataMovement localDataMovement = (LocalDataMovement) result;
- LocalDataMovementResource localDataMovementResource = (LocalDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_DATA_MOVEMENT, localDataMovement);
- localDataMovementResourceIDs.add(localDataMovementResource.getDataMovementInterfaceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Local Data Movement Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Local Data Movement Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return localDataMovementResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- LocalDataMovement existingLocalDataMovement = em.find(LocalDataMovement.class, dataMovementInterfaceId);
- em.close();
- LocalDataMovement localDataMovement;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingLocalDataMovement == null) {
- localDataMovement = new LocalDataMovement();
- } else {
- localDataMovement = existingLocalDataMovement;
- }
- localDataMovement.setDataMovementInterfaceId(getDataMovementInterfaceId());
- if (existingLocalDataMovement == null) {
- em.persist(localDataMovement);
- } else {
- em.merge(localDataMovement);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- LocalDataMovement localDataMovement = em.find(LocalDataMovement.class, identifier);
- em.close();
- return localDataMovement != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalSubmissionResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalSubmissionResource.java
deleted file mode 100644
index 487e5dc..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LocalSubmissionResource.java
+++ /dev/null
@@ -1,293 +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.aiaravata.application.catalog.data.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.LocalSubmission;
-import org.apache.aiaravata.application.catalog.data.model.ResourceJobManager;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LocalSubmissionResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(LocalSubmissionResource.class);
- private String resourceJobManagerId;
- private ResourceJobManagerResource resourceJobManagerResource;
- private String jobSubmissionInterfaceId;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
- generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
- generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
- Query q = generator.selectQuery(em);
- LocalSubmission localSubmission = (LocalSubmission) q.getSingleResult();
- LocalSubmissionResource localSubmissionResource = (LocalSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_SUBMISSION, localSubmission);
- em.getTransaction().commit();
- em.close();
- return localSubmissionResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> localSubmissionResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
- Query q;
- if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- LocalSubmission localSubmission = (LocalSubmission) result;
- LocalSubmissionResource localSubmissionResource = (LocalSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_SUBMISSION, localSubmission);
- localSubmissionResources.add(localSubmissionResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return localSubmissionResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> localSubmissionResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LOCAL_SUBMISSION);
- Query q;
- if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- LocalSubmission localSubmission = (LocalSubmission) result;
- LocalSubmissionResource localSubmissionResource = (LocalSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LOCAL_SUBMISSION, localSubmission);
- localSubmissionResourceIDs.add(localSubmissionResource.getJobSubmissionInterfaceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return localSubmissionResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- LocalSubmission existingLocalSubmission = em.find(LocalSubmission.class, jobSubmissionInterfaceId);
- em.close();
- LocalSubmission localSubmission;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingLocalSubmission == null) {
- localSubmission = new LocalSubmission();
- localSubmission.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- localSubmission = existingLocalSubmission;
- localSubmission.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- localSubmission.setResourceJobManagerId(getResourceJobManagerId());
- ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, getResourceJobManagerId());
- localSubmission.setResourceJobManager(resourceJobManager);
- localSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
- if (existingLocalSubmission == null) {
- em.persist(localSubmission);
- } else {
- em.merge(localSubmission);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- LocalSubmission localSubmission = em.find(LocalSubmission.class, identifier);
- em.close();
- return localSubmission != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getResourceJobManagerId() {
- return resourceJobManagerId;
- }
-
- public ResourceJobManagerResource getResourceJobManagerResource() {
- return resourceJobManagerResource;
- }
-
- public String getJobSubmissionInterfaceId() {
- return jobSubmissionInterfaceId;
- }
-
- public void setResourceJobManagerId(String resourceJobManagerId) {
- this.resourceJobManagerId=resourceJobManagerId;
- }
-
- public void setResourceJobManagerResource(ResourceJobManagerResource resourceJobManagerResource) {
- this.resourceJobManagerResource=resourceJobManagerResource;
- }
-
- public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
- this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ModuleLoadCmdResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ModuleLoadCmdResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ModuleLoadCmdResource.java
deleted file mode 100644
index 99faacf..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ModuleLoadCmdResource.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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.model.ModuleLoadCmd;
-import org.apache.aiaravata.application.catalog.data.model.ModuleLoadCmd_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ModuleLoadCmdResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ModuleLoadCmdResource.class);
- private String cmd;
- private String appDeploymentId;
- private AppDeploymentResource appDeploymentResource;
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(MODULE_LOAD_CMD);
- generator.setParameter(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID));
- if (ids.get(ModuleLoadCmdConstants.CMD) != null){
- generator.setParameter(ModuleLoadCmdConstants.CMD, ids.get(ModuleLoadCmdConstants.CMD));
- }
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(MODULE_LOAD_CMD);
- generator.setParameter(ModuleLoadCmdConstants.CMD, ids.get(ModuleLoadCmdConstants.CMD));
- generator.setParameter(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID));
- Query q = generator.selectQuery(em);
- ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) q.getSingleResult();
- ModuleLoadCmdResource moduleLoadCmdResource = (ModuleLoadCmdResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
- em.getTransaction().commit();
- em.close();
- return moduleLoadCmdResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> moduleLoadCmdResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(MODULE_LOAD_CMD);
- Query q;
- if ((fieldName.equals(ModuleLoadCmdConstants.CMD)) || (fieldName.equals(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) result;
- ModuleLoadCmdResource moduleLoadCmdResource = (ModuleLoadCmdResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
- moduleLoadCmdResources.add(moduleLoadCmdResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Module Load Cmd Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Module Load Cmd Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return moduleLoadCmdResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> moduleLoadCmdResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(MODULE_LOAD_CMD);
- Query q;
- if ((fieldName.equals(ModuleLoadCmdConstants.CMD)) || (fieldName.equals(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ModuleLoadCmd moduleLoadCmd = (ModuleLoadCmd) result;
- ModuleLoadCmdResource moduleLoadCmdResource = (ModuleLoadCmdResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.MODULE_LOAD_CMD, moduleLoadCmd);
- moduleLoadCmdResourceIDs.add(moduleLoadCmdResource.getAppDeploymentId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Module Load Cmd Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Module Load Cmd Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return moduleLoadCmdResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ModuleLoadCmd existingModuleLoadCmd = em.find(ModuleLoadCmd.class, new ModuleLoadCmd_PK(cmd, appDeploymentId));
- em.close();
- ModuleLoadCmd moduleLoadCmd;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingModuleLoadCmd == null) {
- moduleLoadCmd = new ModuleLoadCmd();
- } else {
- moduleLoadCmd = existingModuleLoadCmd;
- }
- moduleLoadCmd.setCmd(getCmd());
- moduleLoadCmd.setAppDeploymentId(getAppDeploymentId());
- ApplicationDeployment applicationDeployment = em.find(ApplicationDeployment.class, getAppDeploymentId());
- moduleLoadCmd.setApplicationDeployment(applicationDeployment);
- if (existingModuleLoadCmd == null) {
- em.persist(moduleLoadCmd);
- } else {
- em.merge(moduleLoadCmd);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ModuleLoadCmd moduleLoadCmd = em.find(ModuleLoadCmd.class, new ModuleLoadCmd_PK(ids.get(ModuleLoadCmdConstants.CMD), ids.get(ModuleLoadCmdConstants.APP_DEPLOYMENT_ID)));
- em.close();
- return moduleLoadCmd != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getCmd() {
- return cmd;
- }
-
- public String getAppDeploymentId() {
- return appDeploymentId;
- }
-
- public AppDeploymentResource getAppDeploymentResource() {
- return appDeploymentResource;
- }
-
- public void setCmd(String cmd) {
- this.cmd=cmd;
- }
-
- public void setAppDeploymentId(String appDeploymentId) {
- this.appDeploymentId=appDeploymentId;
- }
-
- public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
- this.appDeploymentResource=appDeploymentResource;
- }
-}
-
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PostJobCommandResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PostJobCommandResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PostJobCommandResource.java
deleted file mode 100644
index 7cde166..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PostJobCommandResource.java
+++ /dev/null
@@ -1,333 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.model.PostJobCommand;
-import org.apache.aiaravata.application.catalog.data.model.PostJobCommandPK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class PostJobCommandResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(PostJobCommandResource.class);
-
- private String appDeploymentId;
- private String command;
-
- private AppDeploymentResource appDeploymentResource;
-
-
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(POST_JOBCOMMAND);
- generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID,
- ids.get(PostJobCommandConstants.DEPLOYMENT_ID));
- if (ids.get(PostJobCommandConstants.COMMAND) != null){
- generator.setParameter(PostJobCommandConstants.COMMAND, ids.get(PostJobCommandConstants.COMMAND));
- }
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(POST_JOBCOMMAND);
- generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID,
- ids.get(PostJobCommandConstants.DEPLOYMENT_ID));
- generator.setParameter(PostJobCommandConstants.COMMAND, ids.get(PostJobCommandConstants.COMMAND));
- Query q = generator.selectQuery(em);
- PostJobCommand postJobCommand = (PostJobCommand) q.getSingleResult();
- PostJobCommandResource postJobCommandResource =
- (PostJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
- em.getTransaction().commit();
- em.close();
- return postJobCommandResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> gsiSSHPostJobCommandResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(POST_JOBCOMMAND);
- List results;
- if (fieldName.equals(PostJobCommandConstants.DEPLOYMENT_ID)) {
- generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- PostJobCommand postJobCommand = (PostJobCommand) result;
- PostJobCommandResource postJobCommandResource =
- (PostJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
- gsiSSHPostJobCommandResources.add(postJobCommandResource);
- }
- }
- } else if (fieldName.equals(PostJobCommandConstants.COMMAND)) {
- generator.setParameter(PostJobCommandConstants.COMMAND, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- PostJobCommand postJobCommand = (PostJobCommand) result;
- PostJobCommandResource postJobCommandResource =
- (PostJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.POST_JOBCOMMAND, postJobCommand);
- gsiSSHPostJobCommandResources.add(postJobCommandResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Post Job Command Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Post Job Command Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gsiSSHPostJobCommandResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> gsiSSHPostJobResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(POST_JOBCOMMAND);
- List results;
- if (fieldName.equals(PostJobCommandConstants.DEPLOYMENT_ID)) {
- generator.setParameter(PostJobCommandConstants.DEPLOYMENT_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- PostJobCommand postJobCommand = (PostJobCommand) result;
- gsiSSHPostJobResourceIDs.add(postJobCommand.getDeploymentId());
- }
- }
- } else if (fieldName.equals(PostJobCommandConstants.COMMAND)) {
- generator.setParameter(PostJobCommandConstants.COMMAND, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- PostJobCommand postJobCommand = (PostJobCommand) result;
- gsiSSHPostJobResourceIDs.add(postJobCommand.getDeploymentId());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Post Job resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Post JOb Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gsiSSHPostJobResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- PostJobCommand existingPostJobCommand = em.find(PostJobCommand.class,
- new PostJobCommandPK(appDeploymentId, command));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- ApplicationDeployment deployment = em.find(ApplicationDeployment.class, appDeploymentId);
- if (existingPostJobCommand != null){
- existingPostJobCommand.setDeploymentId(appDeploymentId);
- existingPostJobCommand.setCommand(command);
- existingPostJobCommand.setDeployment(deployment);
- em.merge(existingPostJobCommand);
- }else {
- PostJobCommand postJobCommand = new PostJobCommand();
- postJobCommand.setDeploymentId(appDeploymentId);
- postJobCommand.setCommand(command);
- postJobCommand.setDeployment(deployment);
- em.persist(postJobCommand);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- PostJobCommand postJobCommand = em.find(PostJobCommand.class, new PostJobCommandPK(
- ids.get(PostJobCommandConstants.DEPLOYMENT_ID),
- ids.get(PostJobCommandConstants.COMMAND)));
-
- em.close();
- return postJobCommand != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getAppDeploymentId() {
- return appDeploymentId;
- }
-
- public void setAppDeploymentId(String appDeploymentId) {
- this.appDeploymentId = appDeploymentId;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
-
- public AppDeploymentResource getAppDeploymentResource() {
- return appDeploymentResource;
- }
-
- public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
- this.appDeploymentResource = appDeploymentResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PreJobCommandResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PreJobCommandResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PreJobCommandResource.java
deleted file mode 100644
index 09a8fa1..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/PreJobCommandResource.java
+++ /dev/null
@@ -1,333 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.model.PreJobCommand;
-import org.apache.aiaravata.application.catalog.data.model.PreJobCommandPK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class PreJobCommandResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(PreJobCommandResource.class);
-
- private String appDeploymentId;
- private String command;
-
- private AppDeploymentResource appDeploymentResource;
-
-
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(PRE_JOBCOMMAND);
- generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID,
- ids.get(PreJobCommandConstants.DEPLOYMENT_ID));
- if (ids.get(PreJobCommandConstants.COMMAND) != null){
- generator.setParameter(PreJobCommandConstants.COMMAND, ids.get(PreJobCommandConstants.COMMAND));
- }
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(PRE_JOBCOMMAND);
- generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID,
- ids.get(PreJobCommandConstants.DEPLOYMENT_ID));
- generator.setParameter(PreJobCommandConstants.COMMAND, ids.get(PreJobCommandConstants.COMMAND));
- Query q = generator.selectQuery(em);
- PreJobCommand preJobCommand = (PreJobCommand) q.getSingleResult();
- PreJobCommandResource preJobCommandResource =
- (PreJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
- em.getTransaction().commit();
- em.close();
- return preJobCommandResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> gsiSSHPreJobResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(PRE_JOBCOMMAND);
- List results;
- if (fieldName.equals(PreJobCommandConstants.DEPLOYMENT_ID)) {
- generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- PreJobCommand preJobCommand = (PreJobCommand) result;
- PreJobCommandResource preJobCommandResource =
- (PreJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
- gsiSSHPreJobResources.add(preJobCommandResource);
- }
- }
- } else if (fieldName.equals(PreJobCommandConstants.COMMAND)) {
- generator.setParameter(PreJobCommandConstants.COMMAND, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- PreJobCommand preJobCommand = (PreJobCommand) result;
- PreJobCommandResource preJobCommandResource =
- (PreJobCommandResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.PRE_JOBCOMMAND, preJobCommand);
- gsiSSHPreJobResources.add(preJobCommandResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Pre Job Command Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Pre Job Command Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gsiSSHPreJobResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> gsiSSHPreJobResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(PRE_JOBCOMMAND);
- List results;
- if (fieldName.equals(PreJobCommandConstants.DEPLOYMENT_ID)) {
- generator.setParameter(PreJobCommandConstants.DEPLOYMENT_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- PreJobCommand preJobCommand = (PreJobCommand) result;
- gsiSSHPreJobResourceIDs.add(preJobCommand.getDeploymentId());
- }
- }
- } else if (fieldName.equals(PreJobCommandConstants.COMMAND)) {
- generator.setParameter(PreJobCommandConstants.COMMAND, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- PreJobCommand preJobCommand = (PreJobCommand) result;
- gsiSSHPreJobResourceIDs.add(preJobCommand.getDeploymentId());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Pre Job resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Pre JOb Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gsiSSHPreJobResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- PreJobCommand existingGSIsshPreJobCommand = em.find(PreJobCommand.class,
- new PreJobCommandPK(appDeploymentId, command));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- ApplicationDeployment deployment = em.find(ApplicationDeployment.class, appDeploymentId);
- if (existingGSIsshPreJobCommand != null){
- existingGSIsshPreJobCommand.setDeploymentId(appDeploymentId);
- existingGSIsshPreJobCommand.setCommand(command);
- existingGSIsshPreJobCommand.setApplicationDeployment(deployment);
- em.merge(existingGSIsshPreJobCommand);
- }else {
- PreJobCommand preJobCommand = new PreJobCommand();
- preJobCommand.setDeploymentId(appDeploymentId);
- preJobCommand.setCommand(command);
- preJobCommand.setApplicationDeployment(deployment);
- em.persist(preJobCommand);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- PreJobCommand preJobCommand = em.find(PreJobCommand.class, new PreJobCommandPK(
- ids.get(PreJobCommandConstants.DEPLOYMENT_ID),
- ids.get(PreJobCommandConstants.COMMAND)));
-
- em.close();
- return preJobCommand != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getAppDeploymentId() {
- return appDeploymentId;
- }
-
- public void setAppDeploymentId(String appDeploymentId) {
- this.appDeploymentId = appDeploymentId;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
-
- public AppDeploymentResource getAppDeploymentResource() {
- return appDeploymentResource;
- }
-
- public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
- this.appDeploymentResource = appDeploymentResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/Resource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/Resource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/Resource.java
deleted file mode 100644
index d4ad2fd..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/Resource.java
+++ /dev/null
@@ -1,89 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-
-import java.util.List;
-
-public interface Resource {
-
- /**
- * This method will remove the given resource from the database
- *
- * @param identifier identifier that can uniquely identify a single instance of the resource
- */
- void remove(Object identifier) throws AppCatalogException;
-
- /**
- * This method will return the given resource from the database
- *
- * @param identifier identifier that can uniquely identify a single instance of the resource
- * @return associate resource
- */
- Resource get(Object identifier) throws AppCatalogException;
-
- /**
- * This method will list all the resources according to the filtering criteria
- * @param fieldName field name
- * @param value value of the field
- * @return list of resources
- */
- List<Resource> get(String fieldName, Object value) throws AppCatalogException;
-
- /**
- *
- * @return
- * @throws AppCatalogException
- */
- List<Resource> getAll() throws AppCatalogException;
-
- /**
- *
- * @return
- * @throws AppCatalogException
- */
- List<String> getAllIds() throws AppCatalogException;
-
- /** This method will return list of resource ids according to given criteria
- * @param fieldName field name
- * @param value value of the field
- * @return list of resource Ids
- * @throws AppCatalogException
- */
- List<String> getIds(String fieldName, Object value) throws AppCatalogException;
-
- /**
- * This method will save the resource to the database.
- */
- void save() throws AppCatalogException;
-
- /**
- * This method will check whether an entry from the given resource and resource name
- * exists in the database
- *
- * @param identifier identifier that can uniquely identify a single instance of the resource
- * @return whether the entry exists in the database or not
- */
- boolean isExists(Object identifier) throws AppCatalogException;
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ResourceJobManagerResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ResourceJobManagerResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ResourceJobManagerResource.java
deleted file mode 100644
index 0cc5a18..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ResourceJobManagerResource.java
+++ /dev/null
@@ -1,301 +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.aiaravata.application.catalog.data.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ResourceJobManager;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ResourceJobManagerResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ResourceJobManagerResource.class);
- private String resourceJobManagerId;
- private String pushMonitoringEndpoint;
- private String jobManagerBinPath;
- private String resourceJobManagerType;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
- generator.setParameter(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
- generator.setParameter(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID, identifier);
- Query q = generator.selectQuery(em);
- ResourceJobManager resourceJobManager = (ResourceJobManager) q.getSingleResult();
- ResourceJobManagerResource resourceJobManagerResource = (ResourceJobManagerResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.RESOURCE_JOB_MANAGER, resourceJobManager);
- em.getTransaction().commit();
- em.close();
- return resourceJobManagerResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> resourceJobManagerResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
- Query q;
- if ((fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(ResourceJobManagerConstants.PUSH_MONITORING_ENDPOINT)) || (fieldName.equals(ResourceJobManagerConstants.JOB_MANAGER_BIN_PATH)) || (fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_TYPE))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ResourceJobManager resourceJobManager = (ResourceJobManager) result;
- ResourceJobManagerResource resourceJobManagerResource = (ResourceJobManagerResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.RESOURCE_JOB_MANAGER, resourceJobManager);
- resourceJobManagerResources.add(resourceJobManagerResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Resource Job Manager Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Resource Job Manager Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceJobManagerResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> resourceJobManagerResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(RESOURCE_JOB_MANAGER);
- Query q;
- if ((fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(ResourceJobManagerConstants.PUSH_MONITORING_ENDPOINT)) || (fieldName.equals(ResourceJobManagerConstants.JOB_MANAGER_BIN_PATH)) || (fieldName.equals(ResourceJobManagerConstants.RESOURCE_JOB_MANAGER_TYPE))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ResourceJobManager resourceJobManager = (ResourceJobManager) result;
- ResourceJobManagerResource resourceJobManagerResource = (ResourceJobManagerResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.RESOURCE_JOB_MANAGER, resourceJobManager);
- resourceJobManagerResourceIDs.add(resourceJobManagerResource.getResourceJobManagerId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Resource Job Manager Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Resource Job Manager Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceJobManagerResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ResourceJobManager existingResourceJobManager = em.find(ResourceJobManager.class, resourceJobManagerId);
- em.close();
- ResourceJobManager resourceJobManager;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingResourceJobManager == null) {
- resourceJobManager = new ResourceJobManager();
- resourceJobManager.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- resourceJobManager = existingResourceJobManager;
- resourceJobManager.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- resourceJobManager.setResourceJobManagerId(getResourceJobManagerId());
- resourceJobManager.setPushMonitoringEndpoint(getPushMonitoringEndpoint());
- resourceJobManager.setJobManagerBinPath(getJobManagerBinPath());
- resourceJobManager.setResourceJobManagerType(getResourceJobManagerType());
- if (existingResourceJobManager == null) {
- em.persist(resourceJobManager);
- } else {
- em.merge(resourceJobManager);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, identifier);
- em.close();
- return resourceJobManager != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getResourceJobManagerId() {
- return resourceJobManagerId;
- }
-
- public String getPushMonitoringEndpoint() {
- return pushMonitoringEndpoint;
- }
-
- public String getJobManagerBinPath() {
- return jobManagerBinPath;
- }
-
- public String getResourceJobManagerType() {
- return resourceJobManagerType;
- }
-
- public void setResourceJobManagerId(String resourceJobManagerId) {
- this.resourceJobManagerId=resourceJobManagerId;
- }
-
- public void setPushMonitoringEndpoint(String pushMonitoringEndpoint) {
- this.pushMonitoringEndpoint=pushMonitoringEndpoint;
- }
-
- public void setJobManagerBinPath(String jobManagerBinPath) {
- this.jobManagerBinPath=jobManagerBinPath;
- }
-
- public void setResourceJobManagerType(String resourceJobManagerType) {
- this.resourceJobManagerType=resourceJobManagerType;
- }
-}
[14/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ScpDataMovementResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ScpDataMovementResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ScpDataMovementResource.java
deleted file mode 100644
index 8c593f3..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ScpDataMovementResource.java
+++ /dev/null
@@ -1,308 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ScpDataMovement;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-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 ScpDataMovementResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ScpDataMovementResource.class);
- private String queueDescription;
- private String dataMovementInterfaceId;
- private String securityProtocol;
- private String alternativeScpHostname;
- private int sshPort;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
- generator.setParameter(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
- generator.setParameter(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
- Query q = generator.selectQuery(em);
- ScpDataMovement scpDataMovement = (ScpDataMovement) q.getSingleResult();
- ScpDataMovementResource scpDataMovementResource = (ScpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATA_MOVEMENT, scpDataMovement);
- em.getTransaction().commit();
- em.close();
- return scpDataMovementResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> scpDataMovementResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
- Query q;
- if ((fieldName.equals(ScpDataMovementConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(ScpDataMovementConstants.SECURITY_PROTOCOL)) || (fieldName.equals(ScpDataMovementConstants.ALTERNATIVE_SCP_HOSTNAME)) || (fieldName.equals(ScpDataMovementConstants.SSH_PORT))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ScpDataMovement scpDataMovement = (ScpDataMovement) result;
- ScpDataMovementResource scpDataMovementResource = (ScpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATA_MOVEMENT, scpDataMovement);
- scpDataMovementResources.add(scpDataMovementResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Scp Data Movement Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Scp Data Movement Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return scpDataMovementResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> scpDataMovementResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SCP_DATA_MOVEMENT);
- Query q;
- if ((fieldName.equals(ScpDataMovementConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(ScpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(ScpDataMovementConstants.SECURITY_PROTOCOL)) || (fieldName.equals(ScpDataMovementConstants.ALTERNATIVE_SCP_HOSTNAME)) || (fieldName.equals(ScpDataMovementConstants.SSH_PORT))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ScpDataMovement scpDataMovement = (ScpDataMovement) result;
- ScpDataMovementResource scpDataMovementResource = (ScpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SCP_DATA_MOVEMENT, scpDataMovement);
- scpDataMovementResourceIDs.add(scpDataMovementResource.getDataMovementInterfaceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Scp Data Movement Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Scp Data Movement Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return scpDataMovementResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ScpDataMovement existingScpDataMovement = em.find(ScpDataMovement.class, dataMovementInterfaceId);
- em.close();
- ScpDataMovement scpDataMovement;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingScpDataMovement == null) {
- scpDataMovement = new ScpDataMovement();
- scpDataMovement.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- scpDataMovement = existingScpDataMovement;
- scpDataMovement.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- scpDataMovement.setQueueDescription(getQueueDescription());
- scpDataMovement.setDataMovementInterfaceId(getDataMovementInterfaceId());
- scpDataMovement.setSecurityProtocol(getSecurityProtocol());
- scpDataMovement.setAlternativeScpHostname(getAlternativeScpHostname());
- scpDataMovement.setSshPort(getSshPort());
- if (existingScpDataMovement == null) {
- em.persist(scpDataMovement);
- } else {
- em.merge(scpDataMovement);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ScpDataMovement scpDataMovement = em.find(ScpDataMovement.class, identifier);
- em.close();
- return scpDataMovement != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getQueueDescription() {
- return queueDescription;
- }
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public String getAlternativeScpHostname() {
- return alternativeScpHostname;
- }
-
- public int getSshPort() {
- return sshPort;
- }
-
- public void setQueueDescription(String queueDescription) {
- this.queueDescription=queueDescription;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol=securityProtocol;
- }
-
- public void setAlternativeScpHostname(String alternativeScpHostname) {
- this.alternativeScpHostname=alternativeScpHostname;
- }
-
- public void setSshPort(int sshPort) {
- this.sshPort=sshPort;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/SshJobSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/SshJobSubmissionResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/SshJobSubmissionResource.java
deleted file mode 100644
index ee14d76..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/SshJobSubmissionResource.java
+++ /dev/null
@@ -1,332 +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.aiaravata.application.catalog.data.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ResourceJobManager;
-import org.apache.aiaravata.application.catalog.data.model.SshJobSubmission;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SshJobSubmissionResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(SshJobSubmissionResource.class);
- private String resourceJobManagerId;
- private ResourceJobManagerResource resourceJobManagerResource;
- private String jobSubmissionInterfaceId;
- private String alternativeSshHostname;
- private String securityProtocol;
- private int sshPort;
- private String monitorMode;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
- generator.setParameter(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
- generator.setParameter(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
- Query q = generator.selectQuery(em);
- SshJobSubmission sshJobSubmission = (SshJobSubmission) q.getSingleResult();
- SshJobSubmissionResource sshJobSubmissionResource = (SshJobSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_JOB_SUBMISSION, sshJobSubmission);
- em.getTransaction().commit();
- em.close();
- return sshJobSubmissionResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> sshJobSubmissionResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
- Query q;
- if ((fieldName.equals(SshJobSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(SshJobSubmissionConstants.ALTERNATIVE_SSH_HOSTNAME)) || (fieldName.equals(SshJobSubmissionConstants.SECURITY_PROTOCOL)) || (fieldName.equals(SshJobSubmissionConstants.SSH_PORT))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- SshJobSubmission sshJobSubmission = (SshJobSubmission) result;
- SshJobSubmissionResource sshJobSubmissionResource = (SshJobSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_JOB_SUBMISSION, sshJobSubmission);
- sshJobSubmissionResources.add(sshJobSubmissionResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Ssh Job Submission Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Ssh Job Submission Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return sshJobSubmissionResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> sshJobSubmissionResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(SSH_JOB_SUBMISSION);
- Query q;
- if ((fieldName.equals(SshJobSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(SshJobSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(SshJobSubmissionConstants.ALTERNATIVE_SSH_HOSTNAME)) || (fieldName.equals(SshJobSubmissionConstants.SECURITY_PROTOCOL)) || (fieldName.equals(SshJobSubmissionConstants.SSH_PORT))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- SshJobSubmission sshJobSubmission = (SshJobSubmission) result;
- SshJobSubmissionResource sshJobSubmissionResource = (SshJobSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.SSH_JOB_SUBMISSION, sshJobSubmission);
- sshJobSubmissionResourceIDs.add(sshJobSubmissionResource.getJobSubmissionInterfaceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Ssh Job Submission Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Ssh Job Submission Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return sshJobSubmissionResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- SshJobSubmission existingSshJobSubmission = em.find(SshJobSubmission.class, jobSubmissionInterfaceId);
- em.close();
- SshJobSubmission sshJobSubmission;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingSshJobSubmission == null) {
- sshJobSubmission = new SshJobSubmission();
- sshJobSubmission.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- sshJobSubmission = existingSshJobSubmission;
- sshJobSubmission.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- sshJobSubmission.setResourceJobManagerId(getResourceJobManagerId());
- ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, getResourceJobManagerId());
- sshJobSubmission.setResourceJobManager(resourceJobManager);
- sshJobSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
- sshJobSubmission.setAlternativeSshHostname(getAlternativeSshHostname());
- sshJobSubmission.setSecurityProtocol(getSecurityProtocol());
- sshJobSubmission.setSshPort(getSshPort());
- sshJobSubmission.setMonitorMode(getMonitorMode());
- if (existingSshJobSubmission == null) {
- em.persist(sshJobSubmission);
- } else {
- em.merge(sshJobSubmission);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- SshJobSubmission sshJobSubmission = em.find(SshJobSubmission.class, identifier);
- em.close();
- return sshJobSubmission != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getResourceJobManagerId() {
- return resourceJobManagerId;
- }
-
- public ResourceJobManagerResource getResourceJobManagerResource() {
- return resourceJobManagerResource;
- }
-
- public String getJobSubmissionInterfaceId() {
- return jobSubmissionInterfaceId;
- }
-
- public String getAlternativeSshHostname() {
- return alternativeSshHostname;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public int getSshPort() {
- return sshPort;
- }
-
- public void setResourceJobManagerId(String resourceJobManagerId) {
- this.resourceJobManagerId=resourceJobManagerId;
- }
-
- public void setResourceJobManagerResource(ResourceJobManagerResource resourceJobManagerResource) {
- this.resourceJobManagerResource=resourceJobManagerResource;
- }
-
- public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
- this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
- }
-
- public void setAlternativeSshHostname(String alternativeSshHostname) {
- this.alternativeSshHostname=alternativeSshHostname;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol=securityProtocol;
- }
-
- public void setSshPort(int sshPort) {
- this.sshPort=sshPort;
- }
-
- public String getMonitorMode() {
- return monitorMode;
- }
-
- public void setMonitorMode(String monitorMode) {
- this.monitorMode = monitorMode;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreDataMovementResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreDataMovementResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreDataMovementResource.java
deleted file mode 100644
index 63f2b70..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreDataMovementResource.java
+++ /dev/null
@@ -1,255 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.UnicoreDataMovement;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.List;
-
-public class UnicoreDataMovementResource extends AbstractResource {
-
- private final static Logger logger = LoggerFactory.getLogger(UnicoreDataMovementResource.class);
-
- private String dataMovementId;
- private String securityProtocol;
- private String unicoreEndpointUrl;
-
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_DATA_MOVEMENT);
- generator.setParameter(UnicoreDataMovementConstants.DATAMOVEMENT_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_DATA_MOVEMENT);
- generator.setParameter(UnicoreDataMovementConstants.DATAMOVEMENT_ID, identifier);
- Query q = generator.selectQuery(em);
- UnicoreDataMovement unicoreDataMovement = (UnicoreDataMovement) q.getSingleResult();
- UnicoreDataMovementResource dataMovementResource =
- (UnicoreDataMovementResource) AppCatalogJPAUtils
- .getResource(AppCatalogResourceType.UNICORE_DATA_MOVEMENT,
- unicoreDataMovement);
- em.getTransaction().commit();
- em.close();
- return dataMovementResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> unicoreDMResourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_DATA_MOVEMENT);
- List results;
- if (fieldName.equals(UnicoreDataMovementConstants.UNICORE_ENDPOINT_URL)) {
- generator.setParameter(UnicoreDataMovementConstants.UNICORE_ENDPOINT_URL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- UnicoreDataMovement dataMovement = (UnicoreDataMovement) result;
- UnicoreDataMovementResource unicoreJobSubmissionResource =
- (UnicoreDataMovementResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.UNICORE_DATA_MOVEMENT, dataMovement);
- unicoreDMResourceList.add(unicoreJobSubmissionResource);
- }
- }
- } else if (fieldName.equals(UnicoreDataMovementConstants.SECURITY_PROTOCAL)) {
- generator.setParameter(UnicoreDataMovementConstants.SECURITY_PROTOCAL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- UnicoreDataMovement dataMovement = (UnicoreDataMovement) result;
- UnicoreDataMovementResource dataMovementResource =
- (UnicoreDataMovementResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.UNICORE_DATA_MOVEMENT, dataMovement);
- unicoreDMResourceList.add(dataMovementResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Unicore data movement resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Unicore data movement resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return unicoreDMResourceList;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- return null;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- UnicoreDataMovement existingDataMovement = em.find(UnicoreDataMovement.class, dataMovementId);
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingDataMovement != null) {
- existingDataMovement.setDataMovementId(dataMovementId);;
- existingDataMovement.setUnicoreEndpointUrl(unicoreEndpointUrl);
- existingDataMovement.setSecurityProtocol(securityProtocol);
- em.merge(existingDataMovement);
- } else {
- UnicoreDataMovement unicoreJobSubmission = new UnicoreDataMovement();
- unicoreJobSubmission.setDataMovementId(dataMovementId);
- unicoreJobSubmission.setUnicoreEndpointUrl(unicoreEndpointUrl);
- unicoreJobSubmission.setSecurityProtocol(securityProtocol);
- em.persist(unicoreJobSubmission);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- UnicoreDataMovement dataMovement = em.find(UnicoreDataMovement.class, identifier);
- em.close();
- return dataMovement != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public String getDataMovementId() {
- return dataMovementId;
- }
-
- public void setDataMovementId(String dataMovementId) {
- this.dataMovementId = dataMovementId;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol = securityProtocol;
- }
-
- public String getUnicoreEndpointUrl() {
- return unicoreEndpointUrl;
- }
-
- public void setUnicoreEndpointUrl(String unicoreEndpointUrl) {
- this.unicoreEndpointUrl = unicoreEndpointUrl;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreJobSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreJobSubmissionResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreJobSubmissionResource.java
deleted file mode 100644
index 4c772e1..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UnicoreJobSubmissionResource.java
+++ /dev/null
@@ -1,328 +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.aiaravata.application.catalog.data.resources;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.GlobusJobSubmission;
-import org.apache.aiaravata.application.catalog.data.model.UnicoreJobSubmission;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UnicoreJobSubmissionResource extends AbstractResource {
-
- private final static Logger logger = LoggerFactory.getLogger(UnicoreJobSubmissionResource.class);
-
- private String jobSubmissionInterfaceId;
- private String securityProtocol;
- private String unicoreEndpointUrl;
-
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_JOB_SUBMISSION);
- generator.setParameter(UnicoreJobSubmissionConstants.SUBMISSION_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_JOB_SUBMISSION);
- generator.setParameter(UnicoreJobSubmissionConstants.SUBMISSION_ID, identifier);
- Query q = generator.selectQuery(em);
- UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission) q.getSingleResult();
- UnicoreJobSubmissionResource unicoreSubmissionResource =
- (UnicoreJobSubmissionResource) AppCatalogJPAUtils
- .getResource(AppCatalogResourceType.UNICORE_JOB_SUBMISSION,
- unicoreJobSubmission);
- em.getTransaction().commit();
- em.close();
- return unicoreSubmissionResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> unicoreSubmissionResourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_JOB_SUBMISSION);
- List results;
- if (fieldName.equals(UnicoreJobSubmissionConstants.UNICORE_ENDPOINT_URL)) {
- generator.setParameter(UnicoreJobSubmissionConstants.UNICORE_ENDPOINT_URL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission) result;
- UnicoreJobSubmissionResource unicoreJobSubmissionResource =
- (UnicoreJobSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.UNICORE_JOB_SUBMISSION, unicoreJobSubmission);
- unicoreSubmissionResourceList.add(unicoreJobSubmissionResource);
- }
- }
- } else if (fieldName.equals(UnicoreJobSubmissionConstants.SECURITY_PROTOCAL)) {
- generator.setParameter(UnicoreJobSubmissionConstants.SECURITY_PROTOCAL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission) result;
- UnicoreJobSubmissionResource unicoreJobSubmissionResource =
- (UnicoreJobSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.UNICORE_JOB_SUBMISSION, unicoreJobSubmission);
- unicoreSubmissionResourceList.add(unicoreJobSubmissionResource);
- }
- }
- }
- else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Unicore submission resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Unicore Submission resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return unicoreSubmissionResourceList;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> globusSubmissionResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
- List results;
- if (fieldName.equals(GlobusJobSubmissionConstants.SUBMISSION_ID)) {
- generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP)) {
- generator.setParameter(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
- }
- }
- }
- else if (fieldName.equals(GlobusJobSubmissionConstants.SECURITY_PROTOCAL)) {
- generator.setParameter(GlobusJobSubmissionConstants.SECURITY_PROTOCAL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER)) {
- generator.setParameter(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Globus Submission resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Globus Submission resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return globusSubmissionResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- UnicoreJobSubmission existingUnicoreSubmission = em.find(UnicoreJobSubmission.class, jobSubmissionInterfaceId);
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingUnicoreSubmission != null) {
- existingUnicoreSubmission.setSubmissionID(jobSubmissionInterfaceId);;
- existingUnicoreSubmission.setUnicoreEndpointUrl(unicoreEndpointUrl);
- existingUnicoreSubmission.setSecurityProtocol(securityProtocol);
-
- em.merge(existingUnicoreSubmission);
- } else {
- UnicoreJobSubmission unicoreJobSubmission = new UnicoreJobSubmission();
- unicoreJobSubmission.setSubmissionID(jobSubmissionInterfaceId);
- unicoreJobSubmission.setUnicoreEndpointUrl(unicoreEndpointUrl);
- unicoreJobSubmission.setSecurityProtocol(securityProtocol);
- em.persist(unicoreJobSubmission);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- UnicoreJobSubmission unicoreJobSubmission = em.find(UnicoreJobSubmission.class, identifier);
- em.close();
- return unicoreJobSubmission != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
-
- public String getjobSubmissionInterfaceId() {
- return jobSubmissionInterfaceId;
- }
-
- public void setjobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
- this.jobSubmissionInterfaceId = jobSubmissionInterfaceId;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol = securityProtocol;
- }
-
- public String getUnicoreEndpointUrl() {
- return unicoreEndpointUrl;
- }
-
- public void setUnicoreEndpointUrl(String unicoreEndpointUrl) {
- this.unicoreEndpointUrl = unicoreEndpointUrl;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputResource.java
deleted file mode 100644
index ac22744..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowInputResource.java
+++ /dev/null
@@ -1,451 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.Workflow;
-import org.apache.aiaravata.application.catalog.data.model.WorkflowInput;
-import org.apache.aiaravata.application.catalog.data.model.WorkflowInput_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class WorkflowInputResource extends AbstractResource {
-
- private final static Logger logger = LoggerFactory.getLogger(WorkflowInputResource.class);
-
- private String wfTemplateId;
- private String inputKey;
- private String dataType;
- private String inputVal;
- private String metadata;
- private String appArgument;
- private String userFriendlyDesc;
- private boolean standardInput;
- private int inputOrder;
- private boolean isRequired;
- private boolean requiredToCMD;
- private boolean dataStaged;
-
- private WorkflowResource workflowResource;
-
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
- generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, ids.get(WFInputConstants.WF_TEMPLATE_ID));
- generator.setParameter(WFInputConstants.INPUT_KEY, ids.get(WFInputConstants.INPUT_KEY));
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
- generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, ids.get(WFInputConstants.WF_TEMPLATE_ID));
- generator.setParameter(WFInputConstants.INPUT_KEY, ids.get(WFInputConstants.INPUT_KEY));
- Query q = generator.selectQuery(em);
- WorkflowInput workflowInput = (WorkflowInput) q.getSingleResult();
- WorkflowInputResource workflowInputResource =
- (WorkflowInputResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW_INPUT
- , workflowInput);
- em.getTransaction().commit();
- em.close();
- return workflowInputResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> wfInputResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
- List results;
- if (fieldName.equals(WFInputConstants.WF_TEMPLATE_ID)) {
- generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowInput workflowInput = (WorkflowInput) result;
- WorkflowInputResource workflowInputResource =
- (WorkflowInputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
- wfInputResources.add(workflowInputResource);
- }
- }
- } else if (fieldName.equals(WFInputConstants.INPUT_KEY)) {
- generator.setParameter(WFInputConstants.INPUT_KEY, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowInput workflowInput = (WorkflowInput) result;
- WorkflowInputResource workflowInputResource =
- (WorkflowInputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
- wfInputResources.add(workflowInputResource);
- }
- }
- } else if (fieldName.equals(WFInputConstants.DATA_TYPE)) {
- generator.setParameter(WFInputConstants.DATA_TYPE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowInput workflowInput = (WorkflowInput) result;
- WorkflowInputResource workflowInputResource =
- (WorkflowInputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.WORKFLOW_INPUT, workflowInput);
- wfInputResources.add(workflowInputResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for WFInput Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for WFInput Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return wfInputResources;
- }
-
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> wfInputResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_INPUT);
- List results;
- if (fieldName.equals(WFInputConstants.WF_TEMPLATE_ID)) {
- generator.setParameter(WFInputConstants.WF_TEMPLATE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowInput workflowInput = (WorkflowInput) result;
- wfInputResourceIDs.add(workflowInput.getWfTemplateId());
- }
- }
- } else if (fieldName.equals(WFInputConstants.INPUT_KEY)) {
- generator.setParameter(WFInputConstants.INPUT_KEY, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowInput workflowInput = (WorkflowInput) result;
- wfInputResourceIDs.add(workflowInput.getWfTemplateId());
- }
- }
- } else if (fieldName.equals(WFInputConstants.DATA_TYPE)) {
- generator.setParameter(WFInputConstants.DATA_TYPE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowInput workflowInput = (WorkflowInput) result;
- wfInputResourceIDs.add(workflowInput.getWfTemplateId());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for WFInput resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for WFInput Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return wfInputResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- WorkflowInput existingWFInput = em.find(WorkflowInput.class, new WorkflowInput_PK(wfTemplateId, inputKey));
- em.close();
- WorkflowInput workflowInput;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingWFInput == null) {
- workflowInput = new WorkflowInput();
- } else {
- workflowInput=existingWFInput;
- }
- workflowInput.setWfTemplateId(wfTemplateId);
- Workflow workflow = em.find(Workflow.class, wfTemplateId);
- workflowInput.setWorkflow(workflow);
- workflowInput.setDataType(dataType);
- workflowInput.setInputKey(inputKey);
- if (inputVal != null){
- workflowInput.setInputVal(inputVal.toCharArray());
- }
- workflowInput.setMetadata(metadata);
- workflowInput.setAppArgument(appArgument);
- workflowInput.setUserFriendlyDesc(userFriendlyDesc);
- workflowInput.setStandardInput(standardInput);
- workflowInput.setRequiredToCMD(requiredToCMD);
- workflowInput.setRequired(isRequired);
- workflowInput.setDataStaged(dataStaged);
- if (existingWFInput == null) {
- em.persist(workflowInput);
- } else {
- em.merge(workflowInput);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- WorkflowInput workflowInput = em.find(WorkflowInput.class, new WorkflowInput_PK(
- ids.get(WFInputConstants.WF_TEMPLATE_ID),
- ids.get(WFInputConstants.INPUT_KEY)));
-
- em.close();
- return workflowInput != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getWfTemplateId() {
- return wfTemplateId;
- }
-
- public void setWfTemplateId(String wfTemplateId) {
- this.wfTemplateId = wfTemplateId;
- }
-
- 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 getInputVal() {
- return inputVal;
- }
-
- public void setInputVal(String inputVal) {
- this.inputVal = inputVal;
- }
-
- 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 String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public WorkflowResource getWorkflowResource() {
- return workflowResource;
- }
-
- public void setWorkflowResource(WorkflowResource workflowResource) {
- this.workflowResource = workflowResource;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- 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;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowOutputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowOutputResource.java
deleted file mode 100644
index 7f180bd..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowOutputResource.java
+++ /dev/null
@@ -1,410 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.Workflow;
-import org.apache.aiaravata.application.catalog.data.model.WorkflowOutput;
-import org.apache.aiaravata.application.catalog.data.model.WorkflowOutput_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class WorkflowOutputResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(WorkflowOutputResource.class);
-
- private String wfTemplateId;
- private String outputKey;
- private String outputVal;
- private String dataType;
- private String validityType;
- private boolean dataMovement;
- private String dataNameLocation;
-
- private WorkflowResource workflowResource;
-
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_OUTPUT);
- generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, ids.get(WFOutputConstants.WF_TEMPLATE_ID));
- generator.setParameter(WFOutputConstants.OUTPUT_KEY, ids.get(WFOutputConstants.OUTPUT_KEY));
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_OUTPUT);
- generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, ids.get(WFOutputConstants.WF_TEMPLATE_ID));
- generator.setParameter(WFOutputConstants.OUTPUT_KEY, ids.get(WFOutputConstants.OUTPUT_KEY));
- Query q = generator.selectQuery(em);
- WorkflowOutput wfOutput = (WorkflowOutput) q.getSingleResult();
- WorkflowOutputResource workflowOutputResource =
- (WorkflowOutputResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW_OUTPUT
- , wfOutput);
- em.getTransaction().commit();
- em.close();
- return workflowOutputResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> wfOutputResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_OUTPUT);
- List results;
- if (fieldName.equals(WFOutputConstants.WF_TEMPLATE_ID)) {
- generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowOutput wfOutput = (WorkflowOutput) result;
- WorkflowOutputResource workflowOutputResource =
- (WorkflowOutputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.WORKFLOW_OUTPUT, wfOutput);
- wfOutputResources.add(workflowOutputResource);
- }
- }
- } else if (fieldName.equals(WFOutputConstants.OUTPUT_KEY)) {
- generator.setParameter(WFOutputConstants.OUTPUT_KEY, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowOutput workflowOutput = (WorkflowOutput) result;
- WorkflowOutputResource workflowOutputResource =
- (WorkflowOutputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.WORKFLOW_OUTPUT, workflowOutput);
- wfOutputResources.add(workflowOutputResource);
- }
- }
- } else if (fieldName.equals(WFOutputConstants.DATA_TYPE)) {
- generator.setParameter(WFOutputConstants.DATA_TYPE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowOutput workflowOutput = (WorkflowOutput) result;
- WorkflowOutputResource workflowOutputResource =
- (WorkflowOutputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.WORKFLOW_OUTPUT, workflowOutput);
- wfOutputResources.add(workflowOutputResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for WF Output Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for WF Output Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return wfOutputResources;
- }
-
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> wfOutputResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW_OUTPUT);
- List results;
- if (fieldName.equals(WFOutputConstants.WF_TEMPLATE_ID)) {
- generator.setParameter(WFOutputConstants.WF_TEMPLATE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowOutput workflowOutput = (WorkflowOutput) result;
- wfOutputResourceIDs.add(workflowOutput.getWfTemplateId());
- }
- }
- }
- if (fieldName.equals(WFOutputConstants.OUTPUT_KEY)) {
- generator.setParameter(WFOutputConstants.OUTPUT_KEY, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowOutput workflowOutput = (WorkflowOutput) result;
- wfOutputResourceIDs.add(workflowOutput.getWfTemplateId());
- }
- }
- } else if (fieldName.equals(WFOutputConstants.DATA_TYPE)) {
- generator.setParameter(WFOutputConstants.DATA_TYPE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- WorkflowOutput workflowOutput = (WorkflowOutput) result;
- wfOutputResourceIDs.add(workflowOutput.getWfTemplateId());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for WF Output resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for WF Output Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return wfOutputResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- WorkflowOutput existingWorkflowOutput = em.find(WorkflowOutput.class,
- new WorkflowOutput_PK(wfTemplateId, outputKey));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingWorkflowOutput != null) {
- existingWorkflowOutput.setWfTemplateId(wfTemplateId);
- Workflow workflow = em.find(Workflow.class, wfTemplateId);
- existingWorkflowOutput.setWorkflow(workflow);
- existingWorkflowOutput.setDataType(dataType);
- existingWorkflowOutput.setOutputKey(outputKey);
- if (outputVal != null){
- existingWorkflowOutput.setOutputVal(outputVal.toCharArray());
- }
- existingWorkflowOutput.setValidityType(validityType);
- existingWorkflowOutput.setDataMovement(dataMovement);
- existingWorkflowOutput.setDataNameLocation(dataNameLocation);
- em.merge(existingWorkflowOutput);
- } else {
- WorkflowOutput workflowOutput = new WorkflowOutput();
- workflowOutput.setWfTemplateId(wfTemplateId);
- Workflow workflow = em.find(Workflow.class, wfTemplateId);
- workflowOutput.setWorkflow(workflow);
- workflowOutput.setDataType(dataType);
- workflowOutput.setOutputKey(outputKey);
- if (outputVal != null){
- workflowOutput.setOutputVal(outputVal.toCharArray());
- }
- workflowOutput.setValidityType(validityType);
- workflowOutput.setDataMovement(dataMovement);
- workflowOutput.setDataNameLocation(dataNameLocation);
- em.persist(workflowOutput);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- WorkflowOutput workflowOutput = em.find(WorkflowOutput.class, new WorkflowOutput_PK(
- ids.get(WFOutputConstants.WF_TEMPLATE_ID),
- ids.get(WFOutputConstants.OUTPUT_KEY)));
-
- em.close();
- return workflowOutput != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getWfTemplateId() {
- return wfTemplateId;
- }
-
- public void setWfTemplateId(String wfTemplateId) {
- this.wfTemplateId = wfTemplateId;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-
- public String getOutputVal() {
- return outputVal;
- }
-
- public void setOutputVal(String outputVal) {
- this.outputVal = outputVal;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public WorkflowResource getWorkflowResource() {
- return workflowResource;
- }
-
- public void setWorkflowResource(WorkflowResource workflowResource) {
- this.workflowResource = workflowResource;
- }
-
- public String getValidityType() {
- return validityType;
- }
-
- public void setValidityType(String validityType) {
- this.validityType = validityType;
- }
-
- 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;
- }
-}
[12/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/ExperimentCatalogImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/ExperimentCatalogImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/ExperimentCatalogImpl.java
deleted file mode 100644
index 78189f5..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/ExperimentCatalogImpl.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.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 ExperimentCatalogImpl implements ExperimentCatalog {
- private GatewayResource gatewayResource;
- private UserResource user;
- private final static Logger logger = LoggerFactory.getLogger(ExperimentCatalogImpl.class);
- private ExperimentRegistry experimentRegistry = null;
- private ProjectRegistry projectRegistry = null;
- private GatewayRegistry gatewayRegistry = null;
-
- public ExperimentCatalogImpl() 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 ExperimentCatalogImpl(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(ExpCatParentDataType 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(ExpCatChildDataType 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(ExperimentCatalogModelType 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(ExperimentCatalogModelType 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(ExperimentCatalogModelType 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(ExperimentCatalogModelType 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(ExperimentCatalogModelType 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(ExperimentCatalogModelType 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(ExperimentCatalogModelType 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(ExperimentCatalogModelType 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(ExperimentCatalogModelType 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(ExperimentCatalogModelType 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(ExperimentCatalogModelType 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);
- }
- }
-
-}
[13/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowResource.java
deleted file mode 100644
index 3e52019..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/WorkflowResource.java
+++ /dev/null
@@ -1,382 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.Workflow;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-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 WorkflowResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(WorkflowResource.class);
- private String wfName;
- private String createdUser;
- private String graph;
- private String wfTemplateId;
- private Timestamp createdTime;
- private Timestamp updatedTime;
- private String image;
- private String gatewayId;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- public String getImage() {
- return image;
- }
-
- public void setImage(String image) {
- this.image = image;
- }
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
- generator.setParameter(WorkflowConstants.WF_TEMPLATE_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
- generator.setParameter(WorkflowConstants.WF_TEMPLATE_ID, identifier);
- Query q = generator.selectQuery(em);
- Workflow workflow = (Workflow) q.getSingleResult();
- WorkflowResource workflowResource = (WorkflowResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
- em.getTransaction().commit();
- em.close();
- return workflowResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> workflowResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
- Query q;
- if ((fieldName.equals(WorkflowConstants.WF_NAME)) || (fieldName.equals(WorkflowConstants.CREATED_USER)) || (fieldName.equals(WorkflowConstants.GRAPH)) || (fieldName.equals(WorkflowConstants.WF_TEMPLATE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- Workflow workflow = (Workflow) result;
- WorkflowResource workflowResource = (WorkflowResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
- workflowResources.add(workflowResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Workflow Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Workflow Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return workflowResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- List<Resource> workflows = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
- generator.setParameter(WorkflowConstants.GATEWAY_ID, gatewayId);
- Query q = generator.selectQuery(em);
- List results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Workflow workflow = (Workflow) result;
- WorkflowResource wfResource =
- (WorkflowResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
- workflows.add(wfResource);
- }
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return workflows;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- List<String> workflowIds = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
- generator.setParameter(WorkflowConstants.GATEWAY_ID, gatewayId);
- Query q = generator.selectQuery(em);
- List results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- Workflow workflow = (Workflow) result;
- workflowIds.add(workflow.getWfTemplateId());
- }
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return workflowIds;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> workflowResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(WORKFLOW);
- Query q;
- if ((fieldName.equals(WorkflowConstants.WF_NAME)) || (fieldName.equals(WorkflowConstants.CREATED_USER)) || (fieldName.equals(WorkflowConstants.GRAPH)) || (fieldName.equals(WorkflowConstants.WF_TEMPLATE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- Workflow workflow = (Workflow) result;
- WorkflowResource workflowResource = (WorkflowResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.WORKFLOW, workflow);
- workflowResourceIDs.add(workflowResource.getWfTemplateId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Workflow Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Workflow Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return workflowResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- Workflow existingWorkflow = em.find(Workflow.class, wfTemplateId);
- em.close();
- Workflow workflow;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingWorkflow == null) {
- workflow = new Workflow();
- workflow.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- workflow = existingWorkflow;
- workflow.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- workflow.setWfName(getWfName());
- workflow.setCreatedUser(getCreatedUser());
- workflow.setGatewayId(gatewayId);
- if (getGraph() != null){
- workflow.setGraph(getGraph().toCharArray());
- }
- if (image != null){
- workflow.setImage(image.getBytes());
- }
- workflow.setWfTemplateId(getWfTemplateId());
- if (existingWorkflow == null) {
- em.persist(workflow);
- } else {
- em.merge(workflow);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- Workflow workflow = em.find(Workflow.class, identifier);
- em.close();
- return workflow != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getWfName() {
- return wfName;
- }
-
- public String getCreatedUser() {
- return createdUser;
- }
-
- public String getGraph() {
- return graph;
- }
-
- public String getWfTemplateId() {
- return wfTemplateId;
- }
-
- public void setWfName(String wfName) {
- this.wfName=wfName;
- }
-
- public void setCreatedUser(String createdUser) {
- this.createdUser=createdUser;
- }
-
- public void setGraph(String graph) {
- this.graph=graph;
- }
-
- public void setWfTemplateId(String wfTemplateId) {
- this.wfTemplateId=wfTemplateId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentCatalogImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentCatalogImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentCatalogImpl.java
index 88fbe29..6a7f723 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentCatalogImpl.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentCatalogImpl.java
@@ -19,7 +19,7 @@
*
*/
-package org.apache.airavata.experiment.catalog.impl;
+package org.apache.airavata.registry.core.experiment.catalog.impl;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java
index 1178461..35605f8 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java
@@ -19,7 +19,7 @@
*
*/
-package org.apache.airavata.experiment.catalog.impl;
+package org.apache.airavata.registry.core.experiment.catalog.impl;
import org.apache.airavata.common.logger.AiravataLogger;
import org.apache.airavata.common.logger.AiravataLoggerFactory;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/GatewayRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/GatewayRegistry.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/GatewayRegistry.java
index 1aa165c..d97f0d4 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/GatewayRegistry.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/GatewayRegistry.java
@@ -19,7 +19,7 @@
*
*/
-package org.apache.airavata.experiment.catalog.impl;
+package org.apache.airavata.registry.core.experiment.catalog.impl;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/LoggingExperimentCatalogImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/LoggingExperimentCatalogImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/LoggingExperimentCatalogImpl.java
index d45c4c5..4849385 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/LoggingExperimentCatalogImpl.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/LoggingExperimentCatalogImpl.java
@@ -18,7 +18,7 @@
* under the License.
*
*/
-package org.apache.airavata.experiment.catalog.impl;
+package org.apache.airavata.registry.core.experiment.catalog.impl;
import org.apache.airavata.registry.cpi.*;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ProjectRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ProjectRegistry.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ProjectRegistry.java
index c045a93..f0c4965 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ProjectRegistry.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ProjectRegistry.java
@@ -19,7 +19,7 @@
*
*/
-package org.apache.airavata.experiment.catalog.impl;
+package org.apache.airavata.registry.core.experiment.catalog.impl;
import org.apache.airavata.common.utils.AiravataUtils;
import org.apache.airavata.model.workspace.Project;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/RegistryFactory.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/RegistryFactory.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/RegistryFactory.java
index 5b8ce18..b54e0cf 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/RegistryFactory.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/RegistryFactory.java
@@ -19,7 +19,7 @@
*
*/
-package org.apache.airavata.experiment.catalog.impl;
+package org.apache.airavata.registry.core.experiment.catalog.impl;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/UserReg.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/UserReg.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/UserReg.java
index c7f80c7..e720df0 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/UserReg.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/UserReg.java
@@ -19,7 +19,7 @@
*
*/
-package org.apache.airavata.experiment.catalog.impl;
+package org.apache.airavata.registry.core.experiment.catalog.impl;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/JPAConstants.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/JPAConstants.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/JPAConstants.java
deleted file mode 100644
index b558d03..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/Resource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/Resource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/Resource.java
deleted file mode 100644
index bdfd948..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/ResourceType.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/ResourceType.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/ResourceType.java
deleted file mode 100644
index ea66a90..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/ResourceUtils.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/ResourceUtils.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/ResourceUtils.java
deleted file mode 100644
index a8d8e83..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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();
- }
- }
- }
-}
[20/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppEnvironmentResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppEnvironmentResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppEnvironmentResource.java
deleted file mode 100644
index 98f753f..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppEnvironmentResource.java
+++ /dev/null
@@ -1,293 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.AppEnvironment;
-import org.apache.aiaravata.application.catalog.data.model.AppEnvironment_PK;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class AppEnvironmentResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(AppEnvironmentResource.class);
- private String deploymentId;
- private String name;
- private String value;
- private AppDeploymentResource appDeploymentResource;
-
- public String getDeploymentId() {
- return deploymentId;
- }
-
- public void setDeploymentId(String deploymentId) {
- this.deploymentId = deploymentId;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public AppDeploymentResource getAppDeploymentResource() {
- return appDeploymentResource;
- }
-
- public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
- this.appDeploymentResource = appDeploymentResource;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APP_ENVIRONMENT);
- generator.setParameter(AppEnvironmentConstants.DEPLOYMENT_ID, ids.get(AppEnvironmentConstants.DEPLOYMENT_ID));
- if (ids.get(AppEnvironmentConstants.NAME) != null){
- generator.setParameter(AppEnvironmentConstants.NAME, ids.get(AppEnvironmentConstants.NAME));
- }
-
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APP_ENVIRONMENT);
- generator.setParameter(AppEnvironmentConstants.DEPLOYMENT_ID, ids.get(AppEnvironmentConstants.DEPLOYMENT_ID));
- generator.setParameter(AppEnvironmentConstants.NAME, ids.get(AppEnvironmentConstants.NAME));
- Query q = generator.selectQuery(em);
- AppEnvironment appEnvironment = (AppEnvironment) q.getSingleResult();
- AppEnvironmentResource resource =
- (AppEnvironmentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_ENVIRONMENT, appEnvironment);
- em.getTransaction().commit();
- em.close();
- return resource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> appEnvironmentList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APP_ENVIRONMENT);
- List results;
- if (fieldName.equals(AppEnvironmentConstants.DEPLOYMENT_ID)) {
- generator.setParameter(AppEnvironmentConstants.DEPLOYMENT_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- AppEnvironment appEnvironment = (AppEnvironment) result;
- AppEnvironmentResource resource =
- (AppEnvironmentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_ENVIRONMENT, appEnvironment);
- appEnvironmentList.add(resource);
- }
- }
- } else if (fieldName.equals(AppEnvironmentConstants.NAME)) {
- generator.setParameter(AppEnvironmentConstants.NAME, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- AppEnvironment appEnvironment = (AppEnvironment) result;
- AppEnvironmentResource resource =
- (AppEnvironmentResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_ENVIRONMENT, appEnvironment);
- appEnvironmentList.add(resource);
- }
- }
- }else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for App Environment resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for App Environment resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return appEnvironmentList;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- logger.error("Unsupported for objects with a composite identifier");
- throw new AppCatalogException("Unsupported for objects with a composite identifier");
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- AppEnvironment existigAppEnv = em.find(AppEnvironment.class, new AppEnvironment_PK(deploymentId, name));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
-
- ApplicationDeployment deployment = em.find(ApplicationDeployment.class, deploymentId);
- if (existigAppEnv != null){
- existigAppEnv.setValue(value);
- existigAppEnv.setApplicationDeployment(deployment);
- em.merge(existigAppEnv);
- }else {
- AppEnvironment appEnvironment = new AppEnvironment();
- appEnvironment.setDeploymentID(deploymentId);
- appEnvironment.setName(name);
- appEnvironment.setValue(value);
- appEnvironment.setApplicationDeployment(deployment);
- em.persist(appEnvironment);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- AppEnvironment appEnvironment = em.find(AppEnvironment.class,
- new AppEnvironment_PK(ids.get(AppEnvironmentConstants.DEPLOYMENT_ID),
- ids.get(AppEnvironmentConstants.NAME)));
- em.close();
- return appEnvironment != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppInterfaceResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppInterfaceResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppInterfaceResource.java
deleted file mode 100644
index 3f6b60d..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppInterfaceResource.java
+++ /dev/null
@@ -1,363 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationInterface;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-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 AppInterfaceResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(AppInterfaceResource.class);
- private String interfaceId;
- private String appName;
- private String appDescription;
- private Timestamp createdTime;
- private Timestamp updatedTime;
- private String gatewayId;
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- public String getInterfaceId() {
- return interfaceId;
- }
-
- public void setInterfaceId(String interfaceId) {
- this.interfaceId = interfaceId;
- }
-
- public String getAppName() {
- return appName;
- }
-
- public void setAppName(String appName) {
- this.appName = appName;
- }
-
- public String getAppDescription() {
- return appDescription;
- }
-
- public void setAppDescription(String appDescription) {
- this.appDescription = appDescription;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
- generator.setParameter(ApplicationInterfaceConstants.INTERFACE_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
- generator.setParameter(ApplicationInterfaceConstants.INTERFACE_ID, identifier);
- Query q = generator.selectQuery(em);
- ApplicationInterface applicationInterface = (ApplicationInterface) q.getSingleResult();
- AppInterfaceResource resource =
- (AppInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INTERFACE, applicationInterface);
- em.getTransaction().commit();
- em.close();
- return resource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
- List results;
- if (fieldName.equals(ApplicationInterfaceConstants.APPLICATION_NAME)) {
- generator.setParameter(ApplicationInterfaceConstants.APPLICATION_NAME, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInterface appInterface = (ApplicationInterface) result;
- AppInterfaceResource resource =
- (AppInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INTERFACE, appInterface);
- resourceList.add(resource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for application interface.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for application interface.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
- generator.setParameter(ApplicationInterfaceConstants.GATEWAY_ID, gatewayId);
- Query q = generator.selectQuery(em);
- List results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInterface appInterface = (ApplicationInterface) result;
- AppInterfaceResource resource =
- (AppInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INTERFACE, appInterface);
- resourceList.add(resource);
- }
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- List<String> resourceList = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
- Query q = generator.selectQuery(em);
- List results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInterface appInterface = (ApplicationInterface) result;
- resourceList.add(appInterface.getInterfaceID());
- }
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> resourceList = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INTERFACE);
- List results;
- if (fieldName.equals(ApplicationInterfaceConstants.APPLICATION_NAME)) {
- generator.setParameter(ApplicationInterfaceConstants.APPLICATION_NAME, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInterface appInterface = (ApplicationInterface) result;
- resourceList.add(appInterface.getInterfaceID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for application interface.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for application interface.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationInterface existigAppInterface = em.find(ApplicationInterface.class, interfaceId);
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existigAppInterface != null){
- existigAppInterface.setAppName(appName);
- existigAppInterface.setAppDescription(appDescription);
- existigAppInterface.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- existigAppInterface.setGatewayId(gatewayId);
- em.merge(existigAppInterface);
- }else {
- ApplicationInterface applicationInterface = new ApplicationInterface();
- applicationInterface.setInterfaceID(interfaceId);
- applicationInterface.setAppName(appName);
- applicationInterface.setAppDescription(appDescription);
- applicationInterface.setCreationTime(AiravataUtils.getCurrentTimestamp());
- applicationInterface.setGatewayId(gatewayId);
- em.persist(applicationInterface);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationInterface existigAppInterface = em.find(ApplicationInterface.class, identifier);
- em.close();
- return existigAppInterface != null;
- }catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleMappingResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleMappingResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleMappingResource.java
deleted file mode 100644
index a44229d..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleMappingResource.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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.AppModuleMapping;
-import org.apache.aiaravata.application.catalog.data.model.AppModuleMapping_PK;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationInterface;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationModule;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class AppModuleMappingResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(AppModuleMappingResource.class);
- private String interfaceId;
- private String moduleId;
- private AppInterfaceResource appInterfaceResource;
- private AppModuleResource moduleResource;
-
-
- public String getModuleId() {
- return moduleId;
- }
-
- public void setModuleId(String moduleId) {
- this.moduleId = moduleId;
- }
-
- public String getInterfaceId() {
- return interfaceId;
- }
-
- public void setInterfaceId(String interfaceId) {
- this.interfaceId = interfaceId;
- }
-
- public AppInterfaceResource getAppInterfaceResource() {
- return appInterfaceResource;
- }
-
- public void setAppInterfaceResource(AppInterfaceResource appInterfaceResource) {
- this.appInterfaceResource = appInterfaceResource;
- }
-
- public AppModuleResource getModuleResource() {
- return moduleResource;
- }
-
- public void setModuleResource(AppModuleResource moduleResource) {
- this.moduleResource = moduleResource;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APP_MODULE_MAPPING);
- generator.setParameter(AppModuleMappingConstants.INTERFACE_ID, ids.get(AppModuleMappingConstants.INTERFACE_ID));
- if (ids.get(AppModuleMappingConstants.MODULE_ID) != null){
- generator.setParameter(AppModuleMappingConstants.MODULE_ID, ids.get(AppModuleMappingConstants.MODULE_ID));
- }
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public void removeAll() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APP_MODULE_MAPPING);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APP_MODULE_MAPPING);
- generator.setParameter(AppModuleMappingConstants.INTERFACE_ID, ids.get(AppModuleMappingConstants.INTERFACE_ID));
- generator.setParameter(AppModuleMappingConstants.MODULE_ID, ids.get(AppModuleMappingConstants.MODULE_ID));
- Query q = generator.selectQuery(em);
- AppModuleMapping result = (AppModuleMapping) q.getSingleResult();
- AppModuleMappingResource resource =
- (AppModuleMappingResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_MODULE_MAPPING, result);
- em.getTransaction().commit();
- em.close();
- return resource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APP_MODULE_MAPPING);
- List results;
- if (fieldName.equals(AppModuleMappingConstants.INTERFACE_ID)) {
- generator.setParameter(AppModuleMappingConstants.INTERFACE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- AppModuleMapping moduleMapping = (AppModuleMapping) result;
- AppModuleMappingResource resource =
- (AppModuleMappingResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_MODULE_MAPPING, moduleMapping);
- resourceList.add(resource);
- }
- }
- } else if (fieldName.equals(AppModuleMappingConstants.MODULE_ID)) {
- generator.setParameter(AppModuleMappingConstants.MODULE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- AppModuleMapping moduleMapping = (AppModuleMapping) result;
- AppModuleMappingResource resource =
- (AppModuleMappingResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APP_MODULE_MAPPING, moduleMapping);
- resourceList.add(resource);
- }
- }
- }else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for app module mapping resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for app module mapping resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- logger.error("Unsupported for objects with a composite identifier");
- throw new AppCatalogException("Unsupported for objects with a composite identifier");
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- AppModuleMapping existngModuleMap = em.find(AppModuleMapping.class, new AppModuleMapping_PK(interfaceId, moduleId));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceId);
- ApplicationModule applicationModule = em.find(ApplicationModule.class, moduleId);
- if (existngModuleMap != null){
- existngModuleMap.setApplicationInterface(applicationInterface);
- existngModuleMap.setApplicationModule(applicationModule);
- em.merge(existngModuleMap);
- }else {
- AppModuleMapping appModuleMapping = new AppModuleMapping();
- appModuleMapping.setInterfaceID(interfaceId);
- appModuleMapping.setApplicationInterface(applicationInterface);
- appModuleMapping.setModuleID(moduleId);
- appModuleMapping.setApplicationModule(applicationModule);
- em.persist(appModuleMapping);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- AppModuleMapping moduleMapping = em.find(AppModuleMapping.class,
- new AppModuleMapping_PK(ids.get(AppModuleMappingConstants.INTERFACE_ID),
- ids.get(AppModuleMappingConstants.MODULE_ID)));
- em.close();
- return moduleMapping != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleResource.java
deleted file mode 100644
index 79803af..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/AppModuleResource.java
+++ /dev/null
@@ -1,344 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationModule;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-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 AppModuleResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(AppModuleResource.class);
- private String moduleId;
- private String moduleName;
- private String moduleVersion;
- private String moduleDesc;
- private Timestamp createdTime;
- private Timestamp updatedTime;
- private String gatewayId;
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- public String getModuleId() {
- return moduleId;
- }
-
- public void setModuleId(String moduleId) {
- this.moduleId = moduleId;
- }
-
- public String getModuleName() {
- return moduleName;
- }
-
- public void setModuleName(String moduleName) {
- this.moduleName = moduleName;
- }
-
- public String getModuleVersion() {
- return moduleVersion;
- }
-
- public void setModuleVersion(String moduleVersion) {
- this.moduleVersion = moduleVersion;
- }
-
- public String getModuleDesc() {
- return moduleDesc;
- }
-
- public void setModuleDesc(String moduleDesc) {
- this.moduleDesc = moduleDesc;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APPLICATION_MODULE);
- generator.setParameter(ApplicationModuleConstants.MODULE_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
- generator.setParameter(ApplicationModuleConstants.MODULE_ID, identifier);
- Query q = generator.selectQuery(em);
- ApplicationModule applicationModule = (ApplicationModule) q.getSingleResult();
- AppModuleResource appModuleResource =
- (AppModuleResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_MODULE, applicationModule);
- em.getTransaction().commit();
- em.close();
- return appModuleResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> moduleResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
- List results;
- if (fieldName.equals(ApplicationModuleConstants.MODULE_NAME)) {
- generator.setParameter(ApplicationModuleConstants.MODULE_NAME, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationModule applicationModule = (ApplicationModule) result;
- AppModuleResource moduleResource =
- (AppModuleResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_MODULE, applicationModule);
- moduleResources.add(moduleResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for app module resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for app module resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return moduleResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- List<Resource> appModuleResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
- generator.setParameter(ApplicationModuleConstants.GATEWAY_ID, gatewayId);
- Query q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ApplicationModule module = (ApplicationModule) result;
- AppModuleResource appModuleResource = (AppModuleResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_MODULE, module);
- appModuleResources.add(appModuleResource);
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return appModuleResources;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> moduleResources = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_MODULE);
- List results;
- if (fieldName.equals(ApplicationModuleConstants.MODULE_NAME)) {
- generator.setParameter(ApplicationModuleConstants.MODULE_NAME, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationModule applicationModule = (ApplicationModule) result;
- moduleResources.add(applicationModule.getModuleID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for app module resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for app module resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return moduleResources;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationModule existingModule = em.find(ApplicationModule.class, moduleId);
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingModule != null){
- existingModule.setModuleName(moduleName);
- existingModule.setModuleVersion(moduleVersion);
- existingModule.setModuleDesc(moduleDesc);
- existingModule.setGatewayId(gatewayId);
- existingModule.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- em.merge(existingModule);
- }else {
- ApplicationModule applicationModule = new ApplicationModule();
- applicationModule.setModuleID(moduleId);
- applicationModule.setModuleName(moduleName);
- applicationModule.setModuleVersion(moduleVersion);
- applicationModule.setModuleDesc(moduleDesc);
- applicationModule.setGatewayId(gatewayId);
- applicationModule.setCreationTime(AiravataUtils.getCurrentTimestamp());
- em.persist(applicationModule);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationModule applicationModule = em.find(ApplicationModule.class, identifier);
- em.close();
- return applicationModule != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationInputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationInputResource.java
deleted file mode 100644
index 3dcb6b4..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationInputResource.java
+++ /dev/null
@@ -1,454 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.AppInput_PK;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationInput;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationInterface;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ApplicationInputResource extends AbstractResource {
-
- private final static Logger logger = LoggerFactory.getLogger(ApplicationInputResource.class);
-
- private String interfaceID;
- private String inputKey;
- private String dataType;
- private String inputVal;
- private String metadata;
- private String appArgument;
- private String userFriendlyDesc;
- private int inputOrder;
- private boolean standardInput;
- private boolean isRequired;
- private boolean requiredToCMD;
- private boolean dataStaged;
-
- private AppInterfaceResource appInterfaceResource;
-
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INPUT);
- generator.setParameter(AppInputConstants.INTERFACE_ID, ids.get(AppInputConstants.INTERFACE_ID));
- if (ids.get(AppInputConstants.INPUT_KEY) != null){
- generator.setParameter(AppInputConstants.INPUT_KEY, ids.get(AppInputConstants.INPUT_KEY));
- }
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INPUT);
- generator.setParameter(AppInputConstants.INTERFACE_ID, ids.get(AppInputConstants.INTERFACE_ID));
- generator.setParameter(AppInputConstants.INPUT_KEY, ids.get(AppInputConstants.INPUT_KEY));
- Query q = generator.selectQuery(em);
- ApplicationInput applicationInput = (ApplicationInput) q.getSingleResult();
- ApplicationInputResource applicationInputResource =
- (ApplicationInputResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_INPUT
- , applicationInput);
- em.getTransaction().commit();
- em.close();
- return applicationInputResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> appInputResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INPUT);
- List results;
- if (fieldName.equals(AppInputConstants.INTERFACE_ID)) {
- generator.setParameter(AppInputConstants.INTERFACE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInput applicationInput = (ApplicationInput) result;
- ApplicationInputResource applicationInputResource =
- (ApplicationInputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.APPLICATION_INPUT, applicationInput);
- appInputResources.add(applicationInputResource);
- }
- }
- } else if (fieldName.equals(AppInputConstants.INPUT_KEY)) {
- generator.setParameter(AppInputConstants.INPUT_KEY, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInput applicationInput = (ApplicationInput) result;
- ApplicationInputResource applicationInputResource =
- (ApplicationInputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.APPLICATION_INPUT, applicationInput);
- appInputResources.add(applicationInputResource);
- }
- }
- } else if (fieldName.equals(AppInputConstants.DATA_TYPE)) {
- generator.setParameter(AppInputConstants.DATA_TYPE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInput applicationInput = (ApplicationInput) result;
- ApplicationInputResource applicationInputResource =
- (ApplicationInputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.APPLICATION_INPUT, applicationInput);
- appInputResources.add(applicationInputResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for AppInput Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for AppInput Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return appInputResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> appInputResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INPUT);
- List results;
- if (fieldName.equals(AppInputConstants.INTERFACE_ID)) {
- generator.setParameter(AppInputConstants.INTERFACE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInput applicationInput = (ApplicationInput) result;
- appInputResourceIDs.add(applicationInput.getInterfaceID());
- }
- }
- } else if (fieldName.equals(AppInputConstants.INPUT_KEY)) {
- generator.setParameter(AppInputConstants.INPUT_KEY, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInput applicationInput = (ApplicationInput) result;
- appInputResourceIDs.add(applicationInput.getInterfaceID());
- }
- }
- } else if (fieldName.equals(AppInputConstants.DATA_TYPE)) {
- generator.setParameter(AppInputConstants.DATA_TYPE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationInput applicationInput = (ApplicationInput) result;
- appInputResourceIDs.add(applicationInput.getInterfaceID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for AppInput resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for AppInput Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return appInputResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationInput existingApplicationInput = em.find(ApplicationInput.class, new AppInput_PK(interfaceID, inputKey));
- em.close();
- ApplicationInput applicationInput;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingApplicationInput == null) {
- applicationInput = new ApplicationInput();
- } else {
- applicationInput=existingApplicationInput;
- }
- ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceID);
- applicationInput.setApplicationInterface(applicationInterface);
- applicationInput.setInterfaceID(applicationInterface.getInterfaceID());
- applicationInput.setDataType(dataType);
- applicationInput.setInputKey(inputKey);
- applicationInput.setInputVal(inputVal);
- applicationInput.setMetadata(metadata);
- applicationInput.setAppArgument(appArgument);
- applicationInput.setUserFriendlyDesc(userFriendlyDesc);
- applicationInput.setStandardInput(standardInput);
- applicationInput.setInputOrder(inputOrder);
- applicationInput.setRequiredToCMD(requiredToCMD);
- applicationInput.setRequired(isRequired);
- applicationInput.setDataStaged(dataStaged);
- if (existingApplicationInput == null) {
- em.persist(applicationInput);
- } else {
- em.merge(applicationInput);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationInput applicationInput = em.find(ApplicationInput.class, new AppInput_PK(
- ids.get(AppInputConstants.INTERFACE_ID),
- ids.get(AppInputConstants.INPUT_KEY)));
-
- em.close();
- return applicationInput != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getInterfaceID() {
- return interfaceID;
- }
-
- public void setInterfaceID(String interfaceID) {
- this.interfaceID = interfaceID;
- }
-
- 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 getInputVal() {
- return inputVal;
- }
-
- public void setInputVal(String inputVal) {
- this.inputVal = inputVal;
- }
-
- 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 String getUserFriendlyDesc() {
- return userFriendlyDesc;
- }
-
- public void setUserFriendlyDesc(String userFriendlyDesc) {
- this.userFriendlyDesc = userFriendlyDesc;
- }
-
- public AppInterfaceResource getAppInterfaceResource() {
- return appInterfaceResource;
- }
-
- public void setAppInterfaceResource(AppInterfaceResource appInterfaceResource) {
- this.appInterfaceResource = appInterfaceResource;
- }
-
- public boolean isStandardInput() {
- return standardInput;
- }
-
- public void setStandardInput(boolean standardInput) {
- this.standardInput = standardInput;
- }
-
- public int getInputOrder() {
- return inputOrder;
- }
-
- public void setInputOrder(int inputOrder) {
- this.inputOrder = inputOrder;
- }
-
- 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;
- }
-}
[17/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileResource.java
deleted file mode 100644
index 84a90ec..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileResource.java
+++ /dev/null
@@ -1,318 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.GatewayProfile;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-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 GatewayProfileResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(GatewayProfileResource.class);
-
- private String gatewayID;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
- generator.setParameter(GatewayProfileConstants.GATEWAY_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
- generator.setParameter(GatewayProfileConstants.GATEWAY_ID, identifier);
- Query q = generator.selectQuery(em);
- GatewayProfile gatewayProfile = (GatewayProfile) q.getSingleResult();
- GatewayProfileResource gatewayProfileResource =
- (GatewayProfileResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
- em.getTransaction().commit();
- em.close();
- return gatewayProfileResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> gatewayProfileResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
- List results;
- if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
- generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GatewayProfile gatewayProfile = (GatewayProfile) result;
- GatewayProfileResource gatewayProfileResource =
- (GatewayProfileResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
- gatewayProfileResources.add(gatewayProfileResource);
- }
- }
- } else if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
- generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GatewayProfile gatewayProfile = (GatewayProfile) result;
- GatewayProfileResource gatewayProfileResource =
- (GatewayProfileResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
- gatewayProfileResources.add(gatewayProfileResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Gateway Profile resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Gateway Profile resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gatewayProfileResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- List<Resource> resourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
- Query q = generator.selectQuery(em);
- List results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GatewayProfile gatewayProfile = (GatewayProfile) result;
- GatewayProfileResource gatewayProfileResource =
- (GatewayProfileResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
- resourceList.add(gatewayProfileResource);
- }
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resourceList;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> gatewayProfileResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
- List results;
- if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
- generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GatewayProfile gatewayProfile = (GatewayProfile) result;
- gatewayProfileResourceIDs.add(gatewayProfile.getGatewayID());
- }
- }
- } else if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
- generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GatewayProfile gatewayProfile = (GatewayProfile) result;
- gatewayProfileResourceIDs.add(gatewayProfile.getGatewayID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Gateway Profile resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Gateway Profile resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gatewayProfileResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GatewayProfile existingGatewayProfile = em.find(GatewayProfile.class, gatewayID);
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingGatewayProfile != null) {
- existingGatewayProfile.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- em.merge(existingGatewayProfile);
- } else {
- GatewayProfile gatewayProfile = new GatewayProfile();
- gatewayProfile.setGatewayID(gatewayID);
- gatewayProfile.setCreationTime(AiravataUtils.getCurrentTimestamp());
- em.persist(gatewayProfile);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GatewayProfile gatewayProfile = em.find(GatewayProfile.class, identifier);
- em.close();
- return gatewayProfile != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getGatewayID() {
- return gatewayID;
- }
-
- public void setGatewayID(String gatewayID) {
- this.gatewayID = gatewayID;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusGKEndpointResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusGKEndpointResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusGKEndpointResource.java
deleted file mode 100644
index c933600..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusGKEndpointResource.java
+++ /dev/null
@@ -1,321 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.*;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class GlobusGKEndpointResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(GlobusGKEndpointResource.class);
-
- private String submissionID;
- private String endpoint;
-
- private GlobusJobSubmissionResource globusJobSubmissionResource;
-
-
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_GK_ENDPOINT);
- generator.setParameter(GlobusEPConstants.ENDPOINT, ids.get(GlobusEPConstants.ENDPOINT));
- generator.setParameter(GlobusEPConstants.SUBMISSION_ID, ids.get(GlobusEPConstants.SUBMISSION_ID));
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_GK_ENDPOINT);
- generator.setParameter(GlobusEPConstants.SUBMISSION_ID, ids.get(GlobusEPConstants.SUBMISSION_ID));
- generator.setParameter(GlobusEPConstants.ENDPOINT, ids.get(GlobusEPConstants.ENDPOINT));
- Query q = generator.selectQuery(em);
- GlobusGKEndpoint gkEndpoint = (GlobusGKEndpoint) q.getSingleResult();
- GlobusGKEndpointResource gkEndpointResource =
- (GlobusGKEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GLOBUS_GK_ENDPOINT, gkEndpoint);
- em.getTransaction().commit();
- em.close();
- return gkEndpointResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> resources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_GK_ENDPOINT);
- List results;
- if (fieldName.equals(GlobusEPConstants.ENDPOINT)) {
- generator.setParameter(GlobusEPConstants.ENDPOINT, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusGKEndpoint gkEndpoint = (GlobusGKEndpoint) result;
- GlobusGKEndpointResource gkEndpointResource =
- (GlobusGKEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GLOBUS_GK_ENDPOINT, gkEndpoint);
- resources.add(gkEndpointResource);
- }
- }
- } else if (fieldName.equals(GlobusEPConstants.SUBMISSION_ID)) {
- generator.setParameter(GlobusEPConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusGKEndpoint globusGKEndpoint = (GlobusGKEndpoint) result;
- GlobusGKEndpointResource gkEndpointResource =
- (GlobusGKEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GLOBUS_GK_ENDPOINT, globusGKEndpoint);
- resources.add(gkEndpointResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Globus Endpoint Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Globus Endpoint Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return resources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> list = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_GK_ENDPOINT);
- List results;
- if (fieldName.equals(GlobusEPConstants.SUBMISSION_ID)) {
- generator.setParameter(GlobusEPConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusGKEndpoint globusGKEndpoint = (GlobusGKEndpoint) result;
- list.add(globusGKEndpoint.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GlobusEPConstants.ENDPOINT)) {
- generator.setParameter(GlobusEPConstants.ENDPOINT, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusGKEndpoint globusGKEndpoint = (GlobusGKEndpoint) result;
- list.add(globusGKEndpoint.getSubmissionID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Globus EP resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Globus EP Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return list;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GlobusGKEndpoint existingGlobusEP = em.find(GlobusGKEndpoint.class, new GlobusGKEndPointPK(submissionID, endpoint));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- GlobusJobSubmission globusJobSubmission = em.find(GlobusJobSubmission.class, submissionID);
- if (existingGlobusEP != null) {
- existingGlobusEP.setSubmissionID(submissionID);
- existingGlobusEP.setEndpoint(endpoint);
- existingGlobusEP.setGlobusSubmission(globusJobSubmission);
- em.merge(existingGlobusEP);
- } else {
- GlobusGKEndpoint globusGKEndpoint = new GlobusGKEndpoint();
- globusGKEndpoint.setSubmissionID(submissionID);
- globusGKEndpoint.setEndpoint(endpoint);
- globusGKEndpoint.setGlobusSubmission(globusJobSubmission);
- em.persist(globusGKEndpoint);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GlobusGKEndpoint gkEndpoint = em.find(GlobusGKEndpoint.class, new GlobusGKEndPointPK(ids.get(GlobusEPConstants.SUBMISSION_ID),
- ids.get(GlobusEPConstants.ENDPOINT)));
-
- em.close();
- return gkEndpoint != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- } }
-
- public String getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getEndpoint() {
- return endpoint;
- }
-
- public void setEndpoint(String endpoint) {
- this.endpoint = endpoint;
- }
-
- public GlobusJobSubmissionResource getGlobusJobSubmissionResource() {
- return globusJobSubmissionResource;
- }
-
- public void setGlobusJobSubmissionResource(GlobusJobSubmissionResource globusJobSubmissionResource) {
- this.globusJobSubmissionResource = globusJobSubmissionResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusJobSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusJobSubmissionResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusJobSubmissionResource.java
deleted file mode 100644
index 4d0f7ef..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GlobusJobSubmissionResource.java
+++ /dev/null
@@ -1,315 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.GlobusJobSubmission;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.List;
-
-public class GlobusJobSubmissionResource extends AbstractResource {
-
- private final static Logger logger = LoggerFactory.getLogger(GlobusJobSubmissionResource.class);
-
- private String submissionID;
- private String resourceJobManager;
- private String securityProtocol;
-
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
- generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
- generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, identifier);
- Query q = generator.selectQuery(em);
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) q.getSingleResult();
- GlobusJobSubmissionResource globusJobSubmissionResource =
- (GlobusJobSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GLOBUS_SUBMISSION, globusJobSubmission);
- em.getTransaction().commit();
- em.close();
- return globusJobSubmissionResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> globusSubmissionResourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
- List results;
- if (fieldName.equals(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER)) {
- generator.setParameter(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- GlobusJobSubmissionResource globusJobSubmissionResource =
- (GlobusJobSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GLOBUS_SUBMISSION, globusJobSubmission);
- globusSubmissionResourceList.add(globusJobSubmissionResource);
- }
- }
- } else if (fieldName.equals(GlobusJobSubmissionConstants.SECURITY_PROTOCAL)) {
- generator.setParameter(GlobusJobSubmissionConstants.SECURITY_PROTOCAL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- GlobusJobSubmissionResource globusJobSubmissionResource =
- (GlobusJobSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GLOBUS_SUBMISSION, globusJobSubmission);
- globusSubmissionResourceList.add(globusJobSubmissionResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Globus submission resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Globus Submission resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return globusSubmissionResourceList;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> globusSubmissionResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GLOBUS_SUBMISSION);
- List results;
- if (fieldName.equals(GlobusJobSubmissionConstants.SUBMISSION_ID)) {
- generator.setParameter(GlobusJobSubmissionConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP)) {
- generator.setParameter(GlobusJobSubmissionConstants.GLOBUS_GATEKEEPER_EP, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
- }
- }
- }
- else if (fieldName.equals(GlobusJobSubmissionConstants.SECURITY_PROTOCAL)) {
- generator.setParameter(GlobusJobSubmissionConstants.SECURITY_PROTOCAL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER)) {
- generator.setParameter(GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GlobusJobSubmission globusJobSubmission = (GlobusJobSubmission) result;
- globusSubmissionResourceIDs.add(globusJobSubmission.getSubmissionID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Globus Submission resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Globus Submission resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return globusSubmissionResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GlobusJobSubmission existingGlobusSubmission = em.find(GlobusJobSubmission.class, submissionID);
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingGlobusSubmission != null) {
- existingGlobusSubmission.setSubmissionID(submissionID);
- existingGlobusSubmission.setResourceJobManager(resourceJobManager);
- existingGlobusSubmission.setSecurityProtocol(securityProtocol);
- em.merge(existingGlobusSubmission);
- } else {
- GlobusJobSubmission globusJobSubmission = new GlobusJobSubmission();
- globusJobSubmission.setSubmissionID(submissionID);
- globusJobSubmission.setSecurityProtocol(securityProtocol);
- globusJobSubmission.setResourceJobManager(resourceJobManager);
- em.persist(globusJobSubmission);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GlobusJobSubmission globusJobSubmission = em.find(GlobusJobSubmission.class, identifier);
- em.close();
- return globusJobSubmission != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getResourceJobManager() {
- return resourceJobManager;
- }
-
- public void setResourceJobManager(String resourceJobManager) {
- this.resourceJobManager = resourceJobManager;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol = securityProtocol;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpDataMovementResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpDataMovementResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpDataMovementResource.java
deleted file mode 100644
index 35b36e0..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpDataMovementResource.java
+++ /dev/null
@@ -1,279 +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.aiaravata.application.catalog.data.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.GridftpDataMovement;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GridftpDataMovementResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(GridftpDataMovementResource.class);
- private String dataMovementInterfaceId;
- private String securityProtocol;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
- generator.setParameter(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
- generator.setParameter(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID, identifier);
- Query q = generator.selectQuery(em);
- GridftpDataMovement gridftpDataMovement = (GridftpDataMovement) q.getSingleResult();
- GridftpDataMovementResource gridftpDataMovementResource = (GridftpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_DATA_MOVEMENT, gridftpDataMovement);
- em.getTransaction().commit();
- em.close();
- return gridftpDataMovementResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> gridftpDataMovementResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
- Query q;
- if ((fieldName.equals(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(GridftpDataMovementConstants.SECURITY_PROTOCOL))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- GridftpDataMovement gridftpDataMovement = (GridftpDataMovement) result;
- GridftpDataMovementResource gridftpDataMovementResource = (GridftpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_DATA_MOVEMENT, gridftpDataMovement);
- gridftpDataMovementResources.add(gridftpDataMovementResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Gridftp Data Movement Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Gridftp Data Movement Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gridftpDataMovementResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> gridftpDataMovementResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_DATA_MOVEMENT);
- Query q;
- if ((fieldName.equals(GridftpDataMovementConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(GridftpDataMovementConstants.SECURITY_PROTOCOL))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- GridftpDataMovement gridftpDataMovement = (GridftpDataMovement) result;
- GridftpDataMovementResource gridftpDataMovementResource = (GridftpDataMovementResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_DATA_MOVEMENT, gridftpDataMovement);
- gridftpDataMovementResourceIDs.add(gridftpDataMovementResource.getDataMovementInterfaceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Gridftp Data Movement Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Gridftp Data Movement Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gridftpDataMovementResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GridftpDataMovement existingGridftpDataMovement = em.find(GridftpDataMovement.class, dataMovementInterfaceId);
- em.close();
- GridftpDataMovement gridftpDataMovement;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingGridftpDataMovement == null) {
- gridftpDataMovement = new GridftpDataMovement();
- gridftpDataMovement.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- gridftpDataMovement = existingGridftpDataMovement;
- gridftpDataMovement.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- gridftpDataMovement.setDataMovementInterfaceId(getDataMovementInterfaceId());
- gridftpDataMovement.setSecurityProtocol(getSecurityProtocol());
- if (existingGridftpDataMovement == null) {
- em.persist(gridftpDataMovement);
- } else {
- em.merge(gridftpDataMovement);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GridftpDataMovement gridftpDataMovement = em.find(GridftpDataMovement.class, identifier);
- em.close();
- return gridftpDataMovement != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol=securityProtocol;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpEndpointResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpEndpointResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpEndpointResource.java
deleted file mode 100644
index f484568..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GridftpEndpointResource.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.aiaravata.application.catalog.data.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.GridftpDataMovement;
-import org.apache.aiaravata.application.catalog.data.model.GridftpEndpoint;
-import org.apache.aiaravata.application.catalog.data.model.GridftpEndpoint_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GridftpEndpointResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(GridftpEndpointResource.class);
- private String endpoint;
- private String dataMovementInterfaceId;
- private GridftpDataMovementResource gridftpDataMovementResource;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_ENDPOINT);
- generator.setParameter(GridftpEndpointConstants.ENDPOINT, ids.get(GridftpEndpointConstants.ENDPOINT));
- generator.setParameter(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID));
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_ENDPOINT);
- generator.setParameter(GridftpEndpointConstants.ENDPOINT, ids.get(GridftpEndpointConstants.ENDPOINT));
- generator.setParameter(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID));
- Query q = generator.selectQuery(em);
- GridftpEndpoint gridftpEndpoint = (GridftpEndpoint) q.getSingleResult();
- GridftpEndpointResource gridftpEndpointResource = (GridftpEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_ENDPOINT, gridftpEndpoint);
- em.getTransaction().commit();
- em.close();
- return gridftpEndpointResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> gridftpEndpointResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_ENDPOINT);
- Query q;
- if ((fieldName.equals(GridftpEndpointConstants.ENDPOINT)) || (fieldName.equals(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- GridftpEndpoint gridftpEndpoint = (GridftpEndpoint) result;
- GridftpEndpointResource gridftpEndpointResource = (GridftpEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_ENDPOINT, gridftpEndpoint);
- gridftpEndpointResources.add(gridftpEndpointResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Gridftp Endpoint Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Gridftp Endpoint Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gridftpEndpointResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> gridftpEndpointResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GRIDFTP_ENDPOINT);
- Query q;
- if ((fieldName.equals(GridftpEndpointConstants.ENDPOINT)) || (fieldName.equals(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- GridftpEndpoint gridftpEndpoint = (GridftpEndpoint) result;
- GridftpEndpointResource gridftpEndpointResource = (GridftpEndpointResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GRIDFTP_ENDPOINT, gridftpEndpoint);
- gridftpEndpointResourceIDs.add(gridftpEndpointResource.getDataMovementInterfaceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Gridftp Endpoint Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Gridftp Endpoint Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gridftpEndpointResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GridftpEndpoint existingGridftpEndpoint = em.find(GridftpEndpoint.class, new GridftpEndpoint_PK(endpoint, dataMovementInterfaceId));
- em.close();
- GridftpEndpoint gridftpEndpoint;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingGridftpEndpoint == null) {
- gridftpEndpoint = new GridftpEndpoint();
- gridftpEndpoint.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- gridftpEndpoint = existingGridftpEndpoint;
- gridftpEndpoint.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- gridftpEndpoint.setEndpoint(getEndpoint());
- gridftpEndpoint.setDataMovementInterfaceId(getDataMovementInterfaceId());
- GridftpDataMovement gridftpDataMovement = em.find(GridftpDataMovement.class, getDataMovementInterfaceId());
- gridftpEndpoint.setGridftpDataMovement(gridftpDataMovement);
- if (existingGridftpEndpoint == null) {
- em.persist(gridftpEndpoint);
- } else {
- em.merge(gridftpEndpoint);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GridftpEndpoint gridftpEndpoint = em.find(GridftpEndpoint.class, new GridftpEndpoint_PK(ids.get(GridftpEndpointConstants.ENDPOINT), ids.get(GridftpEndpointConstants.DATA_MOVEMENT_INTERFACE_ID)));
- em.close();
- return gridftpEndpoint != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getEndpoint() {
- return endpoint;
- }
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public GridftpDataMovementResource getGridftpDataMovementResource() {
- return gridftpDataMovementResource;
- }
-
- public void setEndpoint(String endpoint) {
- this.endpoint=endpoint;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-
- public void setGridftpDataMovementResource(GridftpDataMovementResource gridftpDataMovementResource) {
- this.gridftpDataMovementResource=gridftpDataMovementResource;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostAliasResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostAliasResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostAliasResource.java
deleted file mode 100644
index f267a72..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostAliasResource.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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.HostAlias;
-import org.apache.aiaravata.application.catalog.data.model.HostAliasPK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.*;
-
-public class HostAliasResource extends AbstractResource {
-
- private final static Logger logger = LoggerFactory.getLogger(HostAliasResource.class);
-
- private String resourceID;
- private String alias;
- private ComputeResourceResource computeHostResource;
-
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(HOST_ALIAS);
- generator.setParameter(HostAliasConstants.RESOURCE_ID, (String)identifier);
-// generator.setParameter(HostAliasConstants.ALIAS, ids.get(HostAliasConstants.ALIAS));
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_ALIAS);
- generator.setParameter(HostAliasConstants.RESOURCE_ID, ids.get(HostAliasConstants.RESOURCE_ID));
- generator.setParameter(HostAliasConstants.ALIAS, ids.get(HostAliasConstants.ALIAS));
- Query q = generator.selectQuery(em);
- HostAlias hostAlias = (HostAlias) q.getSingleResult();
- HostAliasResource hostAliasResource =
- (HostAliasResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_ALIAS, hostAlias);
- em.getTransaction().commit();
- em.close();
- return hostAliasResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
-
- List<Resource> hostAliasResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_ALIAS);
- List results;
- if (fieldName.equals(HostAliasConstants.ALIAS)) {
- generator.setParameter(HostAliasConstants.ALIAS, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- HostAlias hostAlias = (HostAlias) result;
- HostAliasResource hostAliasResource =
- (HostAliasResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_ALIAS, hostAlias);
- hostAliasResources.add(hostAliasResource);
- }
- }
- } else if (fieldName.equals(HostAliasConstants.RESOURCE_ID)) {
- generator.setParameter(HostAliasConstants.RESOURCE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- HostAlias hostAlias = (HostAlias) result;
- HostAliasResource hostAliasResource =
- (HostAliasResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_ALIAS, hostAlias);
- hostAliasResources.add(hostAliasResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Host Alias Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Host Alias Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return hostAliasResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-
- List<String> hostAliasResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_ALIAS);
- List results;
- if (fieldName.equals(HostAliasConstants.ALIAS)) {
- generator.setParameter(HostAliasConstants.ALIAS, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- HostAlias hostAlias = (HostAlias) result;
- hostAliasResourceIDs.add(hostAlias.getResourceID());
- }
- }
- } else if (fieldName.equals(HostAliasConstants.RESOURCE_ID)) {
- generator.setParameter(HostAliasConstants.RESOURCE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- HostAlias hostAlias = (HostAlias) result;
- hostAliasResourceIDs.add(hostAlias.getResourceID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Host Alias resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Host Alias Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return hostAliasResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- HostAlias existingHostAlias = em.find(HostAlias.class, new HostAliasPK(resourceID, alias));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
- if (existingHostAlias != null){
- existingHostAlias.setAlias(alias);
- existingHostAlias.setComputeResource(computeResource);
- existingHostAlias.setResourceID(resourceID);
- em.merge(existingHostAlias);
- }else {
- HostAlias hostAlias = new HostAlias();
- hostAlias.setAlias(alias);
- hostAlias.setResourceID(resourceID);
- hostAlias.setComputeResource(computeResource);
-
- em.persist(hostAlias);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
-
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- HostAlias hostAlias = em.find(HostAlias.class, new HostAliasPK(ids.get(HostAliasConstants.RESOURCE_ID),
- ids.get(HostAliasConstants.ALIAS)));
-
- em.close();
- return hostAlias != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
- }
-
- public String getResourceID() {
- return resourceID;
- }
-
- public void setResourceID(String resourceID) {
- this.resourceID = resourceID;
- }
-
- public String getAlias() {
- return alias;
- }
-
- public void setAlias(String alias) {
- this.alias = alias;
- }
-
- public ComputeResourceResource getComputeHostResource() {
- return computeHostResource;
- }
-
- public void setComputeHostResource(ComputeResourceResource computeHostResource) {
- this.computeHostResource = computeHostResource;
- }
-}
[05/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/TaskDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/TaskDetailResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/TaskDetailResource.java
deleted file mode 100644
index 5144fe2..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/UserResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/UserResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/UserResource.java
deleted file mode 100644
index 5fc7f71..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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;
- }
-}
[04/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/Utils.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/Utils.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/Utils.java
deleted file mode 100644
index 451fc5c..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/Utils.java
+++ /dev/null
@@ -1,1011 +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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/WorkerResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/WorkerResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/WorkerResource.java
deleted file mode 100644
index 6b4a6a5..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/WorkerResource.java
+++ /dev/null
@@ -1,725 +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.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 = "SELECT e, s FROM Experiment e " +
- ",Status s WHERE e.expId=s.expId AND " +
- "s.statusType='" + StatusType.EXPERIMENT + "' AND ";
- if(filters.get(StatusConstants.STATE) != null) {
- String experimentState = ExperimentState.valueOf(filters.get(StatusConstants.STATE)).toString();
- query += "s.state='" + experimentState + "' AND ";
- }
-
- 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) ((Object[])o)[0];
- Status experimentStatus = (Status) ((Object[])o)[1];
- experiment.setExperimentStatus(experimentStatus);
- 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;
- }
-}
[19/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationOutputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationOutputResource.java
deleted file mode 100644
index feac711..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ApplicationOutputResource.java
+++ /dev/null
@@ -1,432 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.AppOutput_PK;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationInterface;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationOutput;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ApplicationOutputResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ApplicationOutputResource.class);
-
- private String interfaceID;
- private String outputKey;
- private String outputVal;
- private String dataType;
- private boolean isRequired;
- private boolean dataMovement;
- private String dataNameLocation;
- private boolean requiredToCMD;
- private String searchQuery;
- private String appArgument;
-
- private AppInterfaceResource appInterfaceResource;
-
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_OUTPUT);
- generator.setParameter(AppOutputConstants.INTERFACE_ID, ids.get(AppOutputConstants.INTERFACE_ID));
- if (ids.get(AppOutputConstants.OUTPUT_KEY) != null){
- generator.setParameter(AppOutputConstants.OUTPUT_KEY, ids.get(AppOutputConstants.OUTPUT_KEY));
- }
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_OUTPUT);
- generator.setParameter(AppOutputConstants.INTERFACE_ID, ids.get(AppOutputConstants.INTERFACE_ID));
- generator.setParameter(AppOutputConstants.OUTPUT_KEY, ids.get(AppOutputConstants.OUTPUT_KEY));
- Query q = generator.selectQuery(em);
- ApplicationOutput applicationOutput = (ApplicationOutput) q.getSingleResult();
- ApplicationOutputResource applicationOutputResource =
- (ApplicationOutputResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.APPLICATION_OUTPUT
- , applicationOutput);
- em.getTransaction().commit();
- em.close();
- return applicationOutputResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> appInputResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_OUTPUT);
- List results;
- if (fieldName.equals(AppOutputConstants.INTERFACE_ID)) {
- generator.setParameter(AppOutputConstants.INTERFACE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationOutput applicationOutput = (ApplicationOutput) result;
- ApplicationOutputResource applicationOutputResource =
- (ApplicationOutputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.APPLICATION_OUTPUT, applicationOutput);
- appInputResources.add(applicationOutputResource);
- }
- }
- } else if (fieldName.equals(AppOutputConstants.OUTPUT_KEY)) {
- generator.setParameter(AppOutputConstants.OUTPUT_KEY, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationOutput applicationOutput = (ApplicationOutput) result;
- ApplicationOutputResource applicationOutputResource =
- (ApplicationOutputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.APPLICATION_OUTPUT, applicationOutput);
- appInputResources.add(applicationOutputResource);
- }
- }
- } else if (fieldName.equals(AppOutputConstants.DATA_TYPE)) {
- generator.setParameter(AppOutputConstants.DATA_TYPE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationOutput applicationOutput = (ApplicationOutput) result;
- ApplicationOutputResource applicationOutputResource =
- (ApplicationOutputResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.APPLICATION_OUTPUT, applicationOutput);
- appInputResources.add(applicationOutputResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for App Output Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for App Output Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return appInputResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> appOutputResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_OUTPUT);
- List results;
- if (fieldName.equals(AppOutputConstants.INTERFACE_ID)) {
- generator.setParameter(AppOutputConstants.INTERFACE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationOutput applicationOutput = (ApplicationOutput) result;
- appOutputResourceIDs.add(applicationOutput.getInterfaceID());
- }
- }
- }
- if (fieldName.equals(AppOutputConstants.OUTPUT_KEY)) {
- generator.setParameter(AppOutputConstants.OUTPUT_KEY, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationOutput applicationOutput = (ApplicationOutput) result;
- appOutputResourceIDs.add(applicationOutput.getInterfaceID());
- }
- }
- } else if (fieldName.equals(AppOutputConstants.DATA_TYPE)) {
- generator.setParameter(AppOutputConstants.DATA_TYPE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ApplicationOutput applicationOutput = (ApplicationOutput) result;
- appOutputResourceIDs.add(applicationOutput.getInterfaceID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for App Output resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for App Output Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return appOutputResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationOutput existingApplicationOutput = em.find(ApplicationOutput.class,
- new AppOutput_PK(interfaceID, outputKey));
- em.close();
-
- ApplicationOutput applicationOutput;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingApplicationOutput == null) {
- applicationOutput = new ApplicationOutput();
- } else {
- applicationOutput = existingApplicationOutput;
- }
- ApplicationInterface applicationInterface = em.find(ApplicationInterface.class, interfaceID);
- applicationOutput.setApplicationInterface(applicationInterface);
- applicationOutput.setInterfaceID(applicationInterface.getInterfaceID());
- applicationOutput.setDataType(dataType);
- applicationOutput.setOutputKey(outputKey);
- applicationOutput.setOutputVal(outputVal);
- applicationOutput.setRequired(isRequired);
- applicationOutput.setRequiredToCMD(requiredToCMD);
- applicationOutput.setDataMovement(dataMovement);
- applicationOutput.setDataNameLocation(dataNameLocation);
- applicationOutput.setSearchQuery(searchQuery);
- applicationOutput.setApplicationArgument(appArgument);
- em.merge(applicationOutput);
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ApplicationOutput applicationOutput = em.find(ApplicationOutput.class, new AppOutput_PK(
- ids.get(AppOutputConstants.INTERFACE_ID),
- ids.get(AppOutputConstants.OUTPUT_KEY)));
-
- em.close();
- return applicationOutput != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getInterfaceID() {
- return interfaceID;
- }
-
- public void setInterfaceID(String interfaceID) {
- this.interfaceID = interfaceID;
- }
-
- public String getOutputKey() {
- return outputKey;
- }
-
- public void setOutputKey(String outputKey) {
- this.outputKey = outputKey;
- }
-
- public String getOutputVal() {
- return outputVal;
- }
-
- public void setOutputVal(String outputVal) {
- this.outputVal = outputVal;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public AppInterfaceResource getAppInterfaceResource() {
- return appInterfaceResource;
- }
-
- public void setAppInterfaceResource(AppInterfaceResource appInterfaceResource) {
- this.appInterfaceResource = appInterfaceResource;
- }
-
- 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 boolean getRequiredToCMD() {
- return requiredToCMD;
- }
-
- public void setRequiredToCMD(boolean requiredToCMD) {
- this.requiredToCMD = requiredToCMD;
- }
-
- 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;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/BatchQueueResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/BatchQueueResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/BatchQueueResource.java
deleted file mode 100644
index e7f5bff..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/BatchQueueResource.java
+++ /dev/null
@@ -1,357 +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.aiaravata.application.catalog.data.resources;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.BatchQueue;
-import org.apache.aiaravata.application.catalog.data.model.BatchQueue_PK;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class BatchQueueResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(BatchQueueResource.class);
- private String computeResourceId;
- private ComputeResourceResource computeHostResource;
- private int maxRuntime;
- private int maxJobInQueue;
- private String queueDescription;
- private String queueName;
- private int maxProcessors;
- private int maxNodes;
- private int maxMemory;
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(BATCH_QUEUE);
- generator.setParameter(BatchQueueConstants.COMPUTE_RESOURCE_ID, ids.get(BatchQueueConstants.COMPUTE_RESOURCE_ID));
- generator.setParameter(BatchQueueConstants.QUEUE_NAME, ids.get(BatchQueueConstants.QUEUE_NAME));
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(BATCH_QUEUE);
- generator.setParameter(BatchQueueConstants.COMPUTE_RESOURCE_ID, ids.get(BatchQueueConstants.COMPUTE_RESOURCE_ID));
- generator.setParameter(BatchQueueConstants.QUEUE_NAME, ids.get(BatchQueueConstants.QUEUE_NAME));
- Query q = generator.selectQuery(em);
- BatchQueue batchQueue = (BatchQueue) q.getSingleResult();
- BatchQueueResource batchQueueResource = (BatchQueueResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.BATCH_QUEUE, batchQueue);
- em.getTransaction().commit();
- em.close();
- return batchQueueResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> batchQueueResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(BATCH_QUEUE);
- Query q;
- if ((fieldName.equals(BatchQueueConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(BatchQueueConstants.MAX_RUNTIME)) || (fieldName.equals(BatchQueueConstants.MAX_JOB_IN_QUEUE)) || (fieldName.equals(BatchQueueConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(BatchQueueConstants.QUEUE_NAME)) || (fieldName.equals(BatchQueueConstants.MAX_PROCESSORS)) || (fieldName.equals(BatchQueueConstants.MAX_NODES))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- BatchQueue batchQueue = (BatchQueue) result;
- BatchQueueResource batchQueueResource = (BatchQueueResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.BATCH_QUEUE, batchQueue);
- batchQueueResources.add(batchQueueResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Batch Queue Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Batch Queue Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return batchQueueResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> batchQueueResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(BATCH_QUEUE);
- Query q;
- if ((fieldName.equals(BatchQueueConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(BatchQueueConstants.MAX_RUNTIME)) || (fieldName.equals(BatchQueueConstants.MAX_JOB_IN_QUEUE)) || (fieldName.equals(BatchQueueConstants.QUEUE_DESCRIPTION)) || (fieldName.equals(BatchQueueConstants.QUEUE_NAME)) || (fieldName.equals(BatchQueueConstants.MAX_PROCESSORS)) || (fieldName.equals(BatchQueueConstants.MAX_NODES))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- BatchQueue batchQueue = (BatchQueue) result;
- BatchQueueResource batchQueueResource = (BatchQueueResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.BATCH_QUEUE, batchQueue);
- batchQueueResourceIDs.add(batchQueueResource.getComputeResourceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Batch Queue Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Batch Queue Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return batchQueueResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- BatchQueue existingBatchQueue = em.find(BatchQueue.class, new BatchQueue_PK(computeResourceId, queueName));
- em.close();
- BatchQueue batchQueue;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingBatchQueue == null) {
- batchQueue = new BatchQueue();
- } else {
- batchQueue = existingBatchQueue;
- }
- batchQueue.setComputeResourceId(getComputeResourceId());
- ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
- batchQueue.setComputeResource(computeResource);
- batchQueue.setMaxRuntime(getMaxRuntime());
- batchQueue.setMaxJobInQueue(getMaxJobInQueue());
- batchQueue.setQueueDescription(getQueueDescription());
- batchQueue.setQueueName(getQueueName());
- batchQueue.setMaxProcessors(getMaxProcessors());
- batchQueue.setMaxNodes(getMaxNodes());
- batchQueue.setMaxMemory(getMaxMemory());
- if (existingBatchQueue == null) {
- em.persist(batchQueue);
- } else {
- em.merge(batchQueue);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- BatchQueue batchQueue = em.find(BatchQueue.class, new BatchQueue_PK(ids.get(BatchQueueConstants.COMPUTE_RESOURCE_ID), ids.get(BatchQueueConstants.QUEUE_NAME)));
- em.close();
- return batchQueue != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getComputeResourceId() {
- return computeResourceId;
- }
-
- public ComputeResourceResource getComputeHostResource() {
- return computeHostResource;
- }
-
- public int getMaxRuntime() {
- return maxRuntime;
- }
-
- public int getMaxJobInQueue() {
- return maxJobInQueue;
- }
-
- public String getQueueDescription() {
- return queueDescription;
- }
-
- public String getQueueName() {
- return queueName;
- }
-
- public int getMaxProcessors() {
- return maxProcessors;
- }
-
- public int getMaxNodes() {
- return maxNodes;
- }
-
- public void setComputeResourceId(String computeResourceId) {
- this.computeResourceId=computeResourceId;
- }
-
- public void setComputeHostResource(ComputeResourceResource computeHostResource) {
- this.computeHostResource=computeHostResource;
- }
-
- public void setMaxRuntime(int maxRuntime) {
- this.maxRuntime=maxRuntime;
- }
-
- public void setMaxJobInQueue(int maxJobInQueue) {
- this.maxJobInQueue=maxJobInQueue;
- }
-
- public void setQueueDescription(String queueDescription) {
- this.queueDescription=queueDescription;
- }
-
- public void setQueueName(String queueName) {
- this.queueName=queueName;
- }
-
- public void setMaxProcessors(int maxProcessors) {
- this.maxProcessors=maxProcessors;
- }
-
- public void setMaxNodes(int maxNodes) {
- this.maxNodes=maxNodes;
- }
-
- public int getMaxMemory() {
- return maxMemory;
- }
-
- public void setMaxMemory(int maxMemory) {
- this.maxMemory = maxMemory;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/CloudSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/CloudSubmissionResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/CloudSubmissionResource.java
deleted file mode 100644
index de55ca8..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/CloudSubmissionResource.java
+++ /dev/null
@@ -1,298 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.CloudJobSubmission;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.List;
-
-public class CloudSubmissionResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(LocalSubmissionResource.class);
- private String jobSubmissionInterfaceId;
- private String securityProtocol;
- private String nodeId;
- private String executableType;
- private String providerName;
- private String userAccountName;
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(CLOUD_JOB_SUBMISSION);
- generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(CLOUD_JOB_SUBMISSION);
- generator.setParameter(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID, identifier);
- Query q = generator.selectQuery(em);
- CloudJobSubmission cloudJobSubmission = (CloudJobSubmission) q.getSingleResult();
- CloudSubmissionResource localSubmissionResource = (CloudSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.ClOUD_SUBMISSION, cloudJobSubmission);
- em.getTransaction().commit();
- em.close();
- return localSubmissionResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> localSubmissionResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(CLOUD_JOB_SUBMISSION);
- Query q;
- if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- CloudJobSubmission localSubmission = (CloudJobSubmission) result;
- CloudSubmissionResource localSubmissionResource = (CloudSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.ClOUD_SUBMISSION, localSubmission);
- localSubmissionResources.add(localSubmissionResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return localSubmissionResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> localSubmissionResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(CLOUD_JOB_SUBMISSION);
- Query q;
- if ((fieldName.equals(LocalSubmissionConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(LocalSubmissionConstants.JOB_SUBMISSION_INTERFACE_ID))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- CloudJobSubmission localSubmission = (CloudJobSubmission) result;
- LocalSubmissionResource localSubmissionResource = (LocalSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.ClOUD_SUBMISSION, localSubmission);
- localSubmissionResourceIDs.add(localSubmissionResource.getJobSubmissionInterfaceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Local Submission Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Local Submission Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return localSubmissionResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- CloudJobSubmission existingLocalSubmission = em.find(CloudJobSubmission.class, jobSubmissionInterfaceId);
- em.close();
- CloudJobSubmission cloudJobSubmission;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingLocalSubmission == null) {
- cloudJobSubmission = new CloudJobSubmission();
- } else {
- cloudJobSubmission = existingLocalSubmission;
- }
- cloudJobSubmission.setExecutableType(getExecutableType());
- cloudJobSubmission.setNodeId(getNodeId());
- cloudJobSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
- cloudJobSubmission.setSecurityProtocol(getSecurityProtocol());
- cloudJobSubmission.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
- cloudJobSubmission.setUserAccountName(getUserAccountName());
- cloudJobSubmission.setProviderName(getProviderName());
- if (existingLocalSubmission == null) {
- em.persist(cloudJobSubmission);
- } else {
- em.merge(cloudJobSubmission);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- CloudJobSubmission localSubmission = em.find(CloudJobSubmission.class, identifier);
- em.close();
- return localSubmission != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getJobSubmissionInterfaceId() {
- return jobSubmissionInterfaceId;
- }
-
- public String getSecurityProtocol() {
- return securityProtocol;
- }
-
- public void setSecurityProtocol(String securityProtocol) {
- this.securityProtocol = securityProtocol;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getExecutableType() {
- return executableType;
- }
-
- public void setExecutableType(String executableType) {
- this.executableType = executableType;
- }
-
- public String getProviderName() {
- return providerName;
- }
-
- public void setProviderName(String providerName) {
- this.providerName = providerName;
- }
-
- public String getUserAccountName() {
- return userAccountName;
- }
-
- public void setUserAccountName(String userAccountName) {
- this.userAccountName = userAccountName;
- }
-
- public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
- this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceResource.java
deleted file mode 100644
index 51f22d5..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceResource.java
+++ /dev/null
@@ -1,413 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResourcePreference;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResourcePreferencePK;
-import org.apache.aiaravata.application.catalog.data.model.GatewayProfile;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ComputeHostPreferenceResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ComputeHostPreferenceResource.class);
- private String gatewayId;
- private String resourceId;
- private boolean overrideByAiravata;
- private String preferredJobProtocol;
- private String preferedDMProtocol;
- private String batchQueue;
- private String scratchLocation;
- private String projectNumber;
- private String loginUserName;
-
- private GatewayProfileResource gatewayProfile;
- private ComputeResourceResource computeHostResource;
-
- public String getLoginUserName() {
- return loginUserName;
- }
-
- public void setLoginUserName(String loginUserName) {
- this.loginUserName = loginUserName;
- }
-
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- public String getResourceId() {
- return resourceId;
- }
-
- public void setResourceId(String resourceId) {
- this.resourceId = resourceId;
- }
-
- public boolean getOverrideByAiravata() {
- return overrideByAiravata;
- }
-
- public void setOverrideByAiravata(boolean overrideByAiravata) {
- this.overrideByAiravata = overrideByAiravata;
- }
-
- public String getPreferredJobProtocol() {
- return preferredJobProtocol;
- }
-
- public void setPreferredJobProtocol(String preferredJobProtocol) {
- this.preferredJobProtocol = preferredJobProtocol;
- }
-
- public String getPreferedDMProtocol() {
- return preferedDMProtocol;
- }
-
- public void setPreferedDMProtocol(String preferedDMProtocol) {
- this.preferedDMProtocol = preferedDMProtocol;
- }
-
- public String getBatchQueue() {
- return batchQueue;
- }
-
- public void setBatchQueue(String batchQueue) {
- this.batchQueue = batchQueue;
- }
-
- public String getScratchLocation() {
- return scratchLocation;
- }
-
- public void setScratchLocation(String scratchLocation) {
- this.scratchLocation = scratchLocation;
- }
-
- public String getProjectNumber() {
- return projectNumber;
- }
-
- public void setProjectNumber(String projectNumber) {
- this.projectNumber = projectNumber;
- }
-
- public GatewayProfileResource getGatewayProfile() {
- return gatewayProfile;
- }
-
- public void setGatewayProfile(GatewayProfileResource gatewayProfile) {
- this.gatewayProfile = gatewayProfile;
- }
-
- public ComputeResourceResource getComputeHostResource() {
- return computeHostResource;
- }
-
- public void setComputeHostResource(ComputeResourceResource computeHostResource) {
- this.computeHostResource = computeHostResource;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_PREFERENCE);
- generator.setParameter(ComputeResourcePreferenceConstants.RESOURCE_ID, ids.get(ComputeResourcePreferenceConstants.RESOURCE_ID));
- generator.setParameter(ComputeResourcePreferenceConstants.GATEWAY_ID, ids.get(ComputeResourcePreferenceConstants.GATEWAY_ID));
-
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_PREFERENCE);
- generator.setParameter(ComputeResourcePreferenceConstants.GATEWAY_ID, ids.get(ComputeResourcePreferenceConstants.GATEWAY_ID));
- generator.setParameter(ComputeResourcePreferenceConstants.RESOURCE_ID, ids.get(ComputeResourcePreferenceConstants.RESOURCE_ID));
- Query q = generator.selectQuery(em);
- ComputeResourcePreference preference = (ComputeResourcePreference) q.getSingleResult();
- ComputeHostPreferenceResource preferenceResource =
- (ComputeHostPreferenceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE, preference);
- em.getTransaction().commit();
- em.close();
- return preferenceResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> preferenceResourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_PREFERENCE);
- List results;
- if (fieldName.equals(ComputeResourcePreferenceConstants.RESOURCE_ID)) {
- generator.setParameter(ComputeResourcePreferenceConstants.RESOURCE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ComputeResourcePreference preference = (ComputeResourcePreference) result;
- if (preference.getComputeHostResource()!=null) {
- ComputeHostPreferenceResource preferenceResource = (ComputeHostPreferenceResource) AppCatalogJPAUtils
- .getResource(
- AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE,
- preference);
- preferenceResourceList.add(preferenceResource);
- }
- }
- }
- } else if (fieldName.equals(ComputeResourcePreferenceConstants.GATEWAY_ID)) {
- generator.setParameter(ComputeResourcePreferenceConstants.GATEWAY_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ComputeResourcePreference preference = (ComputeResourcePreference) result;
- if (preference.getComputeHostResource()!=null) {
- ComputeHostPreferenceResource preferenceResource =
- (ComputeHostPreferenceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE, preference);
- preferenceResourceList.add(preferenceResource);
- }
- }
- }
- } else if (fieldName.equals(ComputeResourcePreferenceConstants.PREFERED_JOB_SUB_PROTOCOL)) {
- generator.setParameter(ComputeResourcePreferenceConstants.PREFERED_JOB_SUB_PROTOCOL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ComputeResourcePreference preference = (ComputeResourcePreference) result;
- if (preference.getComputeHostResource()!=null) {
- ComputeHostPreferenceResource preferenceResource = (ComputeHostPreferenceResource) AppCatalogJPAUtils
- .getResource(
- AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE,
- preference);
- preferenceResourceList.add(preferenceResource);
- }
- }
- }
- } else if (fieldName.equals(ComputeResourcePreferenceConstants.PREFERED_DATA_MOVE_PROTOCOL)) {
- generator.setParameter(ComputeResourcePreferenceConstants.PREFERED_DATA_MOVE_PROTOCOL, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- ComputeResourcePreference preference = (ComputeResourcePreference) result;
- if (preference.getResourceId()!=null) {
- ComputeHostPreferenceResource preferenceResource = (ComputeHostPreferenceResource) AppCatalogJPAUtils
- .getResource(
- AppCatalogResourceType.COMPUTE_RESOURCE_PREFERENCE,
- preference);
- preferenceResourceList.add(preferenceResource);
- }
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Compute host preference Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Compute host preference Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return preferenceResourceList;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- logger.error("Unsupported for objects with a composite identifier");
- throw new AppCatalogException("Unsupported for objects with a composite identifier");
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ComputeResourcePreference existingPreference = em.find(ComputeResourcePreference.class, new ComputeResourcePreferencePK(gatewayId, resourceId));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- ComputeResource computeResource = em.find(ComputeResource.class, resourceId);
- GatewayProfile gatewayProf = em.find(GatewayProfile.class, gatewayId);
- if (existingPreference != null) {
- existingPreference.setResourceId(resourceId);
- existingPreference.setGatewayId(gatewayId);
- existingPreference.setComputeHostResource(computeResource);
- existingPreference.setGatewayProfile(gatewayProf);
- existingPreference.setOverrideByAiravata(overrideByAiravata);
- existingPreference.setPreferedJobSubmissionProtocol(preferredJobProtocol);
- existingPreference.setPreferedDataMoveProtocol(preferedDMProtocol);
- existingPreference.setScratchLocation(scratchLocation);
- existingPreference.setProjectNumber(projectNumber);
- existingPreference.setBatchQueue(batchQueue);
- existingPreference.setLoginUserName(loginUserName);
- em.merge(existingPreference);
- } else {
- ComputeResourcePreference resourcePreference = new ComputeResourcePreference();
- resourcePreference.setResourceId(resourceId);
- resourcePreference.setGatewayId(gatewayId);
- resourcePreference.setComputeHostResource(computeResource);
- resourcePreference.setGatewayProfile(gatewayProf);
- resourcePreference.setOverrideByAiravata(overrideByAiravata);
- resourcePreference.setPreferedJobSubmissionProtocol(preferredJobProtocol);
- resourcePreference.setPreferedDataMoveProtocol(preferedDMProtocol);
- resourcePreference.setScratchLocation(scratchLocation);
- resourcePreference.setProjectNumber(projectNumber);
- resourcePreference.setBatchQueue(batchQueue);
- resourcePreference.setLoginUserName(loginUserName);
- em.persist(resourcePreference);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ComputeResourcePreference existingPreference = em.find(ComputeResourcePreference.class,
- new ComputeResourcePreferencePK(ids.get(ComputeResourcePreferenceConstants.GATEWAY_ID),
- ids.get(ComputeResourcePreferenceConstants.RESOURCE_ID)));
- em.close();
- return existingPreference != null;
- }catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemResource.java
deleted file mode 100644
index 7cbaac2..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceFileSystemResource.java
+++ /dev/null
@@ -1,307 +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.aiaravata.application.catalog.data.resources;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResourceFileSystem;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResourceFileSystem_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ComputeResourceFileSystemResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ComputeResourceFileSystemResource.class);
- private String computeResourceId;
- private ComputeResourceResource computeHostResource;
- private String path;
- private String fileSystem;
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
- generator.setParameter(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID));
- generator.setParameter(ComputeResourceFileSystemConstants.FILE_SYSTEM, ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM));
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
- generator.setParameter(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID));
- generator.setParameter(ComputeResourceFileSystemConstants.FILE_SYSTEM, ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM));
- Query q = generator.selectQuery(em);
- ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) q.getSingleResult();
- ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
- em.getTransaction().commit();
- em.close();
- return computeResourceFileSystemResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> computeResourceFileSystemResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
- Query q;
- if ((fieldName.equals(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(ComputeResourceFileSystemConstants.PATH)) || (fieldName.equals(ComputeResourceFileSystemConstants.FILE_SYSTEM))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) result;
- ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
- computeResourceFileSystemResources.add(computeResourceFileSystemResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Compute Resource File System Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Compute Resource File System Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return computeResourceFileSystemResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> computeResourceFileSystemResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE_FILE_SYSTEM);
- Query q;
- if ((fieldName.equals(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(ComputeResourceFileSystemConstants.PATH)) || (fieldName.equals(ComputeResourceFileSystemConstants.FILE_SYSTEM))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ComputeResourceFileSystem computeResourceFileSystem = (ComputeResourceFileSystem) result;
- ComputeResourceFileSystemResource computeResourceFileSystemResource = (ComputeResourceFileSystemResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE_FILE_SYSTEM, computeResourceFileSystem);
- computeResourceFileSystemResourceIDs.add(computeResourceFileSystemResource.getComputeResourceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Compute Resource File System Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Compute Resource File System Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return computeResourceFileSystemResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ComputeResourceFileSystem existingComputeResourceFileSystem = em.find(ComputeResourceFileSystem.class, new ComputeResourceFileSystem_PK(computeResourceId, fileSystem));
- em.close();
- ComputeResourceFileSystem computeResourceFileSystem;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingComputeResourceFileSystem == null) {
- computeResourceFileSystem = new ComputeResourceFileSystem();
- } else {
- computeResourceFileSystem = existingComputeResourceFileSystem;
- }
- computeResourceFileSystem.setComputeResourceId(getComputeResourceId());
- ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
- computeResourceFileSystem.setComputeResource(computeResource);
- computeResourceFileSystem.setPath(getPath());
- computeResourceFileSystem.setFileSystem(getFileSystem());
- if (existingComputeResourceFileSystem == null) {
- em.persist(computeResourceFileSystem);
- } else {
- em.merge(computeResourceFileSystem);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ComputeResourceFileSystem computeResourceFileSystem = em.find(ComputeResourceFileSystem.class, new ComputeResourceFileSystem_PK(ids.get(ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID), ids.get(ComputeResourceFileSystemConstants.FILE_SYSTEM)));
- em.close();
- return computeResourceFileSystem != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getComputeResourceId() {
- return computeResourceId;
- }
-
- public ComputeResourceResource getComputeHostResource() {
- return computeHostResource;
- }
-
- public String getPath() {
- return path;
- }
-
- public String getFileSystem() {
- return fileSystem;
- }
-
- public void setComputeResourceId(String computeResourceId) {
- this.computeResourceId=computeResourceId;
- }
-
- public void setComputeHostResource(ComputeResourceResource computeHostResource) {
- this.computeHostResource=computeHostResource;
- }
-
- public void setPath(String path) {
- this.path=path;
- }
-
- public void setFileSystem(String fileSystem) {
- this.fileSystem=fileSystem;
- }
-}
[07/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ExperimentInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ExperimentInputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ExperimentInputResource.java
deleted file mode 100644
index edd487b..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ExperimentInputResource.java
+++ /dev/null
@@ -1,225 +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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ExperimentOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ExperimentOutputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ExperimentOutputResource.java
deleted file mode 100644
index 6a11adc..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ExperimentOutputResource.java
+++ /dev/null
@@ -1,204 +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.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();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ExperimentResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ExperimentResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ExperimentResource.java
deleted file mode 100644
index 82c2c2b..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ExperimentSummaryResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ExperimentSummaryResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ExperimentSummaryResource.java
deleted file mode 100644
index 63d4e51..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/GatewayResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/GatewayResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/GatewayResource.java
deleted file mode 100644
index 90c3062..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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;
- }
-}
-
[22/22] airavata git commit: Merge branch 'moduleRefactor'
Posted by ch...@apache.org.
Merge branch 'moduleRefactor'
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/093643ac
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/093643ac
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/093643ac
Branch: refs/heads/master
Commit: 093643ac3e090faafb1620ed71fcbe47d548fd1a
Parents: 13c2e79 5a648a6
Author: Chathuri Wimalasena <ch...@apache.org>
Authored: Fri Jun 5 11:02:41 2015 -0400
Committer: Chathuri Wimalasena <ch...@apache.org>
Committed: Fri Jun 5 11:02:41 2015 -0400
----------------------------------------------------------------------
airavata-api/airavata-api-server/pom.xml | 2 +-
.../server/handler/AiravataServerHandler.java | 4 +-
.../client_samples/createExperiment.cpp | 4 +-
.../resources/client_samples/createProject.cpp | 4 +-
.../client_samples/getExperimentOutputs.cpp | 4 +-
.../client_samples/getExperimentStatus.cpp | 4 +-
.../client_samples/launchExperiment.cpp | 4 +-
.../lib/apache/airavata/api/Airavata.py | 8 +-
.../airavata-api/airavataAPI.thrift | 4 +-
.../airavata-api/experimentModel.thrift | 2 +-
.../main/resources/airavata-client.properties | 14 +-
modules/gfac/gfac-core/pom.xml | 2 +-
.../services/impl/BigRed2TestWithSSHAuth.java | 2 +-
.../impl/GSISSHProviderTestWithMyProxyAuth.java | 2 +-
.../gfac/services/impl/LocalProviderTest.java | 2 +-
modules/gfac/gfac-service/pom.xml | 2 +-
modules/integration-tests/pom.xml | 2 +-
modules/orchestrator/orchestrator-core/pom.xml | 2 +-
.../orchestrator/core/ValidatorTest.java | 2 +-
.../app/catalog/model/DataMovementProtocol.java | 76 -
.../catalog/model/DataMovementProtocolPK.java | 74 -
.../catalog/model/JobSubmissionProtocol.java | 77 -
.../catalog/model/JobSubmissionProtocolPK.java | 74 -
.../app/catalog/resources/AbstractResource.java | 382 ---
.../resources/AppDeploymentResource.java | 446 ---
.../resources/AppEnvironmentResource.java | 293 --
.../catalog/resources/AppInterfaceResource.java | 363 ---
.../resources/AppModuleMappingResource.java | 317 --
.../catalog/resources/AppModuleResource.java | 344 --
.../resources/ApplicationInputResource.java | 454 ---
.../resources/ApplicationOutputResource.java | 432 ---
.../catalog/resources/BatchQueueResource.java | 357 ---
.../resources/CloudSubmissionResource.java | 298 --
.../ComputeHostPreferenceResource.java | 413 ---
.../ComputeResourceFileSystemResource.java | 307 --
.../resources/ComputeResourceResource.java | 351 ---
.../DataMovementInterfaceResource.java | 339 --
.../resources/DataMovementProtocolResource.java | 360 ---
.../catalog/resources/GSISSHExportResource.java | 324 --
.../resources/GSISSHSubmissionResource.java | 373 ---
.../resources/GatewayProfileResource.java | 318 --
.../resources/GlobusGKEndpointResource.java | 321 --
.../resources/GlobusJobSubmissionResource.java | 315 --
.../resources/GridftpDataMovementResource.java | 279 --
.../resources/GridftpEndpointResource.java | 317 --
.../catalog/resources/HostAliasResource.java | 317 --
.../resources/HostIPAddressResource.java | 318 --
.../resources/JobManagerCommandResource.java | 307 --
.../JobSubmissionInterfaceResource.java | 339 --
.../JobSubmissionProtocolResource.java | 359 ---
.../resources/LibraryApendPathResource.java | 292 --
.../resources/LibraryPrepandPathResource.java | 291 --
.../resources/LocalDataMovementResource.java | 249 --
.../resources/LocalSubmissionResource.java | 293 --
.../resources/ModuleLoadCmdResource.java | 300 --
.../resources/PostJobCommandResource.java | 333 --
.../resources/PreJobCommandResource.java | 333 --
.../core/app/catalog/resources/Resource.java | 89 -
.../resources/ResourceJobManagerResource.java | 301 --
.../resources/ScpDataMovementResource.java | 308 --
.../resources/SshJobSubmissionResource.java | 332 --
.../resources/UnicoreDataMovementResource.java | 255 --
.../resources/UnicoreJobSubmissionResource.java | 328 --
.../resources/WorkflowInputResource.java | 451 ---
.../resources/WorkflowOutputResource.java | 410 ---
.../app/catalog/resources/WorkflowResource.java | 382 ---
.../catalog/impl/ExperimentCatalogImpl.java | 2 +-
.../catalog/impl/ExperimentRegistry.java | 2 +-
.../catalog/impl/GatewayRegistry.java | 2 +-
.../impl/LoggingExperimentCatalogImpl.java | 2 +-
.../catalog/impl/ProjectRegistry.java | 2 +-
.../catalog/impl/RegistryFactory.java | 2 +-
.../core/experiment/catalog/impl/UserReg.java | 2 +-
.../core/experimet/catalog/JPAConstants.java | 33 -
.../core/experimet/catalog/Resource.java | 71 -
.../core/experimet/catalog/ResourceType.java | 50 -
.../core/experimet/catalog/ResourceUtils.java | 525 ---
.../catalog/impl/ExperimentCatalogImpl.java | 735 -----
.../catalog/impl/ExperimentRegistry.java | 2983 ------------------
.../experimet/catalog/impl/GatewayRegistry.java | 115 -
.../impl/LoggingExperimentCatalogImpl.java | 97 -
.../experimet/catalog/impl/ProjectRegistry.java | 303 --
.../experimet/catalog/impl/RegistryFactory.java | 80 -
.../core/experimet/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 -
.../experimet/catalog/model/Configuration.java | 80 -
.../catalog/model/Configuration_PK.java | 74 -
.../catalog/model/DataTransferDetail.java | 91 -
.../experimet/catalog/model/ErrorDetail.java | 176 --
.../experimet/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 -
.../core/experimet/catalog/model/Gateway.java | 76 -
.../experimet/catalog/model/Gateway_Worker.java | 82 -
.../catalog/model/Gateway_Worker_PK.java | 64 -
.../core/experimet/catalog/model/JobDetail.java | 135 -
.../experimet/catalog/model/JobDetails_PK.java | 64 -
.../core/experimet/catalog/model/NodeInput.java | 163 -
.../experimet/catalog/model/NodeInput_PK.java | 64 -
.../experimet/catalog/model/NodeOutput.java | 140 -
.../experimet/catalog/model/NodeOutput_PK.java | 64 -
.../catalog/model/Notification_Email.java | 81 -
.../core/experimet/catalog/model/Project.java | 125 -
.../experimet/catalog/model/ProjectUser.java | 81 -
.../experimet/catalog/model/ProjectUser_PK.java | 64 -
.../core/experimet/catalog/model/QosParam.java | 103 -
.../core/experimet/catalog/model/Status.java | 146 -
.../experimet/catalog/model/TaskDetail.java | 221 --
.../core/experimet/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 --
.../core/experimet/catalog/resources/Utils.java | 1011 ------
.../catalog/resources/WorkerResource.java | 725 -----
.../resources/WorkflowNodeDetailResource.java | 515 ---
.../experimet/catalog/utils/QueryGenerator.java | 128 -
.../utils/ThriftDataModelConversion.java | 686 ----
.../src/main/resources/META-INF/app-catalog.xml | 67 -
.../src/main/resources/META-INF/persistence.xml | 29 -
.../app/catalog/ComputeResourceTest.java | 297 --
.../catalog/AbstractResourceTest.java | 4 +-
.../catalog/ComputationalSchedulingTest.java | 2 +-
.../ConfigurationExperimentCatResourceTest.java | 2 +-
.../catalog/ConfigurationResourceTest.java | 58 -
.../catalog/ExecutionErrorResourceTest.java | 95 -
.../catalog/ExperimentCatalogUseCaseTest.java | 6 +-
.../catalog/ExperimentDataResourceTest.java | 107 -
.../ExperimentExperimentCatResourceTest.java | 2 +-
...xperimentInputExperimentCatResourceTest.java | 2 +-
.../catalog/ExperimentInputResourceTest.java | 75 -
.../catalog/ExperimentMetadataResourceTest.java | 87 -
...perimentOutputExperimentCatResourceTest.java | 2 +-
.../catalog/ExperimentOutputResourceTest.java | 76 -
.../catalog/ExperimentResourceTest.java | 77 -
.../catalog/GFacJobDataResourceTest.java | 77 -
.../catalog/GFacJobStatusResourceTest.java | 87 -
.../GatewayExperimentCatResourceTest.java | 2 +-
.../experiment/catalog/GatewayResourceTest.java | 120 -
.../catalog/GramDataResourceTest.java | 72 -
.../catalog/NodeDataResourceTest.java | 72 -
.../catalog/OrchestratorDataResourceTest.java | 69 -
.../TaskDetailExperimentCatResourceTest.java | 2 +-
.../catalog/TaskDetailResourceTest.java | 93 -
.../catalog/UserExperimentCatResourceTest.java | 2 +-
.../experiment/catalog/UserResourceTest.java | 54 -
.../experiment/catalog/WorkerResourceTest.java | 122 -
.../catalog/WorkflowDataResourceTest.java | 106 -
...flowNodeDetailExperimentCatResourceTest.java | 2 +-
.../catalog/WorkflowNodeDetailResourceTest.java | 85 -
.../experiment/catalog/util/Initialize.java | 2 +-
modules/workflow-model/workflow-engine/pom.xml | 2 +-
.../workflow/engine/WorkflowEngineImpl.java | 2 +-
.../engine/interpretor/WorkflowInterpreter.java | 2 +-
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 +-
samples/java-client/experiment/pom.xml | 2 +-
191 files changed, 70 insertions(+), 35522 deletions(-)
----------------------------------------------------------------------
[03/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/WorkflowNodeDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/WorkflowNodeDetailResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/WorkflowNodeDetailResource.java
deleted file mode 100644
index 47bd072..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/utils/QueryGenerator.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/utils/QueryGenerator.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/utils/QueryGenerator.java
deleted file mode 100644
index 2c6c219..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/utils/ThriftDataModelConversion.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/utils/ThriftDataModelConversion.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/utils/ThriftDataModelConversion.java
deleted file mode 100644
index 45acd3a..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/resources/META-INF/app-catalog.xml
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/resources/META-INF/app-catalog.xml b/modules/registry/registry-core/src/main/resources/META-INF/app-catalog.xml
deleted file mode 100644
index 5fa184d..0000000
--- a/modules/registry/registry-core/src/main/resources/META-INF/app-catalog.xml
+++ /dev/null
@@ -1,67 +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="appcatalog_data">
- <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
- <class>org.apache.aiaravata.application.catalog.data.model.ComputeResource</class>
- <class>org.apache.aiaravata.application.catalog.data.model.GlobusJobSubmission</class>
- <class>org.apache.aiaravata.application.catalog.data.model.GlobusGKEndpoint</class>
- <class>org.apache.aiaravata.application.catalog.data.model.GSISSHSubmission</class>
- <class>org.apache.aiaravata.application.catalog.data.model.GSISSHExport</class>
- <class>org.apache.aiaravata.application.catalog.data.model.PreJobCommand</class>
- <class>org.apache.aiaravata.application.catalog.data.model.PostJobCommand</class>
- <class>org.apache.aiaravata.application.catalog.data.model.UnicoreJobSubmission</class>
- <class>org.apache.aiaravata.application.catalog.data.model.UnicoreDataMovement</class>
- <class>org.apache.aiaravata.application.catalog.data.model.HostAlias</class>
- <class>org.apache.aiaravata.application.catalog.data.model.HostIPAddress</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ScpDataMovement</class>
- <class>org.apache.aiaravata.application.catalog.data.model.GridftpDataMovement</class>
- <class>org.apache.aiaravata.application.catalog.data.model.GridftpEndpoint</class>
- <class>org.apache.aiaravata.application.catalog.data.model.SshJobSubmission</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ApplicationModule</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ModuleLoadCmd</class>
- <class>org.apache.aiaravata.application.catalog.data.model.LibraryPrepandPath</class>
- <class>org.apache.aiaravata.application.catalog.data.model.LibraryApendPath</class>
- <class>org.apache.aiaravata.application.catalog.data.model.AppEnvironment</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ApplicationInterface</class>
- <class>org.apache.aiaravata.application.catalog.data.model.AppModuleMapping</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ApplicationInput</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ApplicationOutput</class>
- <class>org.apache.aiaravata.application.catalog.data.model.GatewayProfile</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ComputeResourcePreference</class>
- <class>org.apache.aiaravata.application.catalog.data.model.BatchQueue</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ComputeResourceFileSystem</class>
- <class>org.apache.aiaravata.application.catalog.data.model.JobSubmissionInterface</class>
- <class>org.apache.aiaravata.application.catalog.data.model.DataMovementInterface</class>
- <class>org.apache.aiaravata.application.catalog.data.model.ResourceJobManager</class>
- <class>org.apache.aiaravata.application.catalog.data.model.JobManagerCommand</class>
- <class>org.apache.aiaravata.application.catalog.data.model.LocalSubmission</class>
- <class>org.apache.aiaravata.application.catalog.data.model.LocalDataMovement</class>
- <class>org.apache.aiaravata.application.catalog.data.model.Workflow</class>
- <class>org.apache.aiaravata.application.catalog.data.model.WorkflowInput</class>
- <class>org.apache.aiaravata.application.catalog.data.model.WorkflowOutput</class>
- <class>org.apache.aiaravata.application.catalog.data.model.Configuration</class>
- <exclude-unlisted-classes>true</exclude-unlisted-classes>
- </persistence-unit>
-</persistence>
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml b/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml
index 438aab4..dc74376 100644
--- a/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml
+++ b/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml
@@ -64,33 +64,4 @@
<class>org.apache.airavata.registry.core.app.catalog.model.Configuration</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
</persistence-unit>
- <persistence-unit name="experiment_data">
- <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.Gateway</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.Configuration</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.Users</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.Gateway_Worker</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.Project</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.ProjectUser</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.Experiment</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.Notification_Email</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.Experiment_Input</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.Experiment_Output</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.WorkflowNodeDetail</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.TaskDetail</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.ErrorDetail</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.ApplicationInput</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.ApplicationOutput</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.NodeInput</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.NodeOutput</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.JobDetail</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.DataTransferDetail</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.Status</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.ExperimentConfigData</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.Computational_Resource_Scheduling</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.AdvancedInputDataHandling</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.AdvancedOutputDataHandling</class>
- <class>org.apache.airavata.registry.core.experiment.catalog.model.QosParam</class>
- <exclude-unlisted-classes>true</exclude-unlisted-classes>
- </persistence-unit>
</persistence>
[18/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceResource.java
deleted file mode 100644
index 932713b..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceResource.java
+++ /dev/null
@@ -1,351 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-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 ComputeResourceResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(ComputeResourceResource.class);
- private String resourceDescription;
- private String resourceId;
- private String hostName;
- private Timestamp createdTime;
- private Timestamp updatedTime;
- private int maxMemoryPerNode;
-
- public int getMaxMemoryPerNode() {
- return maxMemoryPerNode;
- }
-
- public void setMaxMemoryPerNode(int maxMemoryPerNode) {
- this.maxMemoryPerNode = maxMemoryPerNode;
- }
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
- generator.setParameter(ComputeResourceConstants.RESOURCE_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
- generator.setParameter(ComputeResourceConstants.RESOURCE_ID, identifier);
- Query q = generator.selectQuery(em);
- ComputeResource computeResource = (ComputeResource) q.getSingleResult();
- ComputeResourceResource computeResourceResource = (ComputeResourceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
- em.getTransaction().commit();
- em.close();
- return computeResourceResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> computeResourceResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
- Query q;
- if ((fieldName.equals(ComputeResourceConstants.RESOURCE_DESCRIPTION)) || (fieldName.equals(ComputeResourceConstants.RESOURCE_ID)) || (fieldName.equals(ComputeResourceConstants.HOST_NAME))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ComputeResource computeResource = (ComputeResource) result;
- ComputeResourceResource computeResourceResource = (ComputeResourceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
- computeResourceResources.add(computeResourceResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Compute Resource Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Compute Resource Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return computeResourceResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- List<Resource> computeResourceResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
- Query q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ComputeResource computeResource = (ComputeResource) result;
- ComputeResourceResource computeResourceResource = (ComputeResourceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
- computeResourceResources.add(computeResourceResource);
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return computeResourceResources;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- List<String> computeResourceResources = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
- Query q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ComputeResource computeResource = (ComputeResource) result;
- computeResourceResources.add(computeResource.getResourceId());
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return computeResourceResources;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> computeResourceResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(COMPUTE_RESOURCE);
- Query q;
- if ((fieldName.equals(ComputeResourceConstants.RESOURCE_DESCRIPTION)) || (fieldName.equals(ComputeResourceConstants.RESOURCE_ID)) || (fieldName.equals(ComputeResourceConstants.HOST_NAME))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- ComputeResource computeResource = (ComputeResource) result;
- ComputeResourceResource computeResourceResource = (ComputeResourceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.COMPUTE_RESOURCE, computeResource);
- computeResourceResourceIDs.add(computeResourceResource.getResourceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Compute Resource Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Compute Resource Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return computeResourceResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ComputeResource existingComputeResource = em.find(ComputeResource.class, resourceId);
- em.close();
- ComputeResource computeResource;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingComputeResource == null) {
- computeResource = new ComputeResource();
- computeResource.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- computeResource = existingComputeResource;
- computeResource.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- computeResource.setResourceDescription(getResourceDescription());
- computeResource.setResourceId(getResourceId());
- computeResource.setHostName(getHostName());
- computeResource.setMaxMemoryPerNode(getMaxMemoryPerNode());
- if (existingComputeResource == null) {
- em.persist(computeResource);
- } else {
- em.merge(computeResource);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- ComputeResource computeResource = em.find(ComputeResource.class, identifier);
- em.close();
- return computeResource != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getResourceDescription() {
- return resourceDescription;
- }
-
- public String getResourceId() {
- return resourceId;
- }
-
- public String getHostName() {
- return hostName;
- }
-
- public void setResourceDescription(String resourceDescription) {
- this.resourceDescription=resourceDescription;
- }
-
- public void setResourceId(String resourceId) {
- this.resourceId=resourceId;
- }
-
- public void setHostName(String hostName) {
- this.hostName=hostName;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceResource.java
deleted file mode 100644
index 267cd23..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementInterfaceResource.java
+++ /dev/null
@@ -1,339 +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.aiaravata.application.catalog.data.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.DataMovementInterface;
-import org.apache.aiaravata.application.catalog.data.model.DataMovementInterface_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DataMovementInterfaceResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(DataMovementInterfaceResource.class);
- private String computeResourceId;
- private ComputeResourceResource computeHostResource;
- private String dataMovementProtocol;
- private String dataMovementInterfaceId;
- private int priorityOrder;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
- generator.setParameter(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID));
- generator.setParameter(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID));
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
- generator.setParameter(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID));
- generator.setParameter(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID));
- Query q = generator.selectQuery(em);
- DataMovementInterface dataMovementInterface = (DataMovementInterface) q.getSingleResult();
- DataMovementInterfaceResource dataMovementInterfaceResource = (DataMovementInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
- em.getTransaction().commit();
- em.close();
- return dataMovementInterfaceResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> dataMovementInterfaceResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
- Query q;
- if ((fieldName.equals(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_PROTOCOL)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.PRIORITY_ORDER))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- DataMovementInterface dataMovementInterface = (DataMovementInterface) result;
- DataMovementInterfaceResource dataMovementInterfaceResource = (DataMovementInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
- dataMovementInterfaceResources.add(dataMovementInterfaceResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Data Movement Interface Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Data Movement Interface Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return dataMovementInterfaceResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> dataMovementInterfaceResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_INTERFACE);
- Query q;
- if ((fieldName.equals(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_PROTOCOL)) || (fieldName.equals(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)) || (fieldName.equals(DataMovementInterfaceConstants.PRIORITY_ORDER))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- DataMovementInterface dataMovementInterface = (DataMovementInterface) result;
- DataMovementInterfaceResource dataMovementInterfaceResource = (DataMovementInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_INTERFACE, dataMovementInterface);
- dataMovementInterfaceResourceIDs.add(dataMovementInterfaceResource.getComputeResourceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Data Movement Interface Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Data Movement Interface Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return dataMovementInterfaceResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- DataMovementInterface existingDataMovementInterface = em.find(DataMovementInterface.class, new DataMovementInterface_PK(computeResourceId, dataMovementInterfaceId));
- em.close();
- DataMovementInterface dataMovementInterface;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingDataMovementInterface == null) {
- dataMovementInterface = new DataMovementInterface();
- dataMovementInterface.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- dataMovementInterface = existingDataMovementInterface;
- dataMovementInterface.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- dataMovementInterface.setComputeResourceId(getComputeResourceId());
- ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
- dataMovementInterface.setComputeResource(computeResource);
- dataMovementInterface.setDataMovementProtocol(getDataMovementProtocol());
- dataMovementInterface.setDataMovementInterfaceId(getDataMovementInterfaceId());
- dataMovementInterface.setPriorityOrder(getPriorityOrder());
- if (existingDataMovementInterface == null) {
- em.persist(dataMovementInterface);
- } else {
- em.merge(dataMovementInterface);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- DataMovementInterface dataMovementInterface = em.find(DataMovementInterface.class, new DataMovementInterface_PK(ids.get(DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID), ids.get(DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID)));
- em.close();
- return dataMovementInterface != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getComputeResourceId() {
- return computeResourceId;
- }
-
- public ComputeResourceResource getComputeHostResource() {
- return computeHostResource;
- }
-
- public String getDataMovementProtocol() {
- return dataMovementProtocol;
- }
-
- public String getDataMovementInterfaceId() {
- return dataMovementInterfaceId;
- }
-
- public int getPriorityOrder() {
- return priorityOrder;
- }
-
- public void setComputeResourceId(String computeResourceId) {
- this.computeResourceId=computeResourceId;
- }
-
- public void setComputeHostResource(ComputeResourceResource computeHostResource) {
- this.computeHostResource=computeHostResource;
- }
-
- public void setDataMovementProtocol(String dataMovementProtocol) {
- this.dataMovementProtocol=dataMovementProtocol;
- }
-
- public void setDataMovementInterfaceId(String dataMovementInterfaceId) {
- this.dataMovementInterfaceId=dataMovementInterfaceId;
- }
-
- public void setPriorityOrder(int priorityOrder) {
- this.priorityOrder=priorityOrder;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementProtocolResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementProtocolResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementProtocolResource.java
deleted file mode 100644
index 441b56c..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/DataMovementProtocolResource.java
+++ /dev/null
@@ -1,360 +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.aiaravata.application.catalog.data.resources;
-//
-//import org.apache.airavata.registry.cpi.AppCatalogException;
-//import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-//import org.apache.aiaravata.application.catalog.data.model.DataMovementProtocol;
-//import org.apache.aiaravata.application.catalog.data.model.DataMovementProtocolPK;
-//import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-//import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-//import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-//import org.apache.airavata.common.exception.ApplicationSettingsException;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//
-//import javax.persistence.EntityManager;
-//import javax.persistence.Query;
-//import java.util.ArrayList;
-//import java.util.HashMap;
-//import java.util.List;
-//import java.util.Map;
-//
-//public class DataMovementProtocolResource extends AbstractResource {
-//
-// private final static Logger logger = LoggerFactory.getLogger(DataMovementProtocolResource.class);
-//
-// private String resourceID;
-// private String dataMoveID;
-// private String dataMoveType;
-// private ComputeResourceResource computeHostResource;
-//
-// public void remove(Object identifier) throws AppCatalogException {
-// HashMap<String, String> ids;
-// if (identifier instanceof Map) {
-// ids = (HashMap) identifier;
-// } else {
-// logger.error("Identifier should be a map with the field name and it's value");
-// throw new AppCatalogException("Identifier should be a map with the field name and it's value");
-// }
-//
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// em.getTransaction().begin();
-// AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_PROTOCOL);
-// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_TYPE, ids.get(DataMoveProtocolConstants.DATA_MOVE_TYPE));
-// generator.setParameter(DataMoveProtocolConstants.RESOURCE_ID, ids.get(DataMoveProtocolConstants.RESOURCE_ID));
-// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_ID, ids.get(DataMoveProtocolConstants.DATA_MOVE_ID));
-// Query q = generator.deleteQuery(em);
-// q.executeUpdate();
-// em.getTransaction().commit();
-// em.close();
-// } catch (ApplicationSettingsException e) {
-// logger.error(e.getMessage(), e);
-// throw new AppCatalogException(e);
-// } finally {
-// if (em != null && em.isOpen()) {
-// if (em.getTransaction().isActive()) {
-// em.getTransaction().rollback();
-// }
-// em.close();
-// }
-// }
-// }
-//
-// public Resource get(Object identifier) throws AppCatalogException {
-// HashMap<String, String> ids;
-// if (identifier instanceof Map) {
-// ids = (HashMap) identifier;
-// } else {
-// logger.error("Identifier should be a map with the field name and it's value");
-// throw new AppCatalogException("Identifier should be a map with the field name and it's value");
-// }
-//
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// em.getTransaction().begin();
-// AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_PROTOCOL);
-// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_TYPE, ids.get(DataMoveProtocolConstants.DATA_MOVE_TYPE));
-// generator.setParameter(DataMoveProtocolConstants.RESOURCE_ID, ids.get(DataMoveProtocolConstants.RESOURCE_ID));
-// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_ID, ids.get(DataMoveProtocolConstants.DATA_MOVE_ID));
-// Query q = generator.selectQuery(em);
-// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) q.getSingleResult();
-// DataMovementProtocolResource dataMovementProtocolResource =
-// (DataMovementProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_PROTOCOL, dataMovementProtocol);
-// em.getTransaction().commit();
-// em.close();
-// return dataMovementProtocolResource;
-// } catch (ApplicationSettingsException e) {
-// logger.error(e.getMessage(), e);
-// throw new AppCatalogException(e);
-// } finally {
-// if (em != null && em.isOpen()) {
-// if (em.getTransaction().isActive()) {
-// em.getTransaction().rollback();
-// }
-// em.close();
-// }
-// }
-// }
-//
-// public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
-// List<Resource> dataMoveProtocolResourcesList = new ArrayList<Resource>();
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// em.getTransaction().begin();
-// Query q;
-// AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_PROTOCOL);
-// List results;
-// if (fieldName.equals(DataMoveProtocolConstants.RESOURCE_ID)) {
-// generator.setParameter(DataMoveProtocolConstants.RESOURCE_ID, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
-// DataMovementProtocolResource dataMovementProtocolResource =
-// (DataMovementProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_PROTOCOL, dataMovementProtocol);
-// dataMoveProtocolResourcesList.add(dataMovementProtocolResource);
-// }
-// }
-// } else if (fieldName.equals(DataMoveProtocolConstants.DATA_MOVE_TYPE)) {
-// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_TYPE, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
-// DataMovementProtocolResource dataMovementProtocolResource =
-// (DataMovementProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_PROTOCOL, dataMovementProtocol);
-// dataMoveProtocolResourcesList.add(dataMovementProtocolResource);
-// }
-// }
-// } else if (fieldName.equals(DataMoveProtocolConstants.DATA_MOVE_ID)) {
-// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_ID, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
-// DataMovementProtocolResource dataMovementProtocolResource =
-// (DataMovementProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.DATA_MOVEMENT_PROTOCOL, dataMovementProtocol);
-// dataMoveProtocolResourcesList.add(dataMovementProtocolResource);
-// }
-// }
-// } else {
-// em.getTransaction().commit();
-// em.close();
-// logger.error("Unsupported field name for Data Movement Protocol Resource.", new IllegalArgumentException());
-// throw new IllegalArgumentException("Unsupported field name for Data Movement Protocol Resource.");
-// }
-// em.getTransaction().commit();
-// em.close();
-// } catch (Exception e) {
-// logger.error(e.getMessage(), e);
-// throw new AppCatalogException(e);
-// } finally {
-// if (em != null && em.isOpen()) {
-// if (em.getTransaction().isActive()) {
-// em.getTransaction().rollback();
-// }
-// em.close();
-// }
-// }
-// return dataMoveProtocolResourcesList;
-// }
-//
-// @Override
-// public List<Resource> getAll() throws AppCatalogException {
-// return null;
-// }
-//
-// @Override
-// public List<String> getAllIds() throws AppCatalogException {
-// return null;
-// }
-//
-// public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-// List<String> dataMovementProtocolIDs = new ArrayList<String>();
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// em.getTransaction().begin();
-// Query q;
-// AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(DATA_MOVEMENT_PROTOCOL);
-// List results;
-// if (fieldName.equals(DataMoveProtocolConstants.DATA_MOVE_ID)) {
-// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_ID, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
-// dataMovementProtocolIDs.add(dataMovementProtocol.getDataMoveID());
-// }
-// }
-// } else if (fieldName.equals(DataMoveProtocolConstants.RESOURCE_ID)) {
-// generator.setParameter(DataMoveProtocolConstants.RESOURCE_ID, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
-// dataMovementProtocolIDs.add(dataMovementProtocol.getDataMoveID());
-// }
-// }
-// } else if (fieldName.equals(DataMoveProtocolConstants.DATA_MOVE_TYPE)) {
-// generator.setParameter(DataMoveProtocolConstants.DATA_MOVE_TYPE, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// DataMovementProtocol dataMovementProtocol = (DataMovementProtocol) result;
-// dataMovementProtocolIDs.add(dataMovementProtocol.getDataMoveID());
-// }
-// }
-// } else {
-// em.getTransaction().commit();
-// em.close();
-// logger.error("Unsupported field name for Data Move Protocol resource.", new IllegalArgumentException());
-// throw new IllegalArgumentException("Unsupported field name for Data Move Protocol Resource.");
-// }
-// em.getTransaction().commit();
-// em.close();
-// } catch (Exception e) {
-// logger.error(e.getMessage(), e);
-// throw new AppCatalogException(e);
-// } finally {
-// if (em != null && em.isOpen()) {
-// if (em.getTransaction().isActive()) {
-// em.getTransaction().rollback();
-// }
-// em.close();
-// }
-// }
-// return dataMovementProtocolIDs;
-// }
-//
-// public void save() throws AppCatalogException {
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// DataMovementProtocol existingDataMovementProtocol = em.find(DataMovementProtocol.class, new DataMovementProtocolPK(resourceID, dataMoveID, dataMoveType));
-// em.close();
-//
-// em = AppCatalogJPAUtils.getEntityManager();
-// em.getTransaction().begin();
-// if (existingDataMovementProtocol != null) {
-// existingDataMovementProtocol.setDataMoveID(dataMoveType);
-// existingDataMovementProtocol.setDataMoveID(dataMoveID);
-// ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
-// existingDataMovementProtocol.setComputeResource(computeResource);
-// existingDataMovementProtocol.setResourceID(resourceID);
-// em.merge(existingDataMovementProtocol);
-// } else {
-// DataMovementProtocol dataMovementProtocol = new DataMovementProtocol();
-// dataMovementProtocol.setDataMoveType(dataMoveType);
-// dataMovementProtocol.setDataMoveID(dataMoveID);
-// dataMovementProtocol.setResourceID(resourceID);
-// ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
-// dataMovementProtocol.setComputeResource(computeResource);
-// em.persist(dataMovementProtocol);
-// }
-// em.getTransaction().commit();
-// em.close();
-// } catch (Exception e) {
-// logger.error(e.getMessage(), e);
-// throw new AppCatalogException(e);
-// } finally {
-// if (em != null && em.isOpen()) {
-// if (em.getTransaction().isActive()) {
-// em.getTransaction().rollback();
-// }
-// em.close();
-// }
-// }
-// }
-//
-// public boolean isExists(Object identifier) throws AppCatalogException {
-// HashMap<String, String> ids;
-// if (identifier instanceof Map) {
-// ids = (HashMap) identifier;
-// } else {
-// logger.error("Identifier should be a map with the field name and it's value");
-// throw new AppCatalogException("Identifier should be a map with the field name and it's value");
-// }
-//
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// DataMovementProtocol dataMovementProtocol = em.find(DataMovementProtocol.class, new DataMovementProtocolPK(
-// ids.get(DataMoveProtocolConstants.RESOURCE_ID),
-// ids.get(DataMoveProtocolConstants.DATA_MOVE_ID), ids.get(DataMoveProtocolConstants.DATA_MOVE_TYPE)));
-//
-// em.close();
-// return dataMovementProtocol != null;
-// } catch (ApplicationSettingsException e) {
-// logger.error(e.getMessage(), e);
-// throw new AppCatalogException(e);
-// } finally {
-// if (em != null && em.isOpen()) {
-// if (em.getTransaction().isActive()) {
-// em.getTransaction().rollback();
-// }
-// em.close();
-// }
-// }
-// }
-//
-// public String getResourceID() {
-// return resourceID;
-// }
-//
-// public void setResourceID(String resourceID) {
-// this.resourceID = resourceID;
-// }
-//
-// public String getDataMoveID() {
-// return dataMoveID;
-// }
-//
-// public void setDataMoveID(String dataMoveID) {
-// this.dataMoveID = dataMoveID;
-// }
-//
-// public String getDataMoveType() {
-// return dataMoveType;
-// }
-//
-// public void setDataMoveType(String dataMoveType) {
-// this.dataMoveType = dataMoveType;
-// }
-//
-// public ComputeResourceResource getComputeHostResource() {
-// return computeHostResource;
-// }
-//
-// public void setComputeHostResource(ComputeResourceResource computeHostResource) {
-// this.computeHostResource = computeHostResource;
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHExportResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHExportResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHExportResource.java
deleted file mode 100644
index 92e2e43..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHExportResource.java
+++ /dev/null
@@ -1,324 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHExport;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHExportPK;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHSubmission;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class GSISSHExportResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(GSISSHExportResource.class);
-
- private String submissionID;
- private String export;
-
- private GSISSHSubmissionResource gsisshSubmissionResource;
-
-
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_EXPORT);
- generator.setParameter(GSISSHExportConstants.EXPORT, ids.get(GSISSHExportConstants.EXPORT));
- generator.setParameter(GSISSHExportConstants.SUBMISSION_ID, ids.get(GSISSHExportConstants.SUBMISSION_ID));
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_EXPORT);
- generator.setParameter(GSISSHExportConstants.SUBMISSION_ID, ids.get(GSISSHExportConstants.SUBMISSION_ID));
- generator.setParameter(GSISSHExportConstants.EXPORT, ids.get(GSISSHExportConstants.EXPORT));
- Query q = generator.selectQuery(em);
- GSISSHExport gsisshExport = (GSISSHExport) q.getSingleResult();
- GSISSHExportResource gsisshExportResource =
- (GSISSHExportResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GSISSH_EXPORT
- , gsisshExport);
- em.getTransaction().commit();
- em.close();
- return gsisshExportResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> gsiSSHExportResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_EXPORT);
- List results;
- if (fieldName.equals(GSISSHExportConstants.EXPORT)) {
- generator.setParameter(GSISSHExportConstants.EXPORT, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHExport gsisshExport = (GSISSHExport) result;
- GSISSHExportResource gsisshExportResource =
- (GSISSHExportResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GSISSH_EXPORT, gsisshExport);
- gsiSSHExportResources.add(gsisshExportResource);
- }
- }
- } else if (fieldName.equals(GSISSHExportConstants.SUBMISSION_ID)) {
- generator.setParameter(GSISSHExportConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHExport gsisshExport = (GSISSHExport) result;
- GSISSHExportResource gsisshExportResource =
- (GSISSHExportResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GSISSH_EXPORT, gsisshExport);
- gsiSSHExportResources.add(gsisshExportResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Export Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Export Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gsiSSHExportResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> gsiSSHExportIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_EXPORT);
- List results;
- if (fieldName.equals(GSISSHExportConstants.SUBMISSION_ID)) {
- generator.setParameter(GSISSHExportConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHExport gsisshExport = (GSISSHExport) result;
- gsiSSHExportIDs.add(gsisshExport.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GSISSHExportConstants.EXPORT)) {
- generator.setParameter(GSISSHExportConstants.EXPORT, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHExport gsisshExport = (GSISSHExport) result;
- gsiSSHExportIDs.add(gsisshExport.getSubmissionID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Export resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Export Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gsiSSHExportIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GSISSHExport existingGSIExport = em.find(GSISSHExport.class, new GSISSHExportPK(submissionID, export));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- GSISSHSubmission gsisshSubmission = em.find(GSISSHSubmission.class, submissionID);
- if (existingGSIExport != null) {
- existingGSIExport.setSubmissionID(submissionID);
- existingGSIExport.setExport(export);
- existingGSIExport.setGsisshJobSubmission(gsisshSubmission);
- em.merge(existingGSIExport);
- } else {
- GSISSHExport gsisshExport = new GSISSHExport();
- gsisshExport.setSubmissionID(submissionID);
- gsisshExport.setExport(export);
- gsisshExport.setGsisshJobSubmission(gsisshSubmission);
- em.persist(gsisshExport);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GSISSHExport gsisshExport = em.find(GSISSHExport.class, new GSISSHExportPK(ids.get(GSISSHExportConstants.SUBMISSION_ID),
- ids.get(GSISSHExportConstants.EXPORT)));
-
- em.close();
- return gsisshExport != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- } }
-
- public String getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getExport() {
- return export;
- }
-
- public void setExport(String export) {
- this.export = export;
- }
-
- public GSISSHSubmissionResource getGsisshSubmissionResource() {
- return gsisshSubmissionResource;
- }
-
- public void setGsisshSubmissionResource(GSISSHSubmissionResource gsisshSubmissionResource) {
- this.gsisshSubmissionResource = gsisshSubmissionResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHSubmissionResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHSubmissionResource.java
deleted file mode 100644
index 938aa3f..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GSISSHSubmissionResource.java
+++ /dev/null
@@ -1,373 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.GSISSHSubmission;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.List;
-
-public class GSISSHSubmissionResource extends AbstractResource {
-
- private final static Logger logger = LoggerFactory.getLogger(GSISSHSubmissionResource.class);
-
- private String submissionID;
- private String resourceJobManager;
- private int sshPort;
- private String installedPath;
- private String monitorMode;
-
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_SUBMISSION);
- generator.setParameter(GSISSHSubmissionConstants.SUBMISSION_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_SUBMISSION);
- generator.setParameter(GSISSHSubmissionConstants.SUBMISSION_ID, identifier);
- Query q = generator.selectQuery(em);
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) q.getSingleResult();
- GSISSHSubmissionResource gsisshSubmissionResource =
- (GSISSHSubmissionResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GSISSH_SUBMISSION
- , gsisshSubmission);
- em.getTransaction().commit();
- em.close();
- return gsisshSubmissionResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> gsiSSHSubmissionResourceList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_SUBMISSION);
- List results;
- if (fieldName.equals(GSISSHSubmissionConstants.MONITOR_MODE)) {
- generator.setParameter(GSISSHSubmissionConstants.MONITOR_MODE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- GSISSHSubmissionResource gsisshSubmissionResource =
- (GSISSHSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GSISSH_SUBMISSION, gsisshSubmission);
- gsiSSHSubmissionResourceList.add(gsisshSubmissionResource);
- }
- }
- } else if (fieldName.equals(GSISSHSubmissionConstants.INSTALLED_PATH)) {
- generator.setParameter(GSISSHSubmissionConstants.INSTALLED_PATH, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- GSISSHSubmissionResource gsisshSubmissionResource =
- (GSISSHSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GSISSH_SUBMISSION, gsisshSubmission);
- gsiSSHSubmissionResourceList.add(gsisshSubmissionResource);
- }
- }
- } else if (fieldName.equals(GSISSHSubmissionConstants.SSH_PORT)) {
- generator.setParameter(GSISSHSubmissionConstants.SSH_PORT, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- GSISSHSubmissionResource gsisshSubmissionResource =
- (GSISSHSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GSISSH_SUBMISSION, gsisshSubmission);
- gsiSSHSubmissionResourceList.add(gsisshSubmissionResource);
- }
- }
- } else if (fieldName.equals(GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER)) {
- generator.setParameter(GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- GSISSHSubmissionResource gsisshSubmissionResource =
- (GSISSHSubmissionResource) AppCatalogJPAUtils.getResource(
- AppCatalogResourceType.GSISSH_SUBMISSION, gsisshSubmission);
- gsiSSHSubmissionResourceList.add(gsisshSubmissionResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH submission resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Submission resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gsiSSHSubmissionResourceList;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> gsiSSHSubmissionResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GSISSH_SUBMISSION);
- List results;
- if (fieldName.equals(GSISSHSubmissionConstants.SUBMISSION_ID)) {
- generator.setParameter(GSISSHSubmissionConstants.SUBMISSION_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GSISSHSubmissionConstants.SSH_PORT)) {
- generator.setParameter(GSISSHSubmissionConstants.SSH_PORT, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GSISSHSubmissionConstants.MONITOR_MODE)) {
- generator.setParameter(GSISSHSubmissionConstants.MONITOR_MODE, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER)) {
- generator.setParameter(GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
- }
- }
- } else if (fieldName.equals(GSISSHSubmissionConstants.INSTALLED_PATH)) {
- generator.setParameter(GSISSHSubmissionConstants.INSTALLED_PATH, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- GSISSHSubmission gsisshSubmission = (GSISSHSubmission) result;
- gsiSSHSubmissionResourceIDs.add(gsisshSubmission.getSubmissionID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for GSISSH Submission resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for GSISSH Submission resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return gsiSSHSubmissionResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GSISSHSubmission existingGSISSHSubmission = em.find(GSISSHSubmission.class, submissionID);
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingGSISSHSubmission != null) {
- existingGSISSHSubmission.setSubmissionID(submissionID);
- existingGSISSHSubmission.setSshPort(sshPort);
- existingGSISSHSubmission.setResourceJobManager(resourceJobManager);
- existingGSISSHSubmission.setInstalledPath(installedPath);
- existingGSISSHSubmission.setMonitorMode(monitorMode);
- em.merge(existingGSISSHSubmission);
- } else {
- GSISSHSubmission gsisshSubmission = new GSISSHSubmission();
- gsisshSubmission.setSubmissionID(submissionID);
- gsisshSubmission.setSshPort(sshPort);
- gsisshSubmission.setResourceJobManager(resourceJobManager);
- gsisshSubmission.setInstalledPath(installedPath);
- gsisshSubmission.setMonitorMode(monitorMode);
- em.persist(gsisshSubmission);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- GSISSHSubmission gsisshSubmission = em.find(GSISSHSubmission.class, identifier);
- em.close();
- return gsisshSubmission != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getSubmissionID() {
- return submissionID;
- }
-
- public void setSubmissionID(String submissionID) {
- this.submissionID = submissionID;
- }
-
- public String getResourceJobManager() {
- return resourceJobManager;
- }
-
- public void setResourceJobManager(String resourceJobManager) {
- this.resourceJobManager = resourceJobManager;
- }
-
- public int getSshPort() {
- return sshPort;
- }
-
- public void setSshPort(int sshPort) {
- this.sshPort = sshPort;
- }
-
- public String getInstalledPath() {
- return installedPath;
- }
-
- public void setInstalledPath(String installedPath) {
- this.installedPath = installedPath;
- }
-
- public String getMonitorMode() {
- return monitorMode;
- }
-
- public void setMonitorMode(String monitorMode) {
- this.monitorMode = monitorMode;
- }
-
-}
[02/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/app/catalog/ComputeResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/app/catalog/ComputeResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/app/catalog/ComputeResourceTest.java
deleted file mode 100644
index a0034a7..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/app/catalog/ComputeResourceTest.java
+++ /dev/null
@@ -1,297 +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.app.catalog.test;
-
-
-import org.airavata.appcatalog.cpi.AppCatalog;
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
-import org.apache.aiaravata.application.catalog.data.resources.AbstractResource;
-import org.apache.airavata.app.catalog.test.util.Initialize;
-import org.apache.airavata.model.appcatalog.computeresource.*;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.*;
-
-import static org.junit.Assert.assertTrue;
-
-public class ComputeResourceTest {
- private static Initialize initialize;
- private static AppCatalog appcatalog;
- private static final Logger logger = LoggerFactory.getLogger(ComputeResourceTest.class);
-
- @Before
- public void setUp() {
- try {
- initialize = new Initialize("appcatalog-derby.sql");
- initialize.initializeDB();
- appcatalog = AppCatalogFactory.getAppCatalog();
- } catch (AppCatalogException e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- @After
- public void tearDown() throws Exception {
- System.out.println("********** TEAR DOWN ************");
- initialize.stopDerbyServer();
-
- }
-
- @Test
- public void testAddComputeResource (){
- try {
- ComputeResource computeResource = appcatalog.getComputeResource();
- ComputeResourceDescription description = new ComputeResourceDescription();
-
- description.setHostName("localhost");
- description.setResourceDescription("test compute resource");
- List<String> ipdaresses = new ArrayList<String>();
- ipdaresses.add("222.33.43.444");
- ipdaresses.add("23.344.44.454");
- description.setIpAddresses(ipdaresses);
-// List<String> aliases = new ArrayList<String>();
-// aliases.add("test.alias1");
-// aliases.add("test.alias2");
-// description.setHostAliases(aliases);
- String sshsubmissionId = addSSHJobSubmission();
- System.out.println("**** SSH Submission id ****** :" + sshsubmissionId);
-// String gsiSSHsubmissionId = addGSISSHJobSubmission();
-// System.out.println("**** GSISSH Submission id ****** :" + gsiSSHsubmissionId);
-// String globusSubmissionId = addGlobusJobSubmission();
-// System.out.println("**** Globus Submission id ****** :" + globusSubmissionId);
- JobSubmissionInterface sshSubmissionInt = new JobSubmissionInterface();
- sshSubmissionInt.setJobSubmissionInterfaceId(sshsubmissionId);
- sshSubmissionInt.setPriorityOrder(1);
- sshSubmissionInt.setJobSubmissionProtocol(JobSubmissionProtocol.SSH);
-// JobSubmissionInterface globusSubInt = new JobSubmissionInterface();
-// globusSubInt.setJobSubmissionInterfaceId(globusSubmissionId);
-// globusSubInt.setPriorityOrder(2);
-// globusSubInt.setJobSubmissionProtocol(JobSubmissionProtocol.GLOBUS);
- List<JobSubmissionInterface> interfaceList = new ArrayList<JobSubmissionInterface>();
- interfaceList.add(sshSubmissionInt);
-// interfaceList.add(globusSubInt);
- description.setJobSubmissionInterfaces(interfaceList);
-
- String scpDataMoveId = addSCPDataMovement();
- System.out.println("**** SCP DataMoveId****** :" + scpDataMoveId);
- String gridFTPDataMoveId = addGridFTPDataMovement();
- System.out.println("**** grid FTP DataMoveId****** :" + gridFTPDataMoveId);
-
- List<DataMovementInterface> dataMovementInterfaces = new ArrayList<DataMovementInterface>();
- DataMovementInterface scpInterface = new DataMovementInterface();
- scpInterface.setDataMovementInterfaceId(scpDataMoveId);
- scpInterface.setDataMovementProtocol(DataMovementProtocol.SCP);
- scpInterface.setPriorityOrder(1);
-
- DataMovementInterface gridFTPMv = new DataMovementInterface();
- gridFTPMv.setDataMovementInterfaceId(gridFTPDataMoveId);
- gridFTPMv.setDataMovementProtocol(DataMovementProtocol.GridFTP);
- gridFTPMv.setPriorityOrder(2);
-
- description.setDataMovementInterfaces(dataMovementInterfaces);
-
- BatchQueue batchQueue1 = new BatchQueue();
- batchQueue1.setQueueName("queue1");
- batchQueue1.setQueueDescription("que1Desc1");
- batchQueue1.setMaxRunTime(10);
- batchQueue1.setMaxNodes(4);
- batchQueue1.setMaxJobsInQueue(1);
-
- BatchQueue batchQueue2 = new BatchQueue();
- batchQueue2.setQueueName("queue2");
- batchQueue2.setQueueDescription("que1Desc2");
- batchQueue2.setMaxRunTime(10);
- batchQueue2.setMaxNodes(4);
- batchQueue2.setMaxJobsInQueue(1);
-
- List<BatchQueue> batchQueueList = new ArrayList<BatchQueue>();
- batchQueueList.add(batchQueue1);
- batchQueueList.add(batchQueue2);
- description.setBatchQueues(batchQueueList);
-
- Map<FileSystems, String> fileSysMap = new HashMap<FileSystems, String>();
- fileSysMap.put(FileSystems.HOME, "/home");
- fileSysMap.put(FileSystems.SCRATCH, "/tmp");
- description.setFileSystems(fileSysMap);
-
- String resourceId = computeResource.addComputeResource(description);
- System.out.println("**********Resource id ************* : " + resourceId);
- ComputeResourceDescription host = null;
- if (computeResource.isComputeResourceExists(resourceId)){
- host = computeResource.getComputeResource(resourceId);
- List<BatchQueue> batchQueues = host.getBatchQueues();
- for (BatchQueue queue : batchQueues){
- System.out.println("%%%%%%%%%%%%%%%% queue description : %%%%%%%%%%%%%%%%%%% : " + queue.getQueueDescription());
- }
- List<String> hostAliases = host.getHostAliases();
- if (hostAliases != null && !hostAliases.isEmpty()){
- for (String alias : hostAliases){
- System.out.println("%%%%%%%%%%%%%%%% alias value : %%%%%%%%%%%%%%%%%%% : " + alias);
- }
- }
- host.addToHostAliases("abc");
- computeResource.updateComputeResource(resourceId, host);
- List<String> hostAliases1 = computeResource.getComputeResource(resourceId).getHostAliases();
- for (String alias : hostAliases1){
- System.out.println("%%%%%%%%%%%%%%%% alias value : %%%%%%%%%%%%%%%%%%% : " + alias);
- }
- System.out.println("**********Resource name ************* : " + host.getHostName());
- }
-
- SSHJobSubmission sshJobSubmission = computeResource.getSSHJobSubmission(sshsubmissionId);
- System.out.println("**********SSH Submission resource job manager ************* : " + sshJobSubmission.getResourceJobManager().toString());
- System.out.println("**********Monitor mode ************* : " + sshJobSubmission.getMonitorMode().toString());
-
-// GlobusJobSubmission globusJobSubmission = computeResource.get(globusSubmissionId);
-// System.out.println("**********Globus Submission resource job manager ************* : " + globusJobSubmission.getResourceJobManager().toString());
-
- SCPDataMovement scpDataMovement = computeResource.getSCPDataMovement(scpDataMoveId);
- System.out.println("**********SCP Data Move Security protocol ************* : " + scpDataMovement.getSecurityProtocol().toString());
-
- GridFTPDataMovement gridFTPDataMovement = computeResource.getGridFTPDataMovement(gridFTPDataMoveId);
- System.out.println("**********GRID FTP Data Move Security protocol ************* : " + gridFTPDataMovement.getSecurityProtocol().toString());
-
- description.setHostName("localhost2");
- computeResource.updateComputeResource(resourceId, description);
- if (computeResource.isComputeResourceExists(resourceId)){
- host = computeResource.getComputeResource(resourceId);
- System.out.println("**********Updated Resource name ************* : " + host.getHostName());
- }
-
- Map<String, String> cfilters = new HashMap<String, String>();
- cfilters.put(AbstractResource.ComputeResourceConstants.HOST_NAME, "localhost2");
- List<ComputeResourceDescription> computeResourceList = computeResource.getComputeResourceList(cfilters);
- System.out.println("**********Size of compute resources ************* : " + computeResourceList.size());
-
- List<ComputeResourceDescription> allComputeResourceList = computeResource.getAllComputeResourceList();
- System.out.println("**********Size of all compute resources ************* : " + allComputeResourceList.size());
-
- Map<String, String> allComputeResourceIdList = computeResource.getAllComputeResourceIdList();
- System.out.println("**********Size of all compute resources ids ************* : " + allComputeResourceIdList.size());
-
-// Map<String, String> globusfilters = new HashMap<String, String>();
-// globusfilters.put(AbstractResource.GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, ResourceJobManager.PBS.toString());
-// List<GlobusJobSubmission> gList = computeResource.getGlobusJobSubmissionList(globusfilters);
-// System.out.println("**********Size of globus jobs ************* : " + gList.size());
-
-// Map<String, String> sshfilters = new HashMap<String, String>();
-// sshfilters.put(AbstractResource.SSHSubmissionConstants.RESOURCE_JOB_MANAGER, ResourceJobManager.PBS.toString());
-// List<SSHJobSubmission> sshList = computeResource.getSS(sshfilters);
-// System.out.println("**********Size of SSH jobs ************* : " + sshList.size());
-
-// Map<String, String> gsishfilters = new HashMap<String, String>();
-// gsishfilters.put(AbstractResource.GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER, ResourceJobManager.PBS.toString());
-// List<GSISSHJobSubmission> gsisshList = computeResource.getGSISSHJobSubmissionList(gsishfilters);
-// System.out.println("**********Size of GSISSH jobs ************* : " + gsisshList.size());
-
-// Map<String, String> scpfilters = new HashMap<String, String>();
-// scpfilters.put(AbstractResource.SCPDataMovementConstants.SECURITY_PROTOCOL, SecurityProtocol.SSH_KEYS.toString());
-// List<SCPDataMovement> scpDataMovementList = computeResource.getSCPDataMovementList(scpfilters);
-// System.out.println("**********Size of SCP DM list ************* : " + scpDataMovementList.size());
-//
-// Map<String, String> ftpfilters = new HashMap<String, String>();
-// ftpfilters.put(AbstractResource.GridFTPDataMovementConstants.SECURITY_PROTOCOL, SecurityProtocol.SSH_KEYS.toString());
-// List<GridFTPDataMovement> ftpDataMovementList = computeResource.getGridFTPDataMovementList(ftpfilters);
-// System.out.println("**********Size of FTP DM list ************* : " + ftpDataMovementList.size());
-
- assertTrue("Compute resource save successfully", host != null);
- } catch (AppCatalogException e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- public String addSSHJobSubmission (){
- try {
- SSHJobSubmission jobSubmission = new SSHJobSubmission();
- jobSubmission.setSshPort(22);
- jobSubmission.setSecurityProtocol(SecurityProtocol.GSI);
- ResourceJobManager jobManager = new ResourceJobManager();
- jobManager.setResourceJobManagerType(ResourceJobManagerType.PBS);
- jobManager.setPushMonitoringEndpoint("monitor ep");
- jobManager.setJobManagerBinPath("/bin");
- Map<JobManagerCommand, String> commands = new HashMap<JobManagerCommand, String>();
- commands.put(JobManagerCommand.SUBMISSION, "Sub command");
- commands.put(JobManagerCommand.SHOW_QUEUE, "show q command");
- jobManager.setJobManagerCommands(commands);
- jobSubmission.setMonitorMode(MonitorMode.POLL_JOB_MANAGER);
-// String jobManagerID = appcatalog.getComputeResource().addResourceJobManager(jobManager);
-// jobManager.setResourceJobManagerId(jobManagerID);
- jobSubmission.setResourceJobManager(jobManager);
- return appcatalog.getComputeResource().addSSHJobSubmission(jobSubmission);
- } catch (AppCatalogException e) {
- logger.error(e.getMessage(), e);
- }
- return null;
- }
-
-// public String addGlobusJobSubmission (){
-// try {
-// GlobusJobSubmission jobSubmission = new GlobusJobSubmission();
-// jobSubmission.setSecurityProtocol(SecurityProtocol.GSI);
-// jobSubmission.setResourceJobManager(ResourceJobManager.PBS);
-// List<String> endPoints = new ArrayList<String>();
-// endPoints.add("222.33.43.444");
-// endPoints.add("23.344.44.454");
-// jobSubmission.setGlobusGateKeeperEndPoint(endPoints);
-// return appcatalog.getComputeResource().addGlobusJobSubmission(jobSubmission);
-// } catch (AppCatalogException e) {
-// e.printStackTrace();
-// }
-// return null;
-// }
-
- public String addSCPDataMovement (){
- try {
- SCPDataMovement dataMovement = new SCPDataMovement();
- dataMovement.setSshPort(22);
- dataMovement.setSecurityProtocol(SecurityProtocol.SSH_KEYS);
- return appcatalog.getComputeResource().addScpDataMovement(dataMovement);
- }catch (AppCatalogException e) {
- logger.error(e.getMessage(), e);
- }
- return null;
- }
-
- public String addGridFTPDataMovement (){
- try {
- GridFTPDataMovement dataMovement = new GridFTPDataMovement();
- dataMovement.setSecurityProtocol(SecurityProtocol.SSH_KEYS);
- List<String> endPoints = new ArrayList<String>();
- endPoints.add("222.33.43.444");
- endPoints.add("23.344.44.454");
- dataMovement.setGridFTPEndPoints(endPoints);
- return appcatalog.getComputeResource().addGridFTPDataMovement(dataMovement);
- }catch (AppCatalogException e) {
- logger.error(e.getMessage(), e);
- }
- return null;
- }
-
-
-}
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java
index 0dd9d8f..14bde6e 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/AbstractResourceTest.java
@@ -19,10 +19,10 @@
*
*/
-package org.apache.airavata.experiment.catalog;
+package org.apache.airavata.registry.core.experiment.catalog;
import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.experiment.catalog.util.Initialize;
+import org.apache.airavata.registry.core.experiment.catalog.util.Initialize;
import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
import org.apache.airavata.registry.core.experiment.catalog.resources.*;
import org.apache.airavata.registry.core.experiment.catalog.resources.GatewayExperimentCatResource;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java
index e6c162c..d6f0191 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ComputationalSchedulingTest.java
@@ -19,7 +19,7 @@
*
*/
-package org.apache.airavata.experiment.catalog;
+package org.apache.airavata.registry.core.experiment.catalog;
import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
import org.apache.airavata.registry.core.experiment.catalog.resources.ComputationSchedulingExperimentCatResource;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationExperimentCatResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationExperimentCatResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationExperimentCatResourceTest.java
index 57dddbe..9636454 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationExperimentCatResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationExperimentCatResourceTest.java
@@ -19,7 +19,7 @@
*
*/
-package org.apache.airavata.experiment.catalog;
+package org.apache.airavata.registry.core.experiment.catalog;
import static org.junit.Assert.*;
import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ConfigurationResourceTest.java
deleted file mode 100644
index 66f025e..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExecutionErrorResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExecutionErrorResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExecutionErrorResourceTest.java
deleted file mode 100644
index b61a16c..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentCatalogUseCaseTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentCatalogUseCaseTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentCatalogUseCaseTest.java
index f790c8f..d66dd16 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentCatalogUseCaseTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentCatalogUseCaseTest.java
@@ -18,7 +18,7 @@
* under the License.
*
*/
-package org.apache.airavata.experiment.catalog;
+package org.apache.airavata.registry.core.experiment.catalog;
import junit.framework.Assert;
import org.apache.airavata.common.exception.ApplicationSettingsException;
@@ -27,8 +27,8 @@ 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.core.experiment.catalog.impl.RegistryFactory;
+import org.apache.airavata.registry.core.experiment.catalog.util.Initialize;
import org.apache.airavata.registry.cpi.*;
import org.apache.airavata.registry.cpi.utils.Constants;
import org.junit.BeforeClass;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentDataResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentDataResourceTest.java
deleted file mode 100644
index 1df8091..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentExperimentCatResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentExperimentCatResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentExperimentCatResourceTest.java
index d10e4ec..e59d842 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentExperimentCatResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentExperimentCatResourceTest.java
@@ -19,7 +19,7 @@
*
*/
-package org.apache.airavata.experiment.catalog;
+package org.apache.airavata.registry.core.experiment.catalog;
import static org.junit.Assert.*;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputExperimentCatResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputExperimentCatResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputExperimentCatResourceTest.java
index d5c23be..0ec3566 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputExperimentCatResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputExperimentCatResourceTest.java
@@ -19,7 +19,7 @@
*
*/
-package org.apache.airavata.experiment.catalog;
+package org.apache.airavata.registry.core.experiment.catalog;
import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentExperimentCatResource;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentInputResourceTest.java
deleted file mode 100644
index 5372877..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentMetadataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentMetadataResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentMetadataResourceTest.java
deleted file mode 100644
index 86ca3d6..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputExperimentCatResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputExperimentCatResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputExperimentCatResourceTest.java
index 6475bed..7fd3d71 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputExperimentCatResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputExperimentCatResourceTest.java
@@ -19,7 +19,7 @@
*
*/
-package org.apache.airavata.experiment.catalog;
+package org.apache.airavata.registry.core.experiment.catalog;
import org.apache.airavata.registry.core.experiment.catalog.ResourceType;
import org.apache.airavata.registry.core.experiment.catalog.resources.ExperimentExperimentCatResource;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentOutputResourceTest.java
deleted file mode 100644
index 605b0ae..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.java
deleted file mode 100644
index ac39f41..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/ExperimentResourceTest.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.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/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GFacJobDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GFacJobDataResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GFacJobDataResourceTest.java
deleted file mode 100644
index c546aca..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GFacJobStatusResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GFacJobStatusResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GFacJobStatusResourceTest.java
deleted file mode 100644
index 9cf648e..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayExperimentCatResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayExperimentCatResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayExperimentCatResourceTest.java
index 18d469e..6f8f92a 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayExperimentCatResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayExperimentCatResourceTest.java
@@ -19,7 +19,7 @@
*
*/
-package org.apache.airavata.experiment.catalog;
+package org.apache.airavata.registry.core.experiment.catalog;
import static org.junit.Assert.*;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GatewayResourceTest.java
deleted file mode 100644
index bd11353..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GramDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GramDataResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/GramDataResourceTest.java
deleted file mode 100644
index 47f8399..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/NodeDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/NodeDataResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/NodeDataResourceTest.java
deleted file mode 100644
index e13c1ff..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/OrchestratorDataResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/OrchestratorDataResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/OrchestratorDataResourceTest.java
deleted file mode 100644
index e545965..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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();
-// }
-//
-//
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailExperimentCatResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailExperimentCatResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailExperimentCatResourceTest.java
index 6b60beb..d1b7e6e 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailExperimentCatResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailExperimentCatResourceTest.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.airavata.experiment.catalog;
+package org.apache.airavata.registry.core.experiment.catalog;
import static org.junit.Assert.*;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/TaskDetailResourceTest.java
deleted file mode 100644
index 916f03e..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserExperimentCatResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserExperimentCatResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserExperimentCatResourceTest.java
index 63408b4..102f6fa 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserExperimentCatResourceTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserExperimentCatResourceTest.java
@@ -19,7 +19,7 @@
*
*/
-package org.apache.airavata.experiment.catalog;
+package org.apache.airavata.registry.core.experiment.catalog;
import static org.junit.Assert.*;
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserResourceTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/UserResourceTest.java
deleted file mode 100644
index dfd45b1..0000000
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/experiment/catalog/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.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 {
- }
-}
[08/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/AbstractResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/AbstractResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/AbstractResource.java
deleted file mode 100644
index 86ae071..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/AdvanceInputDataHandlingResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/AdvanceInputDataHandlingResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/AdvanceInputDataHandlingResource.java
deleted file mode 100644
index b2995dd..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/AdvanceInputDataHandlingResource.java
+++ /dev/null
@@ -1,160 +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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/AdvancedOutputDataHandlingResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/AdvancedOutputDataHandlingResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/AdvancedOutputDataHandlingResource.java
deleted file mode 100644
index fc6b049..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/AdvancedOutputDataHandlingResource.java
+++ /dev/null
@@ -1,150 +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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ApplicationInputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ApplicationInputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ApplicationInputResource.java
deleted file mode 100644
index b694d38..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ApplicationInputResource.java
+++ /dev/null
@@ -1,230 +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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ApplicationOutputResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ApplicationOutputResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ApplicationOutputResource.java
deleted file mode 100644
index a1c3b5a..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ApplicationOutputResource.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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ComputationSchedulingResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ComputationSchedulingResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ComputationSchedulingResource.java
deleted file mode 100644
index 506e603..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ComputationSchedulingResource.java
+++ /dev/null
@@ -1,221 +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.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();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ConfigDataResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ConfigDataResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ConfigDataResource.java
deleted file mode 100644
index 7038ede..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ConfigDataResource.java
+++ /dev/null
@@ -1,194 +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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ConfigurationResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ConfigurationResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ConfigurationResource.java
deleted file mode 100644
index a6e9d5e..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ConfigurationResource.java
+++ /dev/null
@@ -1,204 +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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/DataTransferDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/DataTransferDetailResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/DataTransferDetailResource.java
deleted file mode 100644
index 5e48333..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ErrorDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ErrorDetailResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ErrorDetailResource.java
deleted file mode 100644
index f2426fc..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/resources/ErrorDetailResource.java
+++ /dev/null
@@ -1,215 +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.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();
- }
- }
- }
-}
[16/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostIPAddressResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostIPAddressResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostIPAddressResource.java
deleted file mode 100644
index 683efec..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/HostIPAddressResource.java
+++ /dev/null
@@ -1,318 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.HostIPAddress;
-import org.apache.aiaravata.application.catalog.data.model.HostIPAddressPK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class HostIPAddressResource extends AbstractResource{
-
- private final static Logger logger = LoggerFactory.getLogger(HostIPAddressResource.class);
-
- private String resourceID;
- private String ipaddress;
- private ComputeResourceResource computeHostResource;
-
- public void remove(Object identifier) throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(HOST_IPADDRESS);
- generator.setParameter(HostIPAddressConstants.RESOURCE_ID, identifier);
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
- }
-
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_IPADDRESS);
- generator.setParameter(HostIPAddressConstants.RESOURCE_ID, ids.get(HostIPAddressConstants.RESOURCE_ID));
- generator.setParameter(HostIPAddressConstants.IP_ADDRESS, ids.get(HostIPAddressConstants.IP_ADDRESS));
- Query q = generator.selectQuery(em);
- HostIPAddress hostIPAddress = (HostIPAddress) q.getSingleResult();
- HostIPAddressResource hostIPAddressResource =
- (HostIPAddressResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
- em.getTransaction().commit();
- em.close();
- return hostIPAddressResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
-
- List<Resource> hostIPAddressResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_IPADDRESS);
- List results;
- if (fieldName.equals(HostIPAddressConstants.IP_ADDRESS)) {
- generator.setParameter(HostIPAddressConstants.IP_ADDRESS, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- HostIPAddress hostIPAddress = (HostIPAddress) result;
- HostIPAddressResource hostIPAddressResource =
- (HostIPAddressResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
- hostIPAddressResources.add(hostIPAddressResource);
- }
- }
- } else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
- generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- HostIPAddress hostIPAddress = (HostIPAddress) result;
- HostIPAddressResource hostIPAddressResource =
- (HostIPAddressResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
- hostIPAddressResources.add(hostIPAddressResource);
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Host IPAddress Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Host IPAddress Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return hostIPAddressResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-
- List<String> hostIPAddressResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_IPADDRESS);
- List results;
- if (fieldName.equals(HostIPAddressConstants.IP_ADDRESS)) {
- generator.setParameter(HostIPAddressConstants.IP_ADDRESS, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- HostIPAddress hostIPAddress = (HostIPAddress) result;
- hostIPAddressResourceIDs.add(hostIPAddress.getResourceID());
- }
- }
- } else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
- generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- HostIPAddress hostIPAddress = (HostIPAddress) result;
- hostIPAddressResourceIDs.add(hostIPAddress.getResourceID());
- }
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Host IP Address resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Host IPAddress Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return hostIPAddressResourceIDs;
- }
-
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- HostIPAddress existingHostIP = em.find(HostIPAddress.class, new HostIPAddressPK(resourceID,ipaddress));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
- if (existingHostIP != null){
- existingHostIP.setIpaddress(ipaddress);
- existingHostIP.setResourceID(resourceID);
- existingHostIP.setComputeResource(computeResource);
- em.merge(existingHostIP);
- }else {
- HostIPAddress hostIPAddress = new HostIPAddress();
- hostIPAddress.setIpaddress(ipaddress);
- hostIPAddress.setResourceID(resourceID);
- hostIPAddress.setComputeResource(computeResource);
- em.persist(hostIPAddress);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
-
- }
-
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
-
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- HostIPAddress hostIPAddress = em.find(HostIPAddress.class, new HostIPAddressPK(ids.get(HostIPAddressConstants.RESOURCE_ID),
- ids.get(HostIPAddressConstants.IP_ADDRESS)));
-
- em.close();
- return hostIPAddress != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getResourceID() {
- return resourceID;
- }
-
- public void setResourceID(String resourceID) {
- this.resourceID = resourceID;
- }
-
- public String getIpaddress() {
- return ipaddress;
- }
-
- public void setIpaddress(String ipaddress) {
- this.ipaddress = ipaddress;
- }
-
- public ComputeResourceResource getComputeHostResource() {
- return computeHostResource;
- }
-
- public void setComputeHostResource(ComputeResourceResource computeHostResource) {
- this.computeHostResource = computeHostResource;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobManagerCommandResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobManagerCommandResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobManagerCommandResource.java
deleted file mode 100644
index e177cd3..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobManagerCommandResource.java
+++ /dev/null
@@ -1,307 +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.aiaravata.application.catalog.data.resources;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.JobManagerCommand;
-import org.apache.aiaravata.application.catalog.data.model.JobManagerCommand_PK;
-import org.apache.aiaravata.application.catalog.data.model.ResourceJobManager;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class JobManagerCommandResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(JobManagerCommandResource.class);
- private String resourceJobManagerId;
- private ResourceJobManagerResource resourceJobManagerResource;
- private String commandType;
- private String command;
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_MANAGER_COMMAND);
- generator.setParameter(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID, ids.get(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID));
- generator.setParameter(JobManagerCommandConstants.COMMAND_TYPE, ids.get(JobManagerCommandConstants.COMMAND_TYPE));
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_MANAGER_COMMAND);
- generator.setParameter(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID, ids.get(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID));
- generator.setParameter(JobManagerCommandConstants.COMMAND_TYPE, ids.get(JobManagerCommandConstants.COMMAND_TYPE));
- Query q = generator.selectQuery(em);
- JobManagerCommand jobManagerCommand = (JobManagerCommand) q.getSingleResult();
- JobManagerCommandResource jobManagerCommandResource = (JobManagerCommandResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_MANAGER_COMMAND, jobManagerCommand);
- em.getTransaction().commit();
- em.close();
- return jobManagerCommandResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> jobManagerCommandResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_MANAGER_COMMAND);
- Query q;
- if ((fieldName.equals(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(JobManagerCommandConstants.COMMAND_TYPE)) || (fieldName.equals(JobManagerCommandConstants.COMMAND))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- JobManagerCommand jobManagerCommand = (JobManagerCommand) result;
- JobManagerCommandResource jobManagerCommandResource = (JobManagerCommandResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_MANAGER_COMMAND, jobManagerCommand);
- jobManagerCommandResources.add(jobManagerCommandResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Job Manager Command Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Job Manager Command Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return jobManagerCommandResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> jobManagerCommandResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_MANAGER_COMMAND);
- Query q;
- if ((fieldName.equals(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID)) || (fieldName.equals(JobManagerCommandConstants.COMMAND_TYPE)) || (fieldName.equals(JobManagerCommandConstants.COMMAND))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- JobManagerCommand jobManagerCommand = (JobManagerCommand) result;
- JobManagerCommandResource jobManagerCommandResource = (JobManagerCommandResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_MANAGER_COMMAND, jobManagerCommand);
- jobManagerCommandResourceIDs.add(jobManagerCommandResource.getResourceJobManagerId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Job Manager Command Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Job Manager Command Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return jobManagerCommandResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- JobManagerCommand existingJobManagerCommand = em.find(JobManagerCommand.class, new JobManagerCommand_PK(resourceJobManagerId, commandType));
- em.close();
- JobManagerCommand jobManagerCommand;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingJobManagerCommand == null) {
- jobManagerCommand = new JobManagerCommand();
- } else {
- jobManagerCommand = existingJobManagerCommand;
- }
- jobManagerCommand.setResourceJobManagerId(getResourceJobManagerId());
- ResourceJobManager resourceJobManager = em.find(ResourceJobManager.class, getResourceJobManagerId());
- jobManagerCommand.setResourceJobManager(resourceJobManager);
- jobManagerCommand.setCommandType(getCommandType());
- jobManagerCommand.setCommand(getCommand());
- if (existingJobManagerCommand == null) {
- em.persist(jobManagerCommand);
- } else {
- em.merge(jobManagerCommand);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- JobManagerCommand jobManagerCommand = em.find(JobManagerCommand.class, new JobManagerCommand_PK(ids.get(JobManagerCommandConstants.RESOURCE_JOB_MANAGER_ID), ids.get(JobManagerCommandConstants.COMMAND_TYPE)));
- em.close();
- return jobManagerCommand != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getResourceJobManagerId() {
- return resourceJobManagerId;
- }
-
- public ResourceJobManagerResource getResourceJobManagerResource() {
- return resourceJobManagerResource;
- }
-
- public String getCommandType() {
- return commandType;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setResourceJobManagerId(String resourceJobManagerId) {
- this.resourceJobManagerId=resourceJobManagerId;
- }
-
- public void setResourceJobManagerResource(ResourceJobManagerResource resourceJobManagerResource) {
- this.resourceJobManagerResource=resourceJobManagerResource;
- }
-
- public void setCommandType(String commandType) {
- this.commandType=commandType;
- }
-
- public void setCommand(String command) {
- this.command=command;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionInterfaceResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionInterfaceResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionInterfaceResource.java
deleted file mode 100644
index a5acbef..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionInterfaceResource.java
+++ /dev/null
@@ -1,339 +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.aiaravata.application.catalog.data.resources;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-import org.apache.aiaravata.application.catalog.data.model.JobSubmissionInterface;
-import org.apache.aiaravata.application.catalog.data.model.JobSubmissionInterface_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class JobSubmissionInterfaceResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(JobSubmissionInterfaceResource.class);
- private String jobSubmissionInterfaceId;
- private String computeResourceId;
- private ComputeResourceResource computeHostResource;
- private String jobSubmissionProtocol;
- private int priorityOrder;
- private Timestamp createdTime;
- private Timestamp updatedTime;
-
- public Timestamp getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Timestamp createdTime) {
- this.createdTime = createdTime;
- }
-
- public Timestamp getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(Timestamp updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_INTERFACE);
- generator.setParameter(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID, ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID));
- generator.setParameter(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID));
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_INTERFACE);
- generator.setParameter(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID, ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID));
- generator.setParameter(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID));
- Query q = generator.selectQuery(em);
- JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) q.getSingleResult();
- JobSubmissionInterfaceResource jobSubmissionInterfaceResource = (JobSubmissionInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
- em.getTransaction().commit();
- em.close();
- return jobSubmissionInterfaceResource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> jobSubmissionInterfaceResources = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_INTERFACE);
- Query q;
- if ((fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_PROTOCOL)) || (fieldName.equals(JobSubmissionInterfaceConstants.PRIORITY_ORDER))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) result;
- JobSubmissionInterfaceResource jobSubmissionInterfaceResource = (JobSubmissionInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
- jobSubmissionInterfaceResources.add(jobSubmissionInterfaceResource);
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Job Submission Interface Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Job Submission Interface Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return jobSubmissionInterfaceResources;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- List<String> jobSubmissionInterfaceResourceIDs = new ArrayList<String>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_INTERFACE);
- Query q;
- if ((fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)) || (fieldName.equals(JobSubmissionInterfaceConstants.JOB_SUBMISSION_PROTOCOL)) || (fieldName.equals(JobSubmissionInterfaceConstants.PRIORITY_ORDER))) {
- generator.setParameter(fieldName, value);
- q = generator.selectQuery(em);
- List<?> results = q.getResultList();
- for (Object result : results) {
- JobSubmissionInterface jobSubmissionInterface = (JobSubmissionInterface) result;
- JobSubmissionInterfaceResource jobSubmissionInterfaceResource = (JobSubmissionInterfaceResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_INTERFACE, jobSubmissionInterface);
- jobSubmissionInterfaceResourceIDs.add(jobSubmissionInterfaceResource.getComputeResourceId());
- }
- } else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for Job Submission Interface Resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for Job Submission Interface Resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return jobSubmissionInterfaceResourceIDs;
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- JobSubmissionInterface existingJobSubmissionInterface = em.find(JobSubmissionInterface.class, new JobSubmissionInterface_PK(jobSubmissionInterfaceId, computeResourceId));
- em.close();
- JobSubmissionInterface jobSubmissionInterface;
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- if (existingJobSubmissionInterface == null) {
- jobSubmissionInterface = new JobSubmissionInterface();
- jobSubmissionInterface.setCreationTime(AiravataUtils.getCurrentTimestamp());
- } else {
- jobSubmissionInterface = existingJobSubmissionInterface;
- jobSubmissionInterface.setUpdateTime(AiravataUtils.getCurrentTimestamp());
- }
- jobSubmissionInterface.setJobSubmissionInterfaceId(getJobSubmissionInterfaceId());
- jobSubmissionInterface.setComputeResourceId(getComputeResourceId());
- ComputeResource computeResource = em.find(ComputeResource.class, getComputeResourceId());
- jobSubmissionInterface.setComputeResource(computeResource);
- jobSubmissionInterface.setJobSubmissionProtocol(getJobSubmissionProtocol());
- jobSubmissionInterface.setPriorityOrder(getPriorityOrder());
- if (existingJobSubmissionInterface == null) {
- em.persist(jobSubmissionInterface);
- } else {
- em.merge(jobSubmissionInterface);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map) {
- ids = (HashMap<String, String>) identifier;
- } else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- JobSubmissionInterface jobSubmissionInterface = em.find(JobSubmissionInterface.class, new JobSubmissionInterface_PK(ids.get(JobSubmissionInterfaceConstants.JOB_SUBMISSION_INTERFACE_ID), ids.get(JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID)));
- em.close();
- return jobSubmissionInterface != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- public String getJobSubmissionInterfaceId() {
- return jobSubmissionInterfaceId;
- }
-
- public String getComputeResourceId() {
- return computeResourceId;
- }
-
- public ComputeResourceResource getComputeHostResource() {
- return computeHostResource;
- }
-
- public String getJobSubmissionProtocol() {
- return jobSubmissionProtocol;
- }
-
- public int getPriorityOrder() {
- return priorityOrder;
- }
-
- public void setJobSubmissionInterfaceId(String jobSubmissionInterfaceId) {
- this.jobSubmissionInterfaceId=jobSubmissionInterfaceId;
- }
-
- public void setComputeResourceId(String computeResourceId) {
- this.computeResourceId=computeResourceId;
- }
-
- public void setComputeHostResource(ComputeResourceResource computeHostResource) {
- this.computeHostResource=computeHostResource;
- }
-
- public void setJobSubmissionProtocol(String jobSubmissionProtocol) {
- this.jobSubmissionProtocol=jobSubmissionProtocol;
- }
-
- public void setPriorityOrder(int priorityOrder) {
- this.priorityOrder=priorityOrder;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionProtocolResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionProtocolResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionProtocolResource.java
deleted file mode 100644
index c3c8315..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/JobSubmissionProtocolResource.java
+++ /dev/null
@@ -1,359 +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.aiaravata.application.catalog.data.resources;
-//
-//import org.apache.airavata.registry.cpi.AppCatalogException;
-//import org.apache.aiaravata.application.catalog.data.model.ComputeResource;
-//import org.apache.aiaravata.application.catalog.data.model.JobSubmissionProtocol;
-//import org.apache.aiaravata.application.catalog.data.model.JobSubmissionProtocolPK;
-//import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-//import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-//import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-//import org.apache.airavata.common.exception.ApplicationSettingsException;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//
-//import javax.persistence.EntityManager;
-//import javax.persistence.Query;
-//import java.util.ArrayList;
-//import java.util.HashMap;
-//import java.util.List;
-//import java.util.Map;
-//
-//public class JobSubmissionProtocolResource extends AbstractResource {
-//
-// private final static Logger logger = LoggerFactory.getLogger(JobSubmissionProtocolResource.class);
-//
-// private String resourceID;
-// private String submissionID;
-// private String jobType;
-// private ComputeResourceResource computeHostResource;
-//
-// public void remove(Object identifier) throws AppCatalogException {
-// HashMap<String, String> ids;
-// if (identifier instanceof Map) {
-// ids = (HashMap) identifier;
-// } else {
-// logger.error("Identifier should be a map with the field name and it's value");
-// throw new AppCatalogException("Identifier should be a map with the field name and it's value");
-// }
-//
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// em.getTransaction().begin();
-// AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_PROTOCOL);
-// generator.setParameter(JobSubmissionProtocolConstants.RESOURCE_ID, ids.get(JobSubmissionProtocolConstants.RESOURCE_ID));
-// generator.setParameter(JobSubmissionProtocolConstants.SUBMISSION_ID, ids.get(JobSubmissionProtocolConstants.SUBMISSION_ID));
-// generator.setParameter(JobSubmissionProtocolConstants.JOB_TYPE, ids.get(JobSubmissionProtocolConstants.JOB_TYPE));
-// Query q = generator.deleteQuery(em);
-// q.executeUpdate();
-// em.getTransaction().commit();
-// em.close();
-// } catch (ApplicationSettingsException e) {
-// logger.error(e.getMessage(), e);
-// throw new AppCatalogException(e);
-// } finally {
-// if (em != null && em.isOpen()) {
-// if (em.getTransaction().isActive()) {
-// em.getTransaction().rollback();
-// }
-// em.close();
-// }
-// }
-// }
-//
-// public Resource get(Object identifier) throws AppCatalogException {
-// HashMap<String, String> ids;
-// if (identifier instanceof Map) {
-// ids = (HashMap) identifier;
-// } else {
-// logger.error("Identifier should be a map with the field name and it's value");
-// throw new AppCatalogException("Identifier should be a map with the field name and it's value");
-// }
-//
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// em.getTransaction().begin();
-// AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_PROTOCOL);
-// generator.setParameter(JobSubmissionProtocolConstants.RESOURCE_ID, ids.get(JobSubmissionProtocolConstants.RESOURCE_ID));
-// generator.setParameter(JobSubmissionProtocolConstants.SUBMISSION_ID, ids.get(JobSubmissionProtocolConstants.SUBMISSION_ID));
-// generator.setParameter(JobSubmissionProtocolConstants.JOB_TYPE, ids.get(JobSubmissionProtocolConstants.JOB_TYPE));
-// Query q = generator.selectQuery(em);
-// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) q.getSingleResult();
-// JobSubmissionProtocolResource jobSubmissionProtocolResource =
-// (JobSubmissionProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_PROTOCOL, jobSubmissionProtocol);
-// em.getTransaction().commit();
-// em.close();
-// return jobSubmissionProtocolResource;
-// } catch (ApplicationSettingsException e) {
-// logger.error(e.getMessage(), e);
-// throw new AppCatalogException(e);
-// } finally {
-// if (em != null && em.isOpen()) {
-// if (em.getTransaction().isActive()) {
-// em.getTransaction().rollback();
-// }
-// em.close();
-// }
-// }
-// }
-//
-// public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
-// List<Resource> jobSubmissionProtocolResourceList = new ArrayList<Resource>();
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// em.getTransaction().begin();
-// Query q;
-// AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_PROTOCOL);
-// List results;
-// if (fieldName.equals(JobSubmissionProtocolConstants.SUBMISSION_ID)) {
-// generator.setParameter(JobSubmissionProtocolConstants.SUBMISSION_ID, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-// JobSubmissionProtocolResource jobSubmissionProtocolResource =
-// (JobSubmissionProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_PROTOCOL, jobSubmissionProtocol);
-// jobSubmissionProtocolResourceList.add(jobSubmissionProtocolResource);
-// }
-// }
-// } else if (fieldName.equals(JobSubmissionProtocolConstants.JOB_TYPE)) {
-// generator.setParameter(JobSubmissionProtocolConstants.JOB_TYPE, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-// JobSubmissionProtocolResource jobSubmissionProtocolResource =
-// (JobSubmissionProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_PROTOCOL, jobSubmissionProtocol);
-// jobSubmissionProtocolResourceList.add(jobSubmissionProtocolResource);
-// }
-// }
-// } else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
-// generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-// JobSubmissionProtocolResource jobSubmissionProtocolResource =
-// (JobSubmissionProtocolResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.JOB_SUBMISSION_PROTOCOL, jobSubmissionProtocol);
-// jobSubmissionProtocolResourceList.add(jobSubmissionProtocolResource);
-// }
-// }
-// } else {
-// em.getTransaction().commit();
-// em.close();
-// logger.error("Unsupported field name for Job Submission Protocol Resource.", new IllegalArgumentException());
-// throw new IllegalArgumentException("Unsupported field name for Job Submission Protocol Resource.");
-// }
-// em.getTransaction().commit();
-// em.close();
-// } catch (Exception e) {
-// logger.error(e.getMessage(), e);
-// throw new AppCatalogException(e);
-// } finally {
-// if (em != null && em.isOpen()) {
-// if (em.getTransaction().isActive()) {
-// em.getTransaction().rollback();
-// }
-// em.close();
-// }
-// }
-// return jobSubmissionProtocolResourceList;
-// }
-//
-// @Override
-// public List<Resource> getAll() throws AppCatalogException {
-// return null;
-// }
-//
-// @Override
-// public List<String> getAllIds() throws AppCatalogException {
-// return null;
-// }
-//
-// public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
-// List<String> jobSubmissionProtocolIDs = new ArrayList<String>();
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// em.getTransaction().begin();
-// Query q;
-// AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(JOB_SUBMISSION_PROTOCOL);
-// List results;
-// if (fieldName.equals(JobSubmissionProtocolConstants.SUBMISSION_ID)) {
-// generator.setParameter(JobSubmissionProtocolConstants.SUBMISSION_ID, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-// jobSubmissionProtocolIDs.add(jobSubmissionProtocol.getSubmissionID());
-// }
-// }
-// } else if (fieldName.equals(JobSubmissionProtocolConstants.RESOURCE_ID)) {
-// generator.setParameter(JobSubmissionProtocolConstants.RESOURCE_ID, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-// jobSubmissionProtocolIDs.add(jobSubmissionProtocol.getSubmissionID());
-// }
-// }
-// } else if (fieldName.equals(JobSubmissionProtocolConstants.JOB_TYPE)) {
-// generator.setParameter(JobSubmissionProtocolConstants.JOB_TYPE, value);
-// q = generator.selectQuery(em);
-// results = q.getResultList();
-// if (results.size() != 0) {
-// for (Object result : results) {
-// JobSubmissionProtocol jobSubmissionProtocol = (JobSubmissionProtocol) result;
-// jobSubmissionProtocolIDs.add(jobSubmissionProtocol.getSubmissionID());
-// }
-// }
-// } else {
-// em.getTransaction().commit();
-// em.close();
-// logger.error("Unsupported field name for Job Submission Protocol resource.", new IllegalArgumentException());
-// throw new IllegalArgumentException("Unsupported field name for Job Submission Protocol Resource.");
-// }
-// em.getTransaction().commit();
-// em.close();
-// } catch (Exception e) {
-// logger.error(e.getMessage(), e);
-// throw new AppCatalogException(e);
-// } finally {
-// if (em != null && em.isOpen()) {
-// if (em.getTransaction().isActive()) {
-// em.getTransaction().rollback();
-// }
-// em.close();
-// }
-// }
-// return jobSubmissionProtocolIDs;
-// }
-//
-// public void save() throws AppCatalogException {
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// JobSubmissionProtocol existingJobSubProtocol = em.find(JobSubmissionProtocol.class, new JobSubmissionProtocolPK(resourceID, submissionID, jobType));
-// em.close();
-//
-// em = AppCatalogJPAUtils.getEntityManager();
-// em.getTransaction().begin();
-// ComputeResource computeResource = em.find(ComputeResource.class, resourceID);
-// if (existingJobSubProtocol != null) {
-// existingJobSubProtocol.setJobType(jobType);
-// existingJobSubProtocol.setSubmissionID(submissionID);
-// existingJobSubProtocol.setComputeResource(computeResource);
-// existingJobSubProtocol.setResourceID(resourceID);
-// em.merge(existingJobSubProtocol);
-// } else {
-// JobSubmissionProtocol jobSubmissionProtocol = new JobSubmissionProtocol();
-// jobSubmissionProtocol.setJobType(jobType);
-// jobSubmissionProtocol.setSubmissionID(submissionID);
-// jobSubmissionProtocol.setResourceID(resourceID);
-// jobSubmissionProtocol.setComputeResource(computeResource);
-// em.persist(jobSubmissionProtocol);
-// }
-// em.getTransaction().commit();
-// em.close();
-// } catch (Exception e) {
-// logger.error(e.getMessage(), e);
-// throw new AppCatalogException(e);
-// } finally {
-// if (em != null && em.isOpen()) {
-// if (em.getTransaction().isActive()) {
-// em.getTransaction().rollback();
-// }
-// em.close();
-// }
-// }
-//
-// }
-//
-// public boolean isExists(Object identifier) throws AppCatalogException {
-// HashMap<String, String> ids;
-// if (identifier instanceof Map) {
-// ids = (HashMap) identifier;
-// } else {
-// logger.error("Identifier should be a map with the field name and it's value");
-// throw new AppCatalogException("Identifier should be a map with the field name and it's value");
-// }
-//
-// EntityManager em = null;
-// try {
-// em = AppCatalogJPAUtils.getEntityManager();
-// JobSubmissionProtocol jobSubmissionProtocol = em.find(JobSubmissionProtocol.class, new JobSubmissionProtocolPK(ids.get(JobSubmissionProtocolConstants.RESOURCE_ID),
-// ids.get(JobSubmissionProtocolConstants.SUBMISSION_ID), ids.get(JobSubmissionProtocolConstants.JOB_TYPE)));
-//
-// em.close();
-// return jobSubmissionProtocol != null;
-// } catch (ApplicationSettingsException e) {
-// logger.error(e.getMessage(), e);
-// throw new AppCatalogException(e);
-// } finally {
-// if (em != null && em.isOpen()) {
-// if (em.getTransaction().isActive()) {
-// em.getTransaction().rollback();
-// }
-// em.close();
-// }
-// }
-// }
-//
-// public String getResourceID() {
-// return resourceID;
-// }
-//
-// public void setResourceID(String resourceID) {
-// this.resourceID = resourceID;
-// }
-//
-// public String getSubmissionID() {
-// return submissionID;
-// }
-//
-// public void setSubmissionID(String submissionID) {
-// this.submissionID = submissionID;
-// }
-//
-// public String getJobType() {
-// return jobType;
-// }
-//
-// public void setJobType(String jobType) {
-// this.jobType = jobType;
-// }
-//
-// public ComputeResourceResource getComputeHostResource() {
-// return computeHostResource;
-// }
-//
-// public void setComputeHostResource(ComputeResourceResource computeHostResource) {
-// this.computeHostResource = computeHostResource;
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryApendPathResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryApendPathResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryApendPathResource.java
deleted file mode 100644
index 1f2286d..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryApendPathResource.java
+++ /dev/null
@@ -1,292 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.model.LibraryApendPath;
-import org.apache.aiaravata.application.catalog.data.model.LibraryApendPath_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class LibraryApendPathResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(LibraryApendPathResource.class);
- private String deploymentId;
- private String name;
- private String value;
- private AppDeploymentResource appDeploymentResource;
-
- public String getDeploymentId() {
- return deploymentId;
- }
-
- public void setDeploymentId(String deploymentId) {
- this.deploymentId = deploymentId;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public AppDeploymentResource getAppDeploymentResource() {
- return appDeploymentResource;
- }
-
- public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
- this.appDeploymentResource = appDeploymentResource;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(LIBRARY_APEND_PATH);
- generator.setParameter(LibraryApendPathConstants.DEPLOYMENT_ID, ids.get(LibraryApendPathConstants.DEPLOYMENT_ID));
- if (ids.get(LibraryApendPathConstants.NAME) != null){
- generator.setParameter(LibraryApendPathConstants.NAME, ids.get(LibraryApendPathConstants.NAME));
- }
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LIBRARY_APEND_PATH);
- generator.setParameter(LibraryApendPathConstants.DEPLOYMENT_ID, ids.get(LibraryApendPathConstants.DEPLOYMENT_ID));
- generator.setParameter(LibraryApendPathConstants.NAME, ids.get(LibraryApendPathConstants.NAME));
- Query q = generator.selectQuery(em);
- LibraryApendPath libraryApendPath = (LibraryApendPath) q.getSingleResult();
- LibraryApendPathResource resource =
- (LibraryApendPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_APEND_PATH, libraryApendPath);
- em.getTransaction().commit();
- em.close();
- return resource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> libApPathList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LIBRARY_APEND_PATH);
- List results;
- if (fieldName.equals(LibraryApendPathConstants.DEPLOYMENT_ID)) {
- generator.setParameter(LibraryApendPathConstants.DEPLOYMENT_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- LibraryApendPath prepandPath = (LibraryApendPath) result;
- LibraryApendPathResource resource =
- (LibraryApendPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_APEND_PATH, prepandPath);
- libApPathList.add(resource);
- }
- }
- } else if (fieldName.equals(LibraryApendPathConstants.NAME)) {
- generator.setParameter(LibraryApendPathConstants.NAME, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- LibraryApendPath prepandPath = (LibraryApendPath) result;
- LibraryApendPathResource resource =
- (LibraryApendPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_APEND_PATH, prepandPath);
- libApPathList.add(resource);
- }
- }
- }else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for libraryApendPath resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for libraryApendPath resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return libApPathList;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- logger.error("Unsupported for objects with a composite identifier");
- throw new AppCatalogException("Unsupported for objects with a composite identifier");
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- LibraryApendPath existigApendPath = em.find(LibraryApendPath.class, new LibraryApendPath_PK(deploymentId, name));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
-
- ApplicationDeployment deployment = em.find(ApplicationDeployment.class, deploymentId);
- if (existigApendPath != null){
- existigApendPath.setValue(value);
- existigApendPath.setApplicationDeployment(deployment);
- em.merge(existigApendPath);
- }else {
- LibraryApendPath apendPath = new LibraryApendPath();
- apendPath.setDeploymentID(deploymentId);
- apendPath.setName(name);
- apendPath.setValue(value);
- apendPath.setApplicationDeployment(deployment);
- em.persist(apendPath);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- LibraryApendPath apendPath = em.find(LibraryApendPath.class,
- new LibraryApendPath_PK(ids.get(LibraryApendPathConstants.DEPLOYMENT_ID),
- ids.get(LibraryApendPathConstants.NAME)));
- em.close();
- return apendPath != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryPrepandPathResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryPrepandPathResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryPrepandPathResource.java
deleted file mode 100644
index e4a9b33..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/LibraryPrepandPathResource.java
+++ /dev/null
@@ -1,291 +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.aiaravata.application.catalog.data.resources;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.apache.aiaravata.application.catalog.data.model.ApplicationDeployment;
-import org.apache.aiaravata.application.catalog.data.model.LibraryPrepandPath;
-import org.apache.aiaravata.application.catalog.data.model.LibraryPrepandPath_PK;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogJPAUtils;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogQueryGenerator;
-import org.apache.aiaravata.application.catalog.data.util.AppCatalogResourceType;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class LibraryPrepandPathResource extends AbstractResource {
- private final static Logger logger = LoggerFactory.getLogger(LibraryPrepandPathResource.class);
- private String deploymentId;
- private String name;
- private String value;
- private AppDeploymentResource appDeploymentResource;
-
- public String getDeploymentId() {
- return deploymentId;
- }
-
- public void setDeploymentId(String deploymentId) {
- this.deploymentId = deploymentId;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public AppDeploymentResource getAppDeploymentResource() {
- return appDeploymentResource;
- }
-
- public void setAppDeploymentResource(AppDeploymentResource appDeploymentResource) {
- this.appDeploymentResource = appDeploymentResource;
- }
-
- @Override
- public void remove(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(LIBRARY_PREPAND_PATH);
- generator.setParameter(LibraryPrepandPathConstants.DEPLOYMENT_ID, ids.get(LibraryPrepandPathConstants.DEPLOYMENT_ID));
- if (ids.get(LibraryPrepandPathConstants.NAME) != null){
- generator.setParameter(LibraryPrepandPathConstants.NAME, ids.get(LibraryPrepandPathConstants.NAME));
- }
- Query q = generator.deleteQuery(em);
- q.executeUpdate();
- em.getTransaction().commit();
- em.close();
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public Resource get(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LIBRARY_PREPAND_PATH);
- generator.setParameter(LibraryPrepandPathConstants.DEPLOYMENT_ID, ids.get(LibraryPrepandPathConstants.DEPLOYMENT_ID));
- generator.setParameter(LibraryPrepandPathConstants.NAME, ids.get(LibraryPrepandPathConstants.NAME));
- Query q = generator.selectQuery(em);
- LibraryPrepandPath libraryPrepandPath = (LibraryPrepandPath) q.getSingleResult();
- LibraryPrepandPathResource resource =
- (LibraryPrepandPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_PREPAND_PATH, libraryPrepandPath);
- em.getTransaction().commit();
- em.close();
- return resource;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public List<Resource> get(String fieldName, Object value) throws AppCatalogException {
- List<Resource> libPrepPathList = new ArrayList<Resource>();
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- Query q;
- AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(LIBRARY_PREPAND_PATH);
- List results;
- if (fieldName.equals(LibraryPrepandPathConstants.DEPLOYMENT_ID)) {
- generator.setParameter(LibraryPrepandPathConstants.DEPLOYMENT_ID, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- LibraryPrepandPath prepandPath = (LibraryPrepandPath) result;
- LibraryPrepandPathResource resource =
- (LibraryPrepandPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_PREPAND_PATH, prepandPath);
- libPrepPathList.add(resource);
- }
- }
- } else if (fieldName.equals(LibraryPrepandPathConstants.NAME)) {
- generator.setParameter(LibraryPrepandPathConstants.NAME, value);
- q = generator.selectQuery(em);
- results = q.getResultList();
- if (results.size() != 0) {
- for (Object result : results) {
- LibraryPrepandPath prepandPath = (LibraryPrepandPath) result;
- LibraryPrepandPathResource resource =
- (LibraryPrepandPathResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.LIBRARY_PREPAND_PATH, prepandPath);
- libPrepPathList.add(resource);
- }
- }
- }else {
- em.getTransaction().commit();
- em.close();
- logger.error("Unsupported field name for libraryPrepandPath resource.", new IllegalArgumentException());
- throw new IllegalArgumentException("Unsupported field name for libraryPrepandPath resource.");
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()) {
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- return libPrepPathList;
- }
-
- @Override
- public List<Resource> getAll() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getAllIds() throws AppCatalogException {
- return null;
- }
-
- @Override
- public List<String> getIds(String fieldName, Object value) throws AppCatalogException {
- logger.error("Unsupported for objects with a composite identifier");
- throw new AppCatalogException("Unsupported for objects with a composite identifier");
- }
-
- @Override
- public void save() throws AppCatalogException {
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- LibraryPrepandPath existigPrepPath = em.find(LibraryPrepandPath.class, new LibraryPrepandPath_PK(deploymentId, name));
- em.close();
-
- em = AppCatalogJPAUtils.getEntityManager();
- em.getTransaction().begin();
- ApplicationDeployment deployment = em.find(ApplicationDeployment.class, deploymentId);
- if (existigPrepPath != null){
- existigPrepPath.setValue(value);
- existigPrepPath.setApplicationDeployment(deployment);
- em.merge(existigPrepPath);
- }else {
- LibraryPrepandPath prepandPath = new LibraryPrepandPath();
- prepandPath.setDeploymentID(deploymentId);
- prepandPath.setName(name);
- prepandPath.setValue(value);
- prepandPath.setApplicationDeployment(deployment);
- em.persist(prepandPath);
- }
- em.getTransaction().commit();
- em.close();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-
- @Override
- public boolean isExists(Object identifier) throws AppCatalogException {
- HashMap<String, String> ids;
- if (identifier instanceof Map){
- ids = (HashMap)identifier;
- }else {
- logger.error("Identifier should be a map with the field name and it's value");
- throw new AppCatalogException("Identifier should be a map with the field name and it's value");
- }
- EntityManager em = null;
- try {
- em = AppCatalogJPAUtils.getEntityManager();
- LibraryPrepandPath prepandPath = em.find(LibraryPrepandPath.class,
- new LibraryPrepandPath_PK(ids.get(LibraryPrepandPathConstants.DEPLOYMENT_ID),
- ids.get(LibraryPrepandPathConstants.NAME)));
- em.close();
- return prepandPath != null;
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AppCatalogException(e);
- } finally {
- if (em != null && em.isOpen()) {
- if (em.getTransaction().isActive()){
- em.getTransaction().rollback();
- }
- em.close();
- }
- }
- }
-}
[10/22] airavata git commit: adding registry changes
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/GatewayRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/GatewayRegistry.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/GatewayRegistry.java
deleted file mode 100644
index a98de72..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/LoggingExperimentCatalogImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/LoggingExperimentCatalogImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/LoggingExperimentCatalogImpl.java
deleted file mode 100644
index d45c4c5..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/LoggingExperimentCatalogImpl.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.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 LoggingExperimentCatalogImpl implements ExperimentCatalog {
- private final static Logger logger = LoggerFactory.getLogger(LoggingExperimentCatalogImpl.class);
-
- @Override
- public Object add(ExpCatParentDataType dataType, Object newObjectToAdd, String gatewayId) throws RegistryException {
- return null;
- }
-
- @Override
- public Object add(ExpCatChildDataType dataType, Object newObjectToAdd, Object dependentIdentifiers) throws RegistryException {
- return null;
- }
-
- @Override
- public void update(ExperimentCatalogModelType dataType, Object newObjectToUpdate, Object identifier) throws RegistryException {
-
- }
-
- @Override
- public void update(ExperimentCatalogModelType dataType, Object identifier, String fieldName, Object value) throws RegistryException {
-
- }
-
- @Override
- public Object get(ExperimentCatalogModelType dataType, Object identifier) throws RegistryException {
- return null;
- }
-
- @Override
- public List<Object> get(ExperimentCatalogModelType dataType, String fieldName, Object value) throws RegistryException {
- return null;
- }
-
- @Override
- public List<Object> get(ExperimentCatalogModelType dataType, String fieldName, Object value, int limit, int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- return null;
- }
-
- @Override
- public List<Object> search(ExperimentCatalogModelType dataType, Map<String, String> filters) throws RegistryException {
- return null;
- }
-
- @Override
- public List<Object> search(ExperimentCatalogModelType dataType, Map<String, String> filters, int limit, int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- return null;
- }
-
- @Override
- public Object getValue(ExperimentCatalogModelType dataType, Object identifier, String field) throws RegistryException {
- return null;
- }
-
- @Override
- public List<String> getIds(ExperimentCatalogModelType dataType, String fieldName, Object value) throws RegistryException {
- return null;
- }
-
- @Override
- public void remove(ExperimentCatalogModelType dataType, Object identifier) throws RegistryException {
-
- }
-
- @Override
- public boolean isExist(ExperimentCatalogModelType dataType, Object identifier) throws RegistryException {
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/ProjectRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/ProjectRegistry.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/ProjectRegistry.java
deleted file mode 100644
index 52a9ee4..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/RegistryFactory.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/RegistryFactory.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/RegistryFactory.java
deleted file mode 100644
index 5b8ce18..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.experiment.catalog.impl;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.registry.cpi.ExperimentCatalog;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RegistryFactory {
- private static ExperimentCatalog experimentCatalog;
- private static Logger logger = LoggerFactory.getLogger(RegistryFactory.class);
-
- public static ExperimentCatalog getRegistry(String gateway, String username, String password) throws RegistryException {
- try {
- if (experimentCatalog == null) {
- experimentCatalog = new ExperimentCatalogImpl(gateway, username, password);
- }
- } catch (RegistryException e) {
- logger.error("Unable to create registry instance", e);
- throw new RegistryException(e);
- }
- return experimentCatalog;
- }
-
- public static ExperimentCatalog getRegistry(String gateway) throws RegistryException {
- try {
- if (experimentCatalog == null) {
- experimentCatalog = new ExperimentCatalogImpl(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 experimentCatalog;
- }
-
- public static ExperimentCatalog getDefaultRegistry () throws RegistryException {
- try {
- if (experimentCatalog == null) {
- experimentCatalog = new ExperimentCatalogImpl();
- }
- } catch (RegistryException e) {
- logger.error("Unable to create registry instance", e);
- throw new RegistryException(e);
- }
- return experimentCatalog;
- }
-
- public static ExperimentCatalog getLoggingRegistry() {
- if(experimentCatalog == null) {
- experimentCatalog = new LoggingExperimentCatalogImpl();
- }
- return experimentCatalog;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/UserReg.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/UserReg.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/UserReg.java
deleted file mode 100644
index 67166e2..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/impl/UserReg.java
+++ /dev/null
@@ -1,41 +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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/AdvancedInputDataHandling.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/AdvancedInputDataHandling.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/AdvancedInputDataHandling.java
deleted file mode 100644
index 87fb256..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/AdvancedOutputDataHandling.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/AdvancedOutputDataHandling.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/AdvancedOutputDataHandling.java
deleted file mode 100644
index e3a35b4..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ApplicationInput.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ApplicationInput.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ApplicationInput.java
deleted file mode 100644
index 89cdf76..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ApplicationInput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ApplicationInput_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ApplicationInput_PK.java
deleted file mode 100644
index 84979b4..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ApplicationOutput.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ApplicationOutput.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ApplicationOutput.java
deleted file mode 100644
index d82ca87..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ApplicationOutput_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ApplicationOutput_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ApplicationOutput_PK.java
deleted file mode 100644
index 3ebc57a..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Computational_Resource_Scheduling.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Computational_Resource_Scheduling.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Computational_Resource_Scheduling.java
deleted file mode 100644
index a177722..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Configuration.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Configuration.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Configuration.java
deleted file mode 100644
index f3c72be..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Configuration_PK.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Configuration_PK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Configuration_PK.java
deleted file mode 100644
index 2f950dd..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/DataTransferDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/DataTransferDetail.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/DataTransferDetail.java
deleted file mode 100644
index ad41126..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/DataTransferDetail.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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ErrorDetail.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ErrorDetail.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ErrorDetail.java
deleted file mode 100644
index 46af8a5..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Experiment.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Experiment.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Experiment.java
deleted file mode 100644
index 6a7b13a..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/Experiment.java
+++ /dev/null
@@ -1,299 +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.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/5a648a60/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ExperimentConfigData.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ExperimentConfigData.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ExperimentConfigData.java
deleted file mode 100644
index 4510996..0000000
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experimet/catalog/model/ExperimentConfigData.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.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;
- }
-}