You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2013/12/26 18:31:40 UTC
svn commit: r1553518 [9/15] - in /airavata/sandbox: orchestrator-service/
orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/
orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/context/
or...
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ServiceDescriptorResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ServiceDescriptorResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ServiceDescriptorResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/ServiceDescriptorResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,56 @@
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+package org.apache.airavata.persistance.registry.jpa;
+
+import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.resources.ServiceDescriptorResource;
+
+public class ServiceDescriptorResourceTest extends AbstractResourceTest {
+ private GatewayResource gatewayResource;
+ private ServiceDescriptorResource serviceDescriptorResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ gatewayResource = super.getGatewayResource();
+ serviceDescriptorResource = gatewayResource.createServiceDescriptorResource("testServiceDesc");
+ serviceDescriptorResource.setUserName("admin");
+ serviceDescriptorResource.setContent("testContent");
+ }
+
+ public void testGetList() throws Exception {
+ assertNotNull("application data being retrieved successfully", serviceDescriptorResource.get(ResourceType.APPLICATION_DESCRIPTOR));
+ }
+
+ public void testSave() throws Exception {
+ serviceDescriptorResource.save();
+ assertTrue("service descriptor saved successfully", gatewayResource.isServiceDescriptorExists("testServiceDesc"));
+ //remove host descriptor
+ gatewayResource.removeServiceDescriptor("testServiceDesc");
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ }
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,49 @@
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+package org.apache.airavata.persistance.registry.jpa;
+
+import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
+
+public class UserResourceTest extends AbstractResourceTest {
+ private UserResource userResource;
+ private GatewayResource gatewayResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ gatewayResource = super.getGatewayResource();
+ userResource = super.getUserResource();
+ }
+
+ public void testSave() throws Exception {
+ userResource.save();
+ assertTrue("user resource saved successfully", gatewayResource.isExists(ResourceType.USER, "admin"));
+ //remove user
+// gatewayResource.remove(ResourceType.USER, "testUser");
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserWorkflowResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserWorkflowResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserWorkflowResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/UserWorkflowResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,62 @@
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+package org.apache.airavata.persistance.registry.jpa;
+
+import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.resources.UserWorkflowResource;
+import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
+
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.util.Calendar;
+
+public class UserWorkflowResourceTest extends AbstractResourceTest {
+ private WorkerResource workerResource;
+ private UserWorkflowResource userWorkflowResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ GatewayResource gatewayResource = super.getGatewayResource();
+ workerResource = super.getWorkerResource();
+
+ userWorkflowResource = workerResource.createWorkflowTemplate("workflow1");
+ userWorkflowResource.setGateway(gatewayResource);
+ userWorkflowResource.setContent("testContent");
+ Calendar calender = Calendar.getInstance();
+ java.util.Date d = calender.getTime();
+ Timestamp currentTime = new Timestamp(d.getTime());
+ userWorkflowResource.setLastUpdateDate(currentTime);
+ }
+
+ public void testSave() throws Exception {
+ userWorkflowResource.save();
+ assertTrue("user workflow saved successfully", workerResource.isWorkflowTemplateExists("workflow1"));
+ //remove user workflow
+ workerResource.removeWorkflowTemplate("workflow1");
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkerResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,122 @@
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+package org.apache.airavata.persistance.registry.jpa;
+
+import org.apache.airavata.persistance.registry.jpa.resources.*;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+
+public class WorkerResourceTest extends AbstractResourceTest {
+ private GatewayResource gatewayResource;
+ private WorkerResource workerResource;
+ private ProjectResource testProject;
+ private UserWorkflowResource userWorkflowResource;
+ private ExperimentResource experimentResource;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ gatewayResource = super.getGatewayResource();
+ workerResource = super.getWorkerResource();
+
+ testProject = workerResource.createProject("testProject");
+ userWorkflowResource = workerResource.createWorkflowTemplate("workflow1");
+ experimentResource = (ExperimentResource) workerResource.create(ResourceType.EXPERIMENT);
+
+ testProject.setGateway(gatewayResource);
+ testProject.save();
+
+ userWorkflowResource.setGateway(gatewayResource);
+ userWorkflowResource.setContent("testContent");
+ userWorkflowResource.save();
+
+ experimentResource.setGateway(gatewayResource);
+ experimentResource.setExpID("testExpID");
+ experimentResource.setProject(testProject);
+ Calendar calender = Calendar.getInstance();
+ java.util.Date d = calender.getTime();
+ Timestamp currentTime = new Timestamp(d.getTime());
+ experimentResource.setSubmittedDate(currentTime);
+ 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, "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));
+
+ }
+
+ 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.removeProject("testProject");
+ workerResource.removeWorkflowTemplate("workflow1");
+ workerResource.removeExperiment("testExpID");
+
+ assertTrue("project has been removed successfully", !workerResource.isProjectExists("testProject"));
+ assertTrue("experiment has been removed successfully", !workerResource.isExperimentExists("testExpID"));
+ assertTrue("user workflow has been removed successfully", !workerResource.isWorkflowTemplateExists("workflow1"));
+
+ testProject.setGateway(gatewayResource);
+ testProject.save();
+
+ userWorkflowResource.setGateway(gatewayResource);
+ userWorkflowResource.setContent("testContent");
+ userWorkflowResource.save();
+
+ experimentResource.setGateway(gatewayResource);
+ experimentResource.setExpID("testExpID");
+ experimentResource.setProject(testProject);
+ Calendar calender = Calendar.getInstance();
+ java.util.Date d = calender.getTime();
+ Timestamp currentTime = new Timestamp(d.getTime());
+ experimentResource.setSubmittedDate(currentTime);
+ experimentResource.save();
+
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowDataResourceTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowDataResourceTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowDataResourceTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/WorkflowDataResourceTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,110 @@
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+package org.apache.airavata.persistance.registry.jpa;
+
+import org.apache.airavata.persistance.registry.jpa.resources.*;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+
+public class WorkflowDataResourceTest extends AbstractResourceTest {
+ private ExperimentDataResource experimentDataResource;
+ 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 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();
+
+ workflowDataResource = (WorkflowDataResource) experimentDataResource.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", experimentDataResource.isWorkflowInstancePresent("testWFInstance"));
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,327 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.persistance.registry.jpa.util;
+
+import org.apache.airavata.persistance.registry.jpa.ResourceType;
+import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
+import org.apache.airavata.persistance.registry.jpa.resources.Utils;
+import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
+import org.apache.airavata.registry.api.exception.RegistrySettingsException;
+import org.apache.airavata.registry.api.util.RegistrySettings;
+import org.apache.derby.drda.NetworkServerControl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.InetAddress;
+import java.sql.*;
+import java.util.StringTokenizer;
+
+public class Initialize {
+ private static final Logger logger = LoggerFactory.getLogger(Initialize.class);
+ public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
+ private NetworkServerControl server;
+ private static final String delimiter = ";";
+ public static final String PERSISTANT_DATA = "Configuration";
+
+ public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
+ if (suffix.length() > buffer.length()) {
+ return false;
+ }
+ // this loop is done on purpose to avoid memory allocation performance
+ // problems on various JDKs
+ // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
+ // implementation is ok though does allocation/copying
+ // StringBuffer.toString().endsWith() does massive memory
+ // allocation/copying on JDK 1.5
+ // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
+ int endIndex = suffix.length() - 1;
+ int bufferIndex = buffer.length() - 1;
+ while (endIndex >= 0) {
+ if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
+ return false;
+ }
+ bufferIndex--;
+ endIndex--;
+ }
+ return true;
+ }
+
+ private static boolean isServerStarted(NetworkServerControl server, int ntries)
+ {
+ for (int i = 1; i <= ntries; i ++)
+ {
+ try {
+ Thread.sleep(500);
+ server.ping();
+ return true;
+ }
+ catch (Exception e) {
+ if (i == ntries)
+ return false;
+ }
+ }
+ return false;
+ }
+
+ public void initializeDB() {
+ String jdbcUrl = null;
+ String jdbcDriver = null;
+ String jdbcUser = null;
+ String jdbcPassword = null;
+ try{
+ jdbcDriver = RegistrySettings.getSetting("registry.jdbc.driver");
+ jdbcUrl = RegistrySettings.getSetting("registry.jdbc.url");
+ jdbcUser = RegistrySettings.getSetting("registry.jdbc.user");
+ jdbcPassword = RegistrySettings.getSetting("registry.jdbc.password");
+ jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+ } catch (RegistrySettingsException e) {
+ logger.error("Unable to read properties" , e);
+ }
+
+
+ startDerbyInServerMode();
+ if(!isServerStarted(server, 20)){
+ throw new RuntimeException("Derby server cound not started within five seconds...");
+ }
+// startDerbyInEmbeddedMode();
+
+ Connection conn = null;
+ try {
+ Class.forName(Utils.getJDBCDriver()).newInstance();
+ conn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword);
+ if (!isDatabaseStructureCreated(PERSISTANT_DATA, conn)) {
+ executeSQLScript(conn);
+ logger.info("New Database created for Registry");
+ } else {
+ logger.debug("Database already created for Registry!");
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RuntimeException("Database failure", e);
+ } finally {
+ try {
+ if (conn != null){
+ if (!conn.getAutoCommit()) {
+ conn.commit();
+ }
+ conn.close();
+ }
+ } catch (SQLException e) {
+ logger.error(e.getMessage(), e);
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+
+ try{
+ GatewayResource gatewayResource = new GatewayResource();
+ gatewayResource.setGatewayName(RegistrySettings.getSetting("default.registry.gateway"));
+ gatewayResource.setOwner(RegistrySettings.getSetting("default.registry.gateway"));
+ gatewayResource.save();
+
+ UserResource userResource = (UserResource) gatewayResource.create(ResourceType.USER);
+ userResource.setUserName(RegistrySettings.getSetting("default.registry.user"));
+ userResource.setPassword(RegistrySettings.getSetting("default.registry.password"));
+ userResource.save();
+
+ WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
+ workerResource.setUser(userResource.getUserName());
+ workerResource.save();
+ } catch (RegistrySettingsException e) {
+ logger.error("Unable to read properties", e);
+ }
+ }
+
+ public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
+ try {
+ System.out.println("Running a query to test the database tables existence.");
+ // check whether the tables are already created with a query
+ Statement statement = null;
+ try {
+ statement = conn.createStatement();
+ ResultSet rs = statement.executeQuery("select * from " + tableName);
+ if (rs != null) {
+ rs.close();
+ }
+ } finally {
+ try {
+ if (statement != null) {
+ statement.close();
+ }
+ } catch (SQLException e) {
+ return false;
+ }
+ }
+ } catch (SQLException e) {
+ return false;
+ }
+
+ return true;
+ }
+
+ private void executeSQLScript(Connection conn) throws Exception {
+ StringBuffer sql = new StringBuffer();
+ BufferedReader reader = null;
+ try{
+
+ InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("data-derby.sql");
+ reader = new BufferedReader(new InputStreamReader(inputStream));
+ String line;
+ while ((line = reader.readLine()) != null) {
+ line = line.trim();
+ if (line.startsWith("//")) {
+ continue;
+ }
+ if (line.startsWith("--")) {
+ continue;
+ }
+ StringTokenizer st = new StringTokenizer(line);
+ if (st.hasMoreTokens()) {
+ String token = st.nextToken();
+ if ("REM".equalsIgnoreCase(token)) {
+ continue;
+ }
+ }
+ sql.append(" ").append(line);
+
+ // SQL defines "--" as a comment to EOL
+ // and in Oracle it may contain a hint
+ // so we cannot just remove it, instead we must end it
+ if (line.indexOf("--") >= 0) {
+ sql.append("\n");
+ }
+ if ((checkStringBufferEndsWith(sql, delimiter))) {
+ executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
+ sql.replace(0, sql.length(), "");
+ }
+ }
+ // Catch any statements not followed by ;
+ if (sql.length() > 0) {
+ executeSQL(sql.toString(), conn);
+ }
+ }catch (IOException e){
+ logger.error("Error occurred while executing SQL script for creating Airavata database", e);
+ throw new Exception("Error occurred while executing SQL script for creating Airavata database", e);
+ }finally {
+ if (reader != null) {
+ reader.close();
+ }
+
+ }
+
+ }
+
+ private static void executeSQL(String sql, Connection conn) throws Exception {
+ // Check and ignore empty statements
+ if ("".equals(sql.trim())) {
+ return;
+ }
+
+ Statement statement = null;
+ try {
+ logger.debug("SQL : " + sql);
+
+ boolean ret;
+ int updateCount = 0, updateCountTotal = 0;
+ statement = conn.createStatement();
+ ret = statement.execute(sql);
+ updateCount = statement.getUpdateCount();
+ do {
+ if (!ret) {
+ if (updateCount != -1) {
+ updateCountTotal += updateCount;
+ }
+ }
+ ret = statement.getMoreResults();
+ if (ret) {
+ updateCount = statement.getUpdateCount();
+ }
+ } while (ret);
+
+ logger.debug(sql + " : " + updateCountTotal + " rows affected");
+
+ SQLWarning warning = conn.getWarnings();
+ while (warning != null) {
+ logger.warn(warning + " sql warning");
+ warning = warning.getNextWarning();
+ }
+ conn.clearWarnings();
+ } catch (SQLException e) {
+ if (e.getSQLState().equals("X0Y32")) {
+ // eliminating the table already exception for the derby
+ // database
+ logger.info("Table Already Exists", e);
+ } else {
+ throw new Exception("Error occurred while executing : " + sql, e);
+ }
+ } finally {
+ if (statement != null) {
+ try {
+ statement.close();
+ } catch (SQLException e) {
+ logger.error("Error occurred while closing result set.", e);
+ }
+ }
+ }
+ }
+
+ private void startDerbyInServerMode() {
+ try {
+ System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
+ server = new NetworkServerControl(InetAddress.getByName(Utils.getHost()),
+ 20000,
+ Utils.getJDBCUser(), Utils.getJDBCPassword());
+ java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
+ server.start(consoleWriter);
+ } catch (IOException e) {
+ logger.error("Unable to start Apache derby in the server mode! Check whether " +
+ "specified port is available");
+ } catch (Exception e) {
+ logger.error("Unable to start Apache derby in the server mode! Check whether " +
+ "specified port is available");
+ }
+
+ }
+
+ private void startDerbyInEmbeddedMode(){
+ try {
+ Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
+ DriverManager.getConnection("jdbc:derby:memory:unit-testing-jpa;create=true").close();
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void stopDerbyServer() {
+ try {
+ server.shutdown();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/provenance/test/JpaTest.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,151 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.provenance.test;
+
+import static org.junit.Assert.assertTrue;
+
+public class JpaTest {
+// private static final String PERSISTENCE_UNIT_NAME = "airavata_provenance";
+// private EntityManagerFactory factory;
+//
+// @Before
+// public void setUp() throws Exception {
+// factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
+// EntityManager em = factory.createEntityManager();
+//
+// // Begin a new local transaction so that we can persist a new entity
+// em.getTransaction().begin();
+//
+// // Read the existing entries
+// Query q = em.createQuery("select m from Experiment_Data m");
+// // Persons should be empty
+//
+// // Do we have entries?
+// boolean createNewEntries = (q.getResultList().size() == 0);
+//
+// // No, so lets create new entries
+// if (createNewEntries) {
+// assertTrue(q.getResultList().size() == 0);
+// Experiment_Data data = new Experiment_Data();
+// data.setExperiment_ID("Experiement_ID1");
+// data.setName("Name1");
+// em.persist(data);
+// for (int i = 0; i < 5; i++) {
+// Workflow_Data wData = new Workflow_Data();
+// wData.setWorkflow_instanceID("instance_ID" + i);
+// wData.setExperiment_Data(data);
+// em.persist(wData);
+// for (int j = 0; j < 5; j++) {
+// Node_Data nData = new Node_Data();
+// nData.setNode_id("node_ID" + j);
+// nData.setWorkflow_Data(wData);
+// em.persist(nData);
+//
+// Gram_Data gData = new Gram_Data();
+// gData.setNode_id("node_ID" + j);
+// gData.setWorkflow_Data(wData);
+// em.persist(gData);
+// }
+// // Now persists the family person relationship
+// // data.getWorkflows().add(wData);
+// // em.persist(wData);
+// // em.persist(data);
+// }
+// }
+//
+// // Commit the transaction, which will cause the entity to
+// // be stored in the database
+// em.getTransaction().commit();
+//
+// // It is always good practice to close the EntityManager so that
+// // resources are conserved.
+// em.close();
+//
+// }
+//
+// @Test
+// public void checkInsertedWorkflow() {
+//
+// // Now lets check the database and see if the created entries are there
+// // Create a fresh, new EntityManager
+// EntityManager em = factory.createEntityManager();
+//
+// // Perform a simple query for all the Message entities
+// Query q = em.createQuery("select m from Workflow_Data m");
+//
+// // We should have 5 Persons in the database
+// assertTrue(q.getResultList().size() == 5);
+//
+// em.close();
+// }
+//
+// @Test
+// public void checkInsertedNode() {
+// EntityManager em = factory.createEntityManager();
+//
+// Query q = em.createQuery("select m from Node_Data m");
+//
+// assertTrue(q.getResultList().size() == 25);
+//
+// em.close();
+// }
+//
+// @Test (expected = javax.persistence.NoResultException.class)
+// public void deleteNode_Data() throws InterruptedException {
+// Thread.sleep(1000);
+// EntityManager em = factory.createEntityManager();
+// // Begin a new local transaction so that we can persist a new entity
+// em.getTransaction().begin();
+// Query q = em.createQuery("SELECT p FROM Experiment_Data p WHERE p.experiment_ID = :firstName");
+// q.setParameter("firstName", "Experiement_ID1");
+// Experiment_Data eData = (Experiment_Data) q.getSingleResult();
+//
+// q = em.createQuery("SELECT p FROM Workflow_Data p WHERE p.experiment_Data = :firstName AND p.workflow_instanceID = :lastName");
+// q.setParameter("firstName", eData);
+// q.setParameter("lastName", "instance_ID4");
+// Workflow_Data wData = (Workflow_Data) q.getSingleResult();
+//
+// q = em.createQuery("SELECT p FROM Node_Data p WHERE p.workflow_Data = :firstName AND p.node_id = :lastName");
+// q.setParameter("firstName", wData);
+// q.setParameter("lastName", "node_ID4");
+// Node_Data nData = (Node_Data) q.getSingleResult();
+//
+// //System.out.println(nData.getStart_time());
+// em.remove(nData);
+//
+// q = em.createQuery("SELECT p FROM Node_Data p WHERE p.workflow_Data = :firstName AND p.node_id = :lastName");
+// q.setParameter("firstName", wData);
+// q.setParameter("lastName", "node_ID3");
+// nData = (Node_Data) q.getSingleResult();
+// nData.setStatus("finished");
+// Thread.sleep(5000);
+// em.getTransaction().commit();
+//
+// q = em.createQuery("SELECT p FROM Node_Data p WHERE p.workflow_Data = :firstName AND p.node_id = :lastName");
+// q.setParameter("firstName", wData);
+// q.setParameter("lastName", "node_ID4");
+// Node_Data person = (Node_Data) q.getSingleResult();
+// person.getInputs();
+// // Begin a new local transaction so that we can persist a new entity
+//
+// em.close();
+// }
+}
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/resources/airavata-client.properties
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/resources/airavata-client.properties?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/resources/airavata-client.properties (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/resources/airavata-client.properties Thu Dec 26 17:31:35 2013
@@ -0,0 +1,66 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+###########################################################################
+#
+# This properties file provides configuration for Airavata Clients:
+# XBaya and Airavata API
+#
+###########################################################################
+
+###---------------------------REGISTRY API IMPLEMENTATION---------------------------###
+
+#class.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+class.registry.accessor=org.apache.airavata.rest.client.RegistryClient
+
+###---------------------REGISTRY API IMPLEMENTATION - CUSTOM SETTINGS----------------------###
+
+#for mysql [AiravataJPARegistry]
+#registry.jdbc.driver=com.mysql.jdbc.Driver
+#registry.jdbc.url=jdbc:mysql://localhost:3306/persistent_data
+
+#for derby [AiravataJPARegistry]
+registry.jdbc.driver=org.apache.derby.jdbc.ClientDriver
+registry.jdbc.url=jdbc:derby://localhost:20000/jpa_test;create=true;user=airavata;password=airavata
+registry.jdbc.user=airavata
+registry.jdbc.password=airavata
+start.derby.server.mode=true
+validationQuery=SELECT 1 from Configuration
+
+default.registry.user=admin
+default.registry.password=admin
+default.registry.password.hash.method=SHA
+default.registry.gateway=default
+
+trust.store=aiaravata.jks
+trust.store.password=airavata
+
+#for rest [RegistryClient]
+#registry.jdbc.url=http://localhost:9080/airavata-services
+
+#user defined registry accessor classes
+#class.provenance.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.configuration.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.descriptor.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.project.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.user.workflow.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.published.workflow.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+
+
Added: airavata/sandbox/registry/airavata-jpa-registry/src/test/resources/data-derby.sql
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-jpa-registry/src/test/resources/data-derby.sql?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-jpa-registry/src/test/resources/data-derby.sql (added)
+++ airavata/sandbox/registry/airavata-jpa-registry/src/test/resources/data-derby.sql Thu Dec 26 17:31:35 2013
@@ -0,0 +1,279 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+create table Gateway
+(
+ gateway_name varchar(255),
+ owner varchar(255),
+ PRIMARY KEY (gateway_name)
+);
+
+
+create table Configuration
+(
+ config_key varchar(255),
+ config_val varchar(255),
+ expire_date TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ category_id varchar (255),
+ PRIMARY KEY(config_key, config_val, category_id)
+);
+
+INSERT INTO CONFIGURATION (config_key, config_val, expire_date, category_id) VALUES('registry.version', '0.11', CURRENT_TIMESTAMP ,'SYSTEM');
+
+create table Users
+(
+ user_name varchar(255),
+ password varchar(255),
+ PRIMARY KEY(user_name)
+);
+
+create table Gateway_Worker
+(
+ gateway_name varchar(255),
+ user_name varchar(255),
+ PRIMARY KEY (gateway_name, user_name),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (user_name) REFERENCES Users(user_name) ON DELETE CASCADE
+
+);
+
+create table Project
+(
+ gateway_name varchar(255),
+ user_name varchar(255),
+ project_name varchar(255),
+ PRIMARY KEY (project_name),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (user_name) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table Published_Workflow
+(
+ gateway_name varchar(255),
+ created_user varchar(255),
+ publish_workflow_name varchar(255),
+ version varchar(255),
+ published_date TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ path varchar (255),
+ workflow_content BLOB,
+ PRIMARY KEY(gateway_name, publish_workflow_name),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (created_user) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table User_Workflow
+
+(
+ gateway_name varchar(255),
+ owner varchar(255),
+ template_name varchar(255),
+ last_updated_date TIMESTAMP DEFAULT CURRENT TIMESTAMP,
+ path varchar (255),
+ workflow_graph BLOB,
+ PRIMARY KEY(gateway_name, owner, template_name),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (owner) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+
+create table Host_Descriptor
+(
+ gateway_name varchar(255),
+ updated_user varchar(255),
+ host_descriptor_ID varchar(255),
+ host_descriptor_xml BLOB,
+ PRIMARY KEY(gateway_name, host_descriptor_ID),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (updated_user) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table Service_Descriptor
+(
+ gateway_name varchar(255),
+ updated_user varchar(255),
+ service_descriptor_ID varchar(255),
+ service_descriptor_xml BLOB,
+ PRIMARY KEY(gateway_name,service_descriptor_ID),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (updated_user) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table Application_Descriptor
+(
+ gateway_name varchar(255),
+ updated_user varchar(255),
+ application_descriptor_ID varchar(255),
+ host_descriptor_ID varchar(255),
+ service_descriptor_ID varchar(255),
+ application_descriptor_xml BLOB,
+ PRIMARY KEY(gateway_name,application_descriptor_ID),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (updated_user) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table Experiment
+(
+ project_name varchar(255),
+ gateway_name varchar(255),
+ user_name varchar(255),
+ experiment_ID varchar(255),
+ submitted_date TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY(experiment_ID),
+ FOREIGN KEY (gateway_name) REFERENCES Gateway(gateway_name) ON DELETE CASCADE,
+ FOREIGN KEY (project_name) REFERENCES Project(project_name) ON DELETE CASCADE,
+ FOREIGN KEY (user_name) REFERENCES Users(user_name) ON DELETE CASCADE
+);
+
+create table Experiment_Data
+(
+ experiment_ID varchar(255),
+ name varchar(255),
+ username varchar(255),
+ PRIMARY KEY (experiment_ID)
+);
+
+create table Experiment_Metadata
+(
+ experiment_ID varchar(255),
+ metadata BLOB,
+ PRIMARY KEY (experiment_ID)
+);
+
+
+create table Workflow_Data
+(
+ experiment_ID varchar(255),
+ workflow_instanceID varchar(255),
+ template_name varchar(255),
+ status varchar(255),
+ start_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ last_update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY(workflow_instanceID),
+ FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID) ON DELETE CASCADE
+);
+
+create table Node_Data
+(
+ workflow_instanceID varchar(255),
+ node_id varchar(255),
+ node_type varchar(255),
+ inputs BLOB,
+ outputs BLOB,
+ status varchar(255),
+ start_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ last_update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ execution_index int NOT NULL,
+ PRIMARY KEY(workflow_instanceID, node_id, execution_index),
+ FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE
+);
+
+create table Gram_Data
+(
+ workflow_instanceID varchar(255),
+ node_id varchar(255),
+ rsl BLOB,
+ invoked_host varchar(255),
+ local_Job_ID varchar(255),
+ PRIMARY KEY(workflow_instanceID, node_id),
+ FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE
+);
+
+create table GFac_Job_Data
+(
+ experiment_ID varchar(255),
+ workflow_instanceID varchar(255),
+ node_id varchar(255),
+ application_descriptor_ID varchar(255),
+ host_descriptor_ID varchar(255),
+ service_descriptor_ID varchar(255),
+ job_data CLOB,
+ local_Job_ID varchar(255),
+ submitted_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ status_update_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ status varchar(255),
+ metadata CLOB,
+ PRIMARY KEY(local_Job_ID),
+ FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID),
+ FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID)
+);
+
+create table GFac_Job_Status
+(
+ local_Job_ID varchar(255),
+ status_update_time TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ status varchar(255),
+ FOREIGN KEY (local_Job_ID) REFERENCES GFac_Job_Data(local_Job_ID)
+);
+
+CREATE TABLE COMMUNITY_USER
+(
+ GATEWAY_NAME VARCHAR(256) NOT NULL,
+ COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
+ COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,
+ PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
+);
+
+
+CREATE TABLE CREDENTIALS
+(
+ GATEWAY_NAME VARCHAR(256) NOT NULL,
+ COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,
+ CREDENTIAL BLOB NOT NULL,
+ PRIVATE_KEY BLOB NOT NULL,
+ NOT_BEFORE VARCHAR(256) NOT NULL,
+ NOT_AFTER VARCHAR(256) NOT NULL,
+ LIFETIME INTEGER NOT NULL,
+ REQUESTING_PORTAL_USER_NAME VARCHAR(256) NOT NULL,
+ REQUESTED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)
+);
+
+CREATE TABLE Execution_Error
+(
+ error_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+ experiment_ID varchar(255),
+ workflow_instanceID varchar(255),
+ node_id varchar(255),
+ gfacJobID varchar(255),
+ source_type varchar(255),
+ error_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ error_msg CLOB,
+ error_des CLOB,
+ error_code varchar(255),
+ error_reporter varchar(255),
+ error_location varchar(255),
+ action_taken varchar(255),
+ error_reference INTEGER,
+ PRIMARY KEY(error_id),
+ FOREIGN KEY (workflow_instanceID) REFERENCES Workflow_Data(workflow_instanceID) ON DELETE CASCADE,
+ FOREIGN KEY (experiment_ID) REFERENCES Experiment_Data(experiment_ID) ON DELETE CASCADE
+);
+
+-- CREATE TABLE openjpa_sequence_table
+-- (
+-- id SMALLINT NOT NULL,
+-- sequence_value BIGINT,
+-- PRIMARY KEY (id)
+-- );
+
+
+
+
+
Added: airavata/sandbox/registry/airavata-registry-service/pom.xml
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-registry-service/pom.xml?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-registry-service/pom.xml (added)
+++ airavata/sandbox/registry/airavata-registry-service/pom.xml Thu Dec 26 17:31:35 2013
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
+ the Apache License, Version 2.0 (theà "License"); you may not use this file except in compliance with the License. You may
+ obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
+ in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+ ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
+ the License. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata</artifactId>
+ <version>0.12-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>airavata-registry-service</artifactId>
+ <name>Airavata Registry Service</name>
+ <description>Registry Service to expose Registry as a web service</description>
+ <url>http://airavata.apache.org/</url>
+
+ <dependencies>
+ <!--dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-adb</artifactId>
+ <version>${axis2.version}</version>
+ </dependency-->
+ <!--dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>${axis2.version}</version>
+ </dependency-->
+ <!--dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.8</version>
+ </dependency-->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>${org.slf4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${org.slf4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-jpa-registry</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>${derby.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbyclient</artifactId>
+ <version>${derby.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbynet</artifactId>
+ <version>${derby.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbytools</artifactId>
+ <version>${derby.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>${antrun.version}</version>
+ <executions>
+ <execution>
+ <id>restore-persistence</id>
+ <phase>prepare-package</phase>
+ <configuration>
+ <tasks>
+ <copy file="${project.build.outputDirectory}/services.xml" tofile="${project.build.outputDirectory}/META-INF/services.xml" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/ConfigurationRegistryService.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/ConfigurationRegistryService.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/ConfigurationRegistryService.java (added)
+++ airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/ConfigurationRegistryService.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,77 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.registry.services;
+
+import javax.ws.rs.core.Response;
+import java.net.URI;
+import java.util.Date;
+
+public interface ConfigurationRegistryService {
+ public Response getConfiguration(String key);
+
+ public Response getConfigurationList(String key);
+
+ public Response setConfiguration(String key, String value, Date expire);
+
+ public Response addConfiguration(String key, String value, Date expire);
+
+ public Response removeAllConfiguration(String key);
+
+ public Response removeConfiguration(String key, String value);
+
+ public Response getGFacURIs();
+
+ public Response getWorkflowInterpreterURIs();
+
+ public Response getEventingServiceURI();
+
+ public Response getMessageBoxURI();
+
+ public Response addGFacURI(URI uri);
+
+ public Response addWorkflowInterpreterURI(URI uri);
+
+ public Response setEventingURI(URI uri);
+
+ public Response setMessageBoxURI(URI uri);
+
+ public Response addGFacURIByDate(URI uri, Date expire);
+
+ public Response addWorkflowInterpreterURI(URI uri, Date expire);
+
+ public Response setEventingURIByDate(URI uri, Date expire);
+
+ public Response setMessageBoxURIByDate(URI uri, Date expire);
+
+ public Response removeGFacURI(URI uri);
+
+ public Response removeAllGFacURI();
+
+ public Response removeWorkflowInterpreterURI(URI uri);
+
+ public Response removeAllWorkflowInterpreterURI();
+
+ public Response unsetEventingURI();
+
+ public Response unsetMessageBoxURI();
+
+}
Added: airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/DescriptorRegistryService.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/DescriptorRegistryService.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/DescriptorRegistryService.java (added)
+++ airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/DescriptorRegistryService.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,105 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.registry.services;
+
+import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.exception.gateway.DescriptorAlreadyExistsException;
+import org.apache.airavata.registry.api.exception.gateway.DescriptorDoesNotExistsException;
+import org.apache.airavata.registry.api.exception.gateway.MalformedDescriptorException;
+
+import javax.ws.rs.core.Response;
+
+public interface DescriptorRegistryService {
+ /*
+ * Note Name changes of the descriptors should not be allowed
+ */
+
+ // ---------Host Descriptor data------------
+ public Response isHostDescriptorExists(String descriptorName) throws RegistryException;
+
+ public Response addHostDescriptor(String descriptor) throws DescriptorAlreadyExistsException, RegistryException;
+
+ public Response updateHostDescriptor(String descriptor) throws DescriptorDoesNotExistsException, RegistryException;
+
+ public Response getHostDescriptor(String hostName) throws DescriptorDoesNotExistsException,
+ MalformedDescriptorException, RegistryException;
+
+ public Response removeHostDescriptor(String hostName) throws DescriptorDoesNotExistsException, RegistryException;
+
+ public Response getHostDescriptors() throws MalformedDescriptorException, RegistryException;
+
+ public Response getHostDescriptorMetadata(String hostName) throws DescriptorDoesNotExistsException,
+ RegistryException;
+
+ // ---------Service Descriptor data------------
+ public Response isServiceDescriptorExists(String descriptorName) throws RegistryException;
+
+ public Response addServiceDescriptor(String descriptor) throws DescriptorAlreadyExistsException, RegistryException;
+
+ public Response updateServiceDescriptor(String descriptor) throws DescriptorDoesNotExistsException,
+ RegistryException;
+
+ public Response getServiceDescriptor(String serviceName) throws DescriptorDoesNotExistsException,
+ MalformedDescriptorException, RegistryException;
+
+ public Response removeServiceDescriptor(String serviceName) throws DescriptorDoesNotExistsException,
+ RegistryException;
+
+ public Response getServiceDescriptors() throws MalformedDescriptorException, RegistryException;
+
+ public Response getServiceDescriptorMetadata(String serviceName) throws DescriptorDoesNotExistsException,
+ RegistryException;
+
+ // ---------Application Descriptor data------------
+ public Response isApplicationDescriptorExists(String serviceName, String hostName, String descriptorName)
+ throws RegistryException;
+
+ public Response addApplicationDescriptor(String serviceDescription, String hostDescriptor, String descriptor)
+ throws DescriptorAlreadyExistsException, RegistryException;
+
+ public Response addApplicationDesc(String serviceName, String hostName, String descriptor)
+ throws DescriptorAlreadyExistsException, RegistryException;
+
+ public Response udpateApplicationDescriptorByDescriptors(String serviceDescription, String hostDescriptor,
+ String descriptor) throws DescriptorDoesNotExistsException, RegistryException;
+
+ public Response updateApplicationDescriptor(String serviceName, String hostName, String descriptor)
+ throws DescriptorDoesNotExistsException, RegistryException;
+
+ public Response getApplicationDescriptor(String serviceName, String hostname, String applicationName)
+ throws DescriptorDoesNotExistsException, MalformedDescriptorException, RegistryException;
+
+ public Response getApplicationDescriptors(String serviceName, String hostname) throws MalformedDescriptorException,
+ RegistryException;
+
+ public Response getApplicationDescriptors(String serviceName) throws MalformedDescriptorException,
+ RegistryException;
+
+ public Response getApplicationDescriptors() throws MalformedDescriptorException, RegistryException;
+
+ public Response removeApplicationDescriptor(String serviceName, String hostName, String applicationName)
+ throws DescriptorDoesNotExistsException, RegistryException;
+
+ public Response getApplicationDescriptorMetadata(String serviceName, String hostName, String applicationName)
+ throws DescriptorDoesNotExistsException, RegistryException;
+
+}
Added: airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/ProjectsRegistryService.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/ProjectsRegistryService.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/ProjectsRegistryService.java (added)
+++ airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/ProjectsRegistryService.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,66 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.registry.services;
+
+import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.AiravataExperiment;
+import org.apache.airavata.registry.api.exception.worker.ExperimentDoesNotExistsException;
+import org.apache.airavata.registry.api.exception.worker.WorkspaceProjectAlreadyExistsException;
+import org.apache.airavata.registry.api.exception.worker.WorkspaceProjectDoesNotExistsException;
+
+import javax.ws.rs.core.Response;
+import java.util.Date;
+
+public interface ProjectsRegistryService {
+ // ------------Project management
+ public Response isWorkspaceProjectExists(String projectName) throws RegistryException;
+
+ public Response isWorkspaceProjectExists(String projectName, String createIfNotExists) throws RegistryException;
+
+ public Response addWorkspaceProject(String projectName) throws WorkspaceProjectAlreadyExistsException,
+ RegistryException;
+
+ public Response updateWorkspaceProject(String projectName) throws WorkspaceProjectDoesNotExistsException,
+ RegistryException;
+
+ public Response deleteWorkspaceProject(String projectName) throws WorkspaceProjectDoesNotExistsException,
+ RegistryException;
+
+ public Response getWorkspaceProject(String projectName) throws WorkspaceProjectDoesNotExistsException,
+ RegistryException;
+
+ public Response getWorkspaceProjects() throws RegistryException;
+
+ // ------------Experiment management
+ public Response addExperiment(String projectName, AiravataExperiment experiment)
+ throws WorkspaceProjectDoesNotExistsException, ExperimentDoesNotExistsException, RegistryException;
+
+ public Response removeExperiment(String experimentId) throws ExperimentDoesNotExistsException;
+
+ public Response getExperiments() throws RegistryException;
+
+ public Response getExperimentsByProject(String projectName) throws RegistryException;
+
+ public Response getExperimentsByDate(Date from, Date to) throws RegistryException;
+
+ public Response getExperimentsByProjectDate(String projectName, Date from, Date to) throws RegistryException;
+}
Added: airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/ProvenanceRegistryService.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/ProvenanceRegistryService.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/ProvenanceRegistryService.java (added)
+++ airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/ProvenanceRegistryService.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,311 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.registry.services;
+
+import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.workflow.NodeExecutionStatus;
+import org.apache.airavata.registry.api.workflow.WorkflowNodeGramData;
+
+import javax.ws.rs.core.Response;
+import java.util.Date;
+
+public interface ProvenanceRegistryService {
+ /*------------------------------------------- Experiment data ---------------------------------------------*/
+
+ /**
+ * Returns true if the experiment exists
+ *
+ * @param experimentId
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response isExperimentExists(String experimentId) throws RegistryException;
+
+ public Response isExperimentExistsThenCreate(String experimentId, boolean createIfNotPresent)
+ throws RegistryException;
+
+ /**
+ * Save the username of the user who runs this experiment
+ *
+ * @param experimentId
+ * @param user
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response updateExperimentExecutionUser(String experimentId, String user) throws RegistryException;
+
+ /**
+ * Retrieve the user who is runing the experiment
+ *
+ * @param experimentId
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response getExperimentExecutionUser(String experimentId) throws RegistryException;
+
+ /**
+ * Get the name of the workflow intance
+ *
+ * @param experimentId
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response getExperimentName(String experimentId) throws RegistryException;
+
+ /**
+ * Save a name for this workflow execution
+ *
+ * @param experimentId
+ * @param experimentName
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response updateExperimentName(String experimentId, String experimentName) throws RegistryException;
+
+ /**
+ * Return the metadata information saved for the experiment
+ *
+ * @param experimentId
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response getExperimentMetadata(String experimentId) throws RegistryException;
+
+ /**
+ * Save the metadata for the experiment
+ *
+ * @param experimentId
+ * @param metadata
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response updateExperimentMetadata(String experimentId, String metadata) throws RegistryException;
+
+ /**
+ * Return the template name of the workflow that this intance was created from
+ *
+ * @param workflowInstanceId
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response getWorkflowExecutionTemplateName(String workflowInstanceId) throws RegistryException;
+
+ /**
+ * Save the template name of the workflow that this intance was created from
+ *
+ * @param workflowInstanceId
+ * @param templateName
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response setWorkflowInstanceTemplateName(String workflowInstanceId, String templateName)
+ throws RegistryException;
+
+ public Response getExperimentWorkflowInstances(String experimentId) throws RegistryException;
+
+ /*-------------------------------------- Experiment Workflow instance node data ----------------------------------------*/
+
+ public Response isWorkflowInstanceExists(String instanceId) throws RegistryException;
+
+ public Response isWorkflowInstanceExistsThenCreate(String instanceId, boolean createIfNotPresent)
+ throws RegistryException;
+
+ /**
+ * Save a status for this workflow execution with the current time at the moment
+ *
+ * @param instanceId
+ * @param executionStatus
+ * - contains the status
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response updateWorkflowInstanceStatusByInstance(String instanceId, String executionStatus)
+ throws RegistryException;
+
+ /**
+ * Save a status for this workflow execution
+ *
+ * @param experimentID
+ * @param workflowInstanceID
+ * @param executionStatus
+ * @param statusUpdateTime
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response updateWorkflowInstanceStatusByExperiment(String experimentID, String workflowInstanceID,
+ String executionStatus, Date statusUpdateTime) throws RegistryException;
+
+ /**
+ * Return the status of the execution
+ *
+ * @param instanceId
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response getWorkflowInstanceStatus(String instanceId) throws RegistryException;
+
+ /**
+ * Save the input data of a node in the workflow instance of an experiment
+ *
+ * @param experimentID
+ * @param nodeID
+ * @param workflowInstanceID
+ * @param data
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response updateWorkflowNodeInput(String experimentID, String nodeID, String workflowInstanceID, String data)
+ throws RegistryException;
+
+ /**
+ * Save the output data of a node in the workflow instance of an experiment
+ *
+ * @param experimentID
+ * @param nodeID
+ * @param workflowInstanceID
+ * @param data
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response updateWorkflowNodeOutput(String experimentID, String nodeID, String workflowInstanceID, String data)
+ throws RegistryException;
+
+ /**
+ * Return a list of data passed as input for service node which regex matched nodeId, workflow template id &
+ * experiment id
+ *
+ * @param experimentIdRegEx
+ * @param workflowNameRegEx
+ * - this is the workflowName or workflow template Id of an experiment
+ * @param nodeNameRegEx
+ * - nodeId
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response searchWorkflowInstanceNodeInput(String experimentIdRegEx, String workflowNameRegEx,
+ String nodeNameRegEx) throws RegistryException;
+
+ /**
+ * Return a list of data returned as output from service node which regex matched nodeId, workflow template id &
+ * experiment id
+ *
+ * @param experimentIdRegEx
+ * @param workflowNameRegEx
+ * - this is the workflowName or workflow template Id of an experiment
+ * @param nodeNameRegEx
+ * - nodeId
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response searchWorkflowInstanceNodeOutput(String experimentIdRegEx, String workflowNameRegEx,
+ String nodeNameRegEx) throws RegistryException;
+
+ public Response getWorkflowInstanceNodeInput(String workflowInstanceId, String nodeType) throws RegistryException;
+
+ public Response getWorkflowInstanceNodeOutput(String workflowInstanceId, String nodeType) throws RegistryException;
+
+ /*--------------------------------------- Retrieving Experiment ------------------------------------------*/
+ /**
+ * Return workflow execution object fully populated with data currently avaialble for that experiment
+ *
+ * @param experimentId
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response getExperiment(String experimentId) throws RegistryException;
+
+ /**
+ * Return experiment ids of experiments launched by the given user
+ *
+ * @param user
+ * - a regex user id
+ * @return - experiment id list
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response getExperimentIdByUser(String user) throws RegistryException;
+
+ /**
+ * Return experiments launched by the given user
+ *
+ * @param user
+ * @return experiment object list each populated by current data of that experiment
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response getExperimentByUser(String user) throws RegistryException;
+
+ /**
+ * Return the pageNo set of experiments launched by the given user if grouped in to pages of size pageSize
+ *
+ * @param user
+ * @param pageSize
+ * @param pageNo
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response getExperimentByUser(String user, int pageSize, int pageNo) throws RegistryException;
+
+ /**
+ * This will update the workflowStatus for given experimentID,workflowInstanceID combination.
+ *
+ * @param workflowStatusNode
+ * @return
+ * @throws org.apache.airavata.registry.api.exception.RegistryException
+ */
+ public Response updateWorkflowNodeStatus(NodeExecutionStatus workflowStatusNode) throws RegistryException;
+
+ public Response updateWorkflowNodeStatus(String workflowInstanceId, String nodeId, String executionStatus)
+ throws RegistryException;
+
+ public Response updateWorkflowNodeStatus(String workflowInstanceId, String executionStatus)
+ throws RegistryException;
+
+ public Response getWorkflowNodeStatus(String workflowInstanceId, String nodeId) throws RegistryException;
+
+ public Response getWorkflowNodeStartTime(String workflowInstanceId, String nodeId) throws RegistryException;
+
+ public Response getWorkflowStartTime(String workflowInstanceId) throws RegistryException;
+
+ /**
+ * This will store the gram specific data in to repository, this can be called before submitting the workflow in to
+ * Grid
+ *
+ * @param workflowNodeGramData
+ * @return
+ */
+ public Response updateWorkflowNodeGramData(WorkflowNodeGramData workflowNodeGramData) throws RegistryException;
+
+ public Response getWorkflowInstanceData(String workflowInstanceId) throws RegistryException;
+
+ public Response isWorkflowInstanceNodePresent(String workflowInstanceId, String nodeId) throws RegistryException;
+
+ public Response isWorkflowInstanceNodePresent(String workflowInstanceId, String nodeId, boolean createIfNotPresent)
+ throws RegistryException;
+
+ public Response getWorkflowInstanceNodeData(String workflowInstanceId, String nodeId) throws RegistryException;
+
+ public Response addWorkflowInstance(String experimentId, String workflowInstanceId, String templateName)
+ throws RegistryException;
+
+ public Response updateWorkflowNodeType(String workflowInstanceId, String nodeId, String nodeType)
+ throws RegistryException;
+
+ public Response addWorkflowInstanceNode(String workflowInstance, String nodeId) throws RegistryException;
+}
Added: airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/PublishedWorkflowRegistryService.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/PublishedWorkflowRegistryService.java?rev=1553518&view=auto
==============================================================================
--- airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/PublishedWorkflowRegistryService.java (added)
+++ airavata/sandbox/registry/airavata-registry-service/src/main/java/org/apache/airavata/registry/services/PublishedWorkflowRegistryService.java Thu Dec 26 17:31:35 2013
@@ -0,0 +1,51 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.registry.services;
+
+import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.exception.gateway.PublishedWorkflowAlreadyExistsException;
+import org.apache.airavata.registry.api.exception.gateway.PublishedWorkflowDoesNotExistsException;
+import org.apache.airavata.registry.api.exception.worker.UserWorkflowDoesNotExistsException;
+
+import javax.ws.rs.core.Response;
+
+public interface PublishedWorkflowRegistryService {
+ public Response isPublishedWorkflowExists(String workflowName) throws RegistryException;
+
+ public Response publishWorkflow(String workflowName, String publishWorkflowName)
+ throws PublishedWorkflowAlreadyExistsException, UserWorkflowDoesNotExistsException, RegistryException;
+
+ public Response publishWorkflow(String workflowName) throws PublishedWorkflowAlreadyExistsException,
+ UserWorkflowDoesNotExistsException, RegistryException;
+
+ public Response getPublishedWorkflowGraphXML(String workflowName) throws PublishedWorkflowDoesNotExistsException,
+ RegistryException;
+
+ public Response getPublishedWorkflowNames() throws RegistryException;
+
+ public Response getPublishedWorkflows() throws RegistryException;
+
+ public Response getPublishedWorkflowMetadata(String workflowName) throws RegistryException;
+
+ public Response removePublishedWorkflow(String workflowName) throws PublishedWorkflowDoesNotExistsException,
+ RegistryException;
+}