airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject git commit: airavata server implementation for registry functions - AIRAVATA-1013
Date Thu, 27 Feb 2014 17:09:49 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 7f4e406a1 -> e0e1c9738


airavata server implementation for registry functions - AIRAVATA-1013


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/e0e1c973
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/e0e1c973
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/e0e1c973

Branch: refs/heads/master
Commit: e0e1c9738ba0038374ff58890d47f4e34bd8ee6a
Parents: 7f4e406
Author: chathuri <chathuri@apache.org>
Authored: Thu Feb 27 12:09:43 2014 -0500
Committer: chathuri <chathuri@apache.org>
Committed: Thu Feb 27 12:09:43 2014 -0500

----------------------------------------------------------------------
 airavata-api/airavata-api-server/pom.xml        |  5 ++
 .../server/handler/AiravataServerHandler.java   | 65 +++++++++++++++++---
 .../airavataAPI.thrift                          |  2 +-
 .../registry/jpa/impl/RegistryFactory.java      | 34 ++++++++++
 4 files changed, 98 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/e0e1c973/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 bbba2d9..0072294 100644
--- a/airavata-api/airavata-api-server/pom.xml
+++ b/airavata-api/airavata-api-server/pom.xml
@@ -39,6 +39,11 @@
         </dependency>
         <dependency>
             <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-model-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
             <artifactId>airavata-jpa-registry</artifactId>
             <version>${project.version}</version>
         </dependency>

http://git-wip-us.apache.org/repos/asf/airavata/blob/e0e1c973/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 5319b18..bf217d3 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
@@ -26,13 +26,22 @@ import org.apache.airavata.api.error.AiravataClientException;
 import org.apache.airavata.api.error.AiravataSystemException;
 import org.apache.airavata.api.error.ExperimentNotFoundException;
 import org.apache.airavata.api.error.InvalidRequestException;
+import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
 import org.apache.airavata.model.workspace.experiment.*;
+import org.apache.airavata.registry.cpi.ChildDataType;
+import org.apache.airavata.registry.cpi.DataType;
+import org.apache.airavata.registry.cpi.ParentDataType;
+import org.apache.airavata.registry.cpi.Registry;
 import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.List;
 
 public class AiravataServerHandler implements Airavata.Iface {
 
+    private Registry registry;
+    private static final Logger logger = LoggerFactory.getLogger(AiravataServerHandler.class);
     /**
      * Query Airavata to fetch the API version
      */
@@ -65,7 +74,13 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public String createExperiment(Experiment experiment) throws InvalidRequestException,
AiravataClientException, AiravataSystemException, TException {
-        return null;
+        try {
+            registry = RegistryFactory.getDefaultRegistry();
+            return (String)registry.add(ParentDataType.EXPERIMENT, experiment);
+        } catch (Exception e) {
+            logger.error("Error while creating the experiment", e);
+            throw new AiravataSystemException();
+        }
     }
 
     /**
@@ -92,7 +107,13 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public Experiment getExperiment(String airavataExperimentId) throws InvalidRequestException,
ExperimentNotFoundException, AiravataClientException, AiravataSystemException, TException
{
-        return null;
+        try {
+            registry = RegistryFactory.getDefaultRegistry();
+            return (Experiment)registry.get(DataType.EXPERIMENT, airavataExperimentId);
+        } catch (Exception e) {
+            logger.error("Error while retrieving the experiment", e);
+            throw new AiravataSystemException();
+        }
     }
 
 
@@ -122,17 +143,35 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public void updateExperiment(String airavataExperimentId, Experiment experiment) throws
InvalidRequestException, ExperimentNotFoundException, AiravataClientException, AiravataSystemException,
TException {
-
+        try {
+            registry = RegistryFactory.getDefaultRegistry();
+            registry.update(DataType.EXPERIMENT, experiment, airavataExperimentId);
+        } catch (Exception e) {
+            logger.error("Error while updating experiment", e);
+            throw new AiravataSystemException();
+        }
     }
 
     @Override
     public void updateExperimentConfiguration(String airavataExperimentId, UserConfigurationData
userConfiguration) throws TException {
-
+        try {
+            registry = RegistryFactory.getDefaultRegistry();
+            registry.add(ChildDataType.EXPERIMENT_CONFIGURATION_DATA, userConfiguration,
airavataExperimentId);
+        } catch (Exception e) {
+            logger.error("Error while updating user configuration", e);
+            throw new AiravataSystemException();
+        }
     }
 
     @Override
     public void updateResourceScheduleing(String airavataExperimentId, ComputationalResourceScheduling
resourceScheduling) throws TException {
-
+        try {
+            registry = RegistryFactory.getDefaultRegistry();
+            registry.add(ChildDataType.COMPUTATIONAL_RESOURCE_SCHEDULING, resourceScheduling,
airavataExperimentId);
+        } catch (Exception e) {
+            logger.error("Error while updating scheduling info", e);
+            throw new AiravataSystemException();
+        }
     }
 
     /**
@@ -158,12 +197,24 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public ExperimentStatus getExperimentStatus(String airavataExperimentId) throws InvalidRequestException,
ExperimentNotFoundException, AiravataClientException, AiravataSystemException, TException
{
-        return null;
+        try {
+            registry = RegistryFactory.getDefaultRegistry();
+            return (ExperimentStatus)registry.get(DataType.EXPERIMENT_STATUS, airavataExperimentId);
+        } catch (Exception e) {
+            logger.error("Error while retrieving the experiment status", e);
+            throw new AiravataSystemException();
+        }
     }
 
     @Override
     public List<DataObjectType> getExperimentOutputs(String airavataExperimentId) throws
TException {
-        return null;
+        try {
+            registry = RegistryFactory.getDefaultRegistry();
+            return (List<DataObjectType>)registry.get(DataType.EXPERIMENT_OUTPUT, airavataExperimentId);
+        } catch (Exception e) {
+            logger.error("Error while retrieving the experiment outputs", e);
+            throw new AiravataSystemException();
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/airavata/blob/e0e1c973/airavata-api/thrift-interface-descriptions/airavataAPI.thrift
----------------------------------------------------------------------
diff --git a/airavata-api/thrift-interface-descriptions/airavataAPI.thrift b/airavata-api/thrift-interface-descriptions/airavataAPI.thrift
index 15eebbc..a8613e0 100644
--- a/airavata-api/thrift-interface-descriptions/airavataAPI.thrift
+++ b/airavata-api/thrift-interface-descriptions/airavataAPI.thrift
@@ -249,7 +249,7 @@ service Airavata {
 
   list<experimentModel.DataObjectType> getExperimentOutputs (1: required string airavataExperimentId)
 
-  experimentModel.TaskStatus getJobStatus(1: required string resourceJobId)
+  map<string, experimentModel.JobStatus> getJobStatuses(1: required string airavataExperimentId)
 
 
   /**

http://git-wip-us.apache.org/repos/asf/airavata/blob/e0e1c973/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryFactory.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryFactory.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryFactory.java
new file mode 100644
index 0000000..9113b24
--- /dev/null
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryFactory.java
@@ -0,0 +1,34 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.persistance.registry.jpa.impl;
+
+import org.apache.airavata.registry.cpi.Registry;
+
+public class RegistryFactory {
+    public static Registry getRegistry(String gateway, String username, String password){
+        return new RegistryImpl(gateway, username, password);
+    }
+
+    public static Registry getDefaultRegistry (){
+        return new RegistryImpl();
+    }
+}


Mime
View raw message