airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1509124 - in /airavata/trunk/modules: airavata-client/src/main/java/org/apache/airavata/client/ registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ registry/airavata-jpa-registry/src/main/java/org/apa...
Date Thu, 01 Aug 2013 08:50:33 GMT
Author: samindaw
Date: Thu Aug  1 08:50:32 2013
New Revision: 1509124

URL: http://svn.apache.org/r1509124
Log:
updating product versions + registry version compatibility chk + backend halt/pause/resume of workflow execution in the interpreter

Added:
    airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/AiravataRegistryUninitializedException.java   (with props)
Modified:
    airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
    airavata/trunk/modules/registry/airavata-registry-test/src/test/java/org/apache/airavata/registry/api/test/AiravataRegistryAPITest.java
    airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ConfigurationRegistry.java
    airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/RegistryException.java
    airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/utils/ApplicationVersion.java
    airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaVersion.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/GUIWorkflowInterpreterInteractorImpl.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SSWorkflowInterpreterInteractorImpl.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterInteractor.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java

Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java?rev=1509124&r1=1509123&r2=1509124&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java Thu Aug  1 08:50:32 2013
@@ -102,7 +102,7 @@ public class AiravataClient extends Obse
     private static int WAIT_TIME_PERIOD = 4 * 1000;
     private static int WAIT_ITERATIONS = 15;
 
-	private static final Version API_VERSION = new Version("Airavata", 0, 8,
+	private static final Version API_VERSION = new Version("Airavata", 0, 9,
 			null, null, null);
 
 	// FIXME: Need a constructor to set registry URL

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java?rev=1509124&r1=1509123&r2=1509124&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java (original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java Thu Aug  1 08:50:32 2013
@@ -20,15 +20,6 @@
 */
 package org.apache.airavata.persistance.registry.jpa;
 
-import org.apache.airavata.persistance.registry.jpa.model.*;
-import org.apache.airavata.persistance.registry.jpa.resources.*;
-import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
-import org.apache.openjpa.jdbc.sql.Select;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.*;
-import javax.rmi.CORBA.Util;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -36,6 +27,30 @@ import java.util.Map;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityNotFoundException;
+import javax.persistence.Persistence;
+import javax.persistence.Query;
+
+import org.apache.airavata.persistance.registry.jpa.model.Configuration;
+import org.apache.airavata.persistance.registry.jpa.model.Configuration_PK;
+import org.apache.airavata.persistance.registry.jpa.model.Gateway;
+import org.apache.airavata.persistance.registry.jpa.model.Gateway_Worker;
+import org.apache.airavata.persistance.registry.jpa.model.Gateway_Worker_PK;
+import org.apache.airavata.persistance.registry.jpa.model.Users;
+import org.apache.airavata.persistance.registry.jpa.resources.AbstractResource;
+import org.apache.airavata.persistance.registry.jpa.resources.ConfigurationResource;
+import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
+import org.apache.airavata.persistance.registry.jpa.resources.Utils;
+import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
+import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
+import org.apache.airavata.registry.api.exception.AiravataRegistryUninitializedException;
+import org.apache.airavata.registry.api.exception.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class ResourceUtils {
     private final static Logger logger = LoggerFactory.getLogger(ResourceUtils.class);
     private static final String PERSISTENCE_UNIT_NAME = "airavata_data";
@@ -43,6 +58,10 @@ public class ResourceUtils {
 
     private static Lock lock = new ReentrantLock();
 
+    public static void reset(){
+    	factory=null;
+    }
+    
     public static EntityManager getEntityManager(){
         if (factory == null) {
             String connectionProperties = "DriverClassName=" + Utils.getJDBCDriver() + "," + "Url=" + Utils.getJDBCURL() + "," +
@@ -65,15 +84,14 @@ public class ResourceUtils {
 			properties.put("openjpa.jdbc.QuerySQLCache", "false");
             factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
         }
-
-        return factory.createEntityManager();
+		return factory.createEntityManager();
     }
 
     /**
      * @param gatewayName
      * @return
      */
-    public static Resource createGateway(String gatewayName) {
+    public static Resource createGateway(String gatewayName){
         if (!isGatewayExist(gatewayName)) {
             GatewayResource gatewayResource = new GatewayResource();
             gatewayResource.setGatewayName(gatewayName);
@@ -83,7 +101,7 @@ public class ResourceUtils {
 
     }
 
-    public static Resource getGateway(String gatewayName) {
+    public static Resource getGateway(String gatewayName){
         if (isGatewayExist(gatewayName)) {
             EntityManager em = getEntityManager();
             Gateway gateway = em.find(Gateway.class, gatewayName);
@@ -95,7 +113,7 @@ public class ResourceUtils {
 
     }
 
-    public static Resource getWorker(String gatewayName, String userName) {
+    public static Resource getWorker(String gatewayName, String userName){
         EntityManager em = getEntityManager();
         Gateway_Worker gatewayWorker = em.find(Gateway_Worker.class, new Gateway_Worker_PK(gatewayName, userName));
         WorkerResource workerResource = (WorkerResource) Utils.getResource(ResourceType.GATEWAY_WORKER, gatewayWorker);
@@ -108,7 +126,7 @@ public class ResourceUtils {
      * @param gatewayName
      * @return
      */
-    public static boolean isGatewayExist(String gatewayName) {
+    public static boolean isGatewayExist(String gatewayName){
 
         EntityManager em = getEntityManager();
         em.getTransaction().begin();
@@ -197,7 +215,7 @@ public class ResourceUtils {
      * @param configKey
      * @return
      */
-    public static List<ConfigurationResource> getConfigurations(String configKey) {
+    public static List<ConfigurationResource> getConfigurations(String configKey){
         List<ConfigurationResource> list = new ArrayList<ConfigurationResource>();
         EntityManager em = getEntityManager();
         em.getTransaction().begin();
@@ -220,7 +238,7 @@ public class ResourceUtils {
      * @param configKey
      * @return
      */
-    public static ConfigurationResource getConfiguration(String configKey) {
+    public static ConfigurationResource getConfiguration(String configKey){
         List<ConfigurationResource> configurations = getConfigurations(configKey);
         return (configurations != null && configurations.size() > 0) ? configurations.get(0) : null;
     }
@@ -229,7 +247,7 @@ public class ResourceUtils {
      * @param configKey
      * @return
      */
-    public static boolean isConfigurationExist(String configKey) {
+    public static boolean isConfigurationExist(String configKey){
         List<ConfigurationResource> configurations = getConfigurations(configKey);
         return (configurations != null && configurations.size() > 0);
     }
@@ -260,7 +278,7 @@ public class ResourceUtils {
      * @param configkey
      * @param configValue
      */
-    public static void removeConfiguration(String configkey, String configValue) {
+    public static void removeConfiguration(String configkey, String configValue){
         QueryGenerator queryGenerator = new QueryGenerator(AbstractResource.CONFIGURATION);
         queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_KEY, configkey);
         queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_VAL, configValue);
@@ -277,7 +295,7 @@ public class ResourceUtils {
     /**
      * @param configkey
      */
-    public static void removeConfiguration(String configkey) {
+    public static void removeConfiguration(String configkey){
         QueryGenerator queryGenerator = new QueryGenerator(AbstractResource.CONFIGURATION);
         queryGenerator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_KEY, configkey);
         if(isConfigurationExist(configkey)){

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java?rev=1509124&r1=1509123&r2=1509124&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java (original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java Thu Aug  1 08:50:32 2013
@@ -76,6 +76,7 @@ import org.apache.airavata.registry.api.
 import org.apache.airavata.registry.api.ResourceMetadata;
 import org.apache.airavata.registry.api.UserWorkflowRegistry;
 import org.apache.airavata.registry.api.WorkspaceProject;
+import org.apache.airavata.registry.api.exception.AiravataRegistryUninitializedException;
 import org.apache.airavata.registry.api.exception.RegistryAPIVersionIncompatibleException;
 import org.apache.airavata.registry.api.exception.RegistryAccessorInstantiateException;
 import org.apache.airavata.registry.api.exception.RegistryAccessorNotFoundException;
@@ -133,7 +134,7 @@ public class AiravataJPARegistry extends
     private JPAResourceAccessor jpa;
     private boolean active=false;
     private static final String DEFAULT_PROJECT_NAME = "default";
-    private static final Version API_VERSION=new Version("Airavata Registry API",0,8,null,null,null);
+    private static final Version API_VERSION=new Version("Airavata Registry API",0,9,null,null,null);
     private URI registryConnectionURI;
     private ConfigurationRegistry configurationRegistry;
     private DescriptorRegistry descriptorRegistry;
@@ -153,20 +154,22 @@ public class AiravataJPARegistry extends
     	//TODO check if the db connections are proper & accessible & the relevant db/tables are
     	//present
     	active=true;
-
+    	
         initializeCustomRegistries();
         String apiVersion = getVersion().toString();
-        String registryVersion = getConfiguration("registry.version").toString();
-        if (!apiVersion.equals(registryVersion)){
-           throw new RegistryAPIVersionIncompatibleException("Incompatible registry versions. Please check whether you updated the API and Registry " +
-                   "versions.");
-        }
+        String registryVersion;
+		try {
+			registryVersion = getConfiguration("registry.version").toString();
+		} catch (Exception e) {
+			if (e.getMessage().contains("does not exist")){
+				ResourceUtils.reset();
+				throw new AiravataRegistryUninitializedException("Airavata Registry has not yet initialized!!!", e);
+			} else {
+				throw new RegistryException(e);
+			}
+		}
         String[] list = compatibleVersionMap.get(apiVersion);
-        if (list == null){
-            throw new RegistryAPIVersionIncompatibleException("Incompatible registry versions. Please check whether you updated the API and Registry " +
-                    "versions.");
-        }
-        if (!Arrays.asList(list).contains(registryVersion)){
+        if (list == null || (!Arrays.asList(list).contains(registryVersion))){
             throw new RegistryAPIVersionIncompatibleException("Incompatible registry versions. Please check whether you updated the API and Registry " +
                     "versions.");
         }
@@ -177,6 +180,7 @@ public class AiravataJPARegistry extends
         compatibleVersionMap.put("0.6", new String[]{"0.6"});
         compatibleVersionMap.put("0.7", new String[]{"0.6", "0.7"});
         compatibleVersionMap.put("0.8", new String[]{"0.8"});
+        compatibleVersionMap.put("0.9", new String[]{"0.9","0.8"});
     }
 
     /**
@@ -222,12 +226,12 @@ public class AiravataJPARegistry extends
 
     /**---------------------------------Configuration Registry----------------------------------**/
 
-    public Object getConfiguration(String key) {
+    public Object getConfiguration(String key) throws RegistryException{
 		ConfigurationResource configuration = ResourceUtils.getConfiguration(key);
 		return configuration==null? null: configuration.getConfigVal();
     }
     // Not sure about this.. need some description
-    public List<Object> getConfigurationList(String key) {
+    public List<Object> getConfigurationList(String key) throws RegistryException{
         if (configurationRegistry != null){
             return configurationRegistry.getConfigurationList(key);
         } else {
@@ -241,7 +245,7 @@ public class AiravataJPARegistry extends
 
     }
 
-    public void setConfiguration(String key, String value, Date expire) {
+    public void setConfiguration(String key, String value, Date expire) throws RegistryException{
         if (configurationRegistry != null){
             configurationRegistry.setConfiguration(key, value, expire);
         }else {
@@ -257,7 +261,7 @@ public class AiravataJPARegistry extends
         }
     }
 
-    public void addConfiguration(String key, String value, Date expire) {
+    public void addConfiguration(String key, String value, Date expire) throws RegistryException{
         if (configurationRegistry != null){
             configurationRegistry.addConfiguration(key, value, expire);
         } else {
@@ -270,7 +274,7 @@ public class AiravataJPARegistry extends
 
     }
 
-    public void removeAllConfiguration(String key) {
+    public void removeAllConfiguration(String key) throws RegistryException{
         if (configurationRegistry  != null){
             configurationRegistry.removeAllConfiguration(key);
         } else {
@@ -279,7 +283,7 @@ public class AiravataJPARegistry extends
 
     }
 
-    public void removeConfiguration(String key, String value) {
+    public void removeConfiguration(String key, String value) throws RegistryException{
         if (configurationRegistry != null){
             configurationRegistry.removeConfiguration(key, value);
         } else {
@@ -292,7 +296,7 @@ public class AiravataJPARegistry extends
     private static final String MESSAGE_BOX_URL="messagebox.url";
     private static final String EVENTING_URL="eventing.url";
 
-    public List<URI> getGFacURIs() {
+    public List<URI> getGFacURIs() throws RegistryException{
         if (configurationRegistry != null) {
             return configurationRegistry.getGFacURIs();
         } else {
@@ -300,7 +304,7 @@ public class AiravataJPARegistry extends
         }
     }
 
-	private List<URI> retrieveURIsFromConfiguration(String urlType) {
+	private List<URI> retrieveURIsFromConfiguration(String urlType) throws RegistryException{
 		List<URI> urls=new ArrayList<URI>();
     	List<Object> configurationList = getConfigurationList(urlType);
     	for (Object o : configurationList) {
@@ -313,7 +317,7 @@ public class AiravataJPARegistry extends
         return urls;
 	}
 
-    public List<URI> getWorkflowInterpreterURIs() {
+    public List<URI> getWorkflowInterpreterURIs() throws RegistryException{
         if (configurationRegistry != null) {
             return configurationRegistry.getWorkflowInterpreterURIs();
         }  else {
@@ -321,7 +325,7 @@ public class AiravataJPARegistry extends
         }
     }
 
-    public URI getEventingServiceURI() {
+    public URI getEventingServiceURI() throws RegistryException{
         if (configurationRegistry != null) {
            return configurationRegistry.getEventingServiceURI();
         }else {
@@ -330,7 +334,7 @@ public class AiravataJPARegistry extends
         }
     }
 
-    public URI getMessageBoxURI() {
+    public URI getMessageBoxURI() throws RegistryException{
         if (configurationRegistry != null) {
             return configurationRegistry.getMessageBoxURI();
         }
@@ -338,7 +342,7 @@ public class AiravataJPARegistry extends
 		return messageboxURLs.size()==0? null: messageboxURLs.get(0);
     }
 
-    public void addGFacURI(URI uri) {
+    public void addGFacURI(URI uri) throws RegistryException{
         if (configurationRegistry != null) {
             addGFacURI(uri);
         } else {
@@ -346,18 +350,18 @@ public class AiravataJPARegistry extends
         }
     }
 
-	private void addConfigurationURL(String urlType,URI uri) {
+	private void addConfigurationURL(String urlType,URI uri) throws RegistryException{
 		Calendar instance = Calendar.getInstance();
         instance.add(Calendar.MINUTE, AiravataRegistry2.SERVICE_TTL);
 		Date expire = instance.getTime();
 		addConfigurationURL(urlType, uri, expire);
 	}
 
-	private void addConfigurationURL(String urlType, URI uri, Date expire) {
+	private void addConfigurationURL(String urlType, URI uri, Date expire) throws RegistryException{
 		addConfiguration(urlType, uri.toString(), expire);
 	}
 
-    public void addWorkflowInterpreterURI(URI uri) {
+    public void addWorkflowInterpreterURI(URI uri) throws RegistryException{
         if (configurationRegistry != null) {
             configurationRegistry.addWorkflowInterpreterURI(uri);
         }else {
@@ -365,7 +369,7 @@ public class AiravataJPARegistry extends
         }
     }
 
-    public void setEventingURI(URI uri) {
+    public void setEventingURI(URI uri) throws RegistryException{
         if (configurationRegistry != null) {
             configurationRegistry.setEventingURI(uri);
         } else {
@@ -373,7 +377,7 @@ public class AiravataJPARegistry extends
         }
     }
 
-    public void setMessageBoxURI(URI uri) {
+    public void setMessageBoxURI(URI uri) throws RegistryException{
         if (configurationRegistry != null) {
             configurationRegistry.setMessageBoxURI(uri);
         } else {
@@ -381,7 +385,7 @@ public class AiravataJPARegistry extends
         }
     }
 
-    public void addGFacURI(URI uri, Date expire) {
+    public void addGFacURI(URI uri, Date expire) throws RegistryException{
         if (configurationRegistry != null) {
             configurationRegistry.addGFacURI(uri, expire);
         } else {
@@ -389,7 +393,7 @@ public class AiravataJPARegistry extends
         }
     }
 
-    public void addWorkflowInterpreterURI(URI uri, Date expire) {
+    public void addWorkflowInterpreterURI(URI uri, Date expire) throws RegistryException{
         if (configurationRegistry != null) {
             configurationRegistry.addWorkflowInterpreterURI(uri, expire);
         } else {
@@ -397,7 +401,7 @@ public class AiravataJPARegistry extends
         }
     }
 
-    public void setEventingURI(URI uri, Date expire) {
+    public void setEventingURI(URI uri, Date expire) throws RegistryException{
         if (configurationRegistry != null) {
             configurationRegistry.setEventingURI(uri, expire);
         } else {
@@ -405,7 +409,7 @@ public class AiravataJPARegistry extends
         }
     }
 
-    public void setMessageBoxURI(URI uri, Date expire) {
+    public void setMessageBoxURI(URI uri, Date expire) throws RegistryException{
         if (configurationRegistry != null) {
             configurationRegistry.setMessageBoxURI(uri, expire);
         } else {
@@ -413,7 +417,7 @@ public class AiravataJPARegistry extends
         }
     }
 
-    public void removeGFacURI(URI uri) {
+    public void removeGFacURI(URI uri) throws RegistryException{
         if (configurationRegistry != null) {
             configurationRegistry.removeGFacURI(uri);
         } else {
@@ -421,7 +425,7 @@ public class AiravataJPARegistry extends
         }
     }
 
-    public void removeWorkflowInterpreterURI(URI uri) {
+    public void removeWorkflowInterpreterURI(URI uri) throws RegistryException{
         if (configurationRegistry != null) {
             configurationRegistry.removeWorkflowInterpreterURI(uri);
         } else {
@@ -429,7 +433,7 @@ public class AiravataJPARegistry extends
         }
     }
 
-    public void removeAllGFacURI() {
+    public void removeAllGFacURI() throws RegistryException{
         if (configurationRegistry != null) {
             configurationRegistry.removeAllGFacURI();
         } else {
@@ -437,7 +441,7 @@ public class AiravataJPARegistry extends
         }
     }
 
-    public void removeAllWorkflowInterpreterURI() {
+    public void removeAllWorkflowInterpreterURI() throws RegistryException{
         if (configurationRegistry != null) {
             configurationRegistry.removeAllWorkflowInterpreterURI();
         } else {
@@ -445,7 +449,7 @@ public class AiravataJPARegistry extends
         }
     }
 
-    public void unsetEventingURI() {
+    public void unsetEventingURI() throws RegistryException{
         if (configurationRegistry != null) {
             configurationRegistry.unsetEventingURI();
         } else {
@@ -454,7 +458,7 @@ public class AiravataJPARegistry extends
 
     }
 
-    public void unsetMessageBoxURI() {
+    public void unsetMessageBoxURI() throws RegistryException{
         if (configurationRegistry != null) {
             configurationRegistry.unsetMessageBoxURI();
         } else {

Modified: airavata/trunk/modules/registry/airavata-registry-test/src/test/java/org/apache/airavata/registry/api/test/AiravataRegistryAPITest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-registry-test/src/test/java/org/apache/airavata/registry/api/test/AiravataRegistryAPITest.java?rev=1509124&r1=1509123&r2=1509124&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-registry-test/src/test/java/org/apache/airavata/registry/api/test/AiravataRegistryAPITest.java (original)
+++ airavata/trunk/modules/registry/airavata-registry-test/src/test/java/org/apache/airavata/registry/api/test/AiravataRegistryAPITest.java Thu Aug  1 08:50:32 2013
@@ -27,6 +27,7 @@ import org.apache.airavata.commons.gfac.
 import org.apache.airavata.commons.gfac.type.ServiceDescription;
 import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
 import org.apache.airavata.registry.api.*;
+import org.apache.airavata.registry.api.exception.RegistryException;
 import org.apache.airavata.registry.api.test.util.Initialize;
 import org.apache.airavata.registry.api.workflow.*;
 import org.apache.airavata.schemas.gfac.*;
@@ -90,7 +91,7 @@ public class AiravataRegistryAPITest ext
         ResourceUtils.removeConfiguration("configkey2");
     }
 
-    public void testRemoveAllConfiguration() {
+    public void testRemoveAllConfiguration() throws RegistryException {
         Calendar calender = Calendar.getInstance();
         java.util.Date d = calender.getTime();
         Date currentTime = new Date(d.getTime());
@@ -103,7 +104,7 @@ public class AiravataRegistryAPITest ext
     }
 
 
-    public void testRemoveConfiguration() {
+    public void testRemoveConfiguration() throws RegistryException {
         Calendar calender = Calendar.getInstance();
         java.util.Date d = calender.getTime();
         Date currentTime = new Date(d.getTime());
@@ -114,7 +115,7 @@ public class AiravataRegistryAPITest ext
     }
 
 
-    public void testGetGFacURIs() {
+    public void testGetGFacURIs() throws RegistryException {
         Calendar calender = Calendar.getInstance();
         java.util.Date d = calender.getTime();
         Date currentTime = new Date(d.getTime());
@@ -125,7 +126,7 @@ public class AiravataRegistryAPITest ext
     }
 
 
-    public void testGetWorkflowInterpreterURIs() {
+    public void testGetWorkflowInterpreterURIs() throws RegistryException {
         Calendar calender = Calendar.getInstance();
         java.util.Date d = calender.getTime();
         Date currentTime = new Date(d.getTime());
@@ -136,7 +137,7 @@ public class AiravataRegistryAPITest ext
     }
 
 
-    public void testGetEventingServiceURI() {
+    public void testGetEventingServiceURI() throws RegistryException {
         Calendar calender = Calendar.getInstance();
         java.util.Date d = calender.getTime();
         Date currentTime = new Date(d.getTime());
@@ -146,7 +147,7 @@ public class AiravataRegistryAPITest ext
         ResourceUtils.removeConfiguration("eventing.url");
     }
 
-    public void testGetMessageBoxURI() {
+    public void testGetMessageBoxURI() throws RegistryException {
         Calendar calender = Calendar.getInstance();
         java.util.Date d = calender.getTime();
         Date currentTime = new Date(d.getTime());
@@ -157,7 +158,7 @@ public class AiravataRegistryAPITest ext
     }
 
 
-    public void testAddGFacURI() {
+    public void testAddGFacURI() throws RegistryException {
         URI uri = URI.create("http://192.168.17.1:8080/axis2/services/GFacService");
         registry.addGFacURI(uri);
         List<URI> gFacURIs = registry.getGFacURIs();
@@ -166,7 +167,7 @@ public class AiravataRegistryAPITest ext
     }
 
 
-    public void testAddWorkflowInterpreterURI() {
+    public void testAddWorkflowInterpreterURI() throws RegistryException {
         URI uri = URI.create("http://192.168.17.1:8080/axis2/services/WorkflowInterpretor");
         registry.addWorkflowInterpreterURI(uri);
         List<URI> interpreterURIs = registry.getWorkflowInterpreterURIs();
@@ -175,7 +176,7 @@ public class AiravataRegistryAPITest ext
     }
 
 
-    public void testSetEventingURI() {
+    public void testSetEventingURI() throws RegistryException {
         URI uri = URI.create("http://192.168.17.1:8080/axis2/services/EventingService");
         registry.setEventingURI(uri);
         URI eventingServiceURI = registry.getEventingServiceURI();
@@ -183,7 +184,7 @@ public class AiravataRegistryAPITest ext
         registry.removeConfiguration("eventing.url", "http://192.168.17.1:8080/axis2/services/EventingService");
     }
 
-    public void testSetMessageBoxURI() {
+    public void testSetMessageBoxURI() throws RegistryException {
         URI uri = URI.create("http://192.168.17.1:8080/axis2/services/MsgBoxService");
         registry.setMessageBoxURI(uri);
         URI messageBoxURI = registry.getMessageBoxURI();
@@ -192,7 +193,7 @@ public class AiravataRegistryAPITest ext
     }
 
 
-    public void testAddGFacURIWithExpireDate() {
+    public void testAddGFacURIWithExpireDate() throws RegistryException {
         Calendar calender = Calendar.getInstance();
         java.util.Date d = calender.getTime();
         Date currentTime = new Date(d.getTime());
@@ -204,7 +205,7 @@ public class AiravataRegistryAPITest ext
     }
 
 
-    public void testAddWorkflowInterpreterURIWithExpireDate() {
+    public void testAddWorkflowInterpreterURIWithExpireDate() throws RegistryException {
         Calendar calender = Calendar.getInstance();
         java.util.Date d = calender.getTime();
         Date currentTime = new Date(d.getTime());
@@ -217,7 +218,7 @@ public class AiravataRegistryAPITest ext
     }
 
 
-    public void testSetEventingURIWithExpireDate() {
+    public void testSetEventingURIWithExpireDate() throws RegistryException {
         Calendar calender = Calendar.getInstance();
         java.util.Date d = calender.getTime();
         Date currentTime = new Date(d.getTime());
@@ -229,7 +230,7 @@ public class AiravataRegistryAPITest ext
     }
 
 
-    public void testSetMessageBoxURIWithExpireDate() {
+    public void testSetMessageBoxURIWithExpireDate() throws RegistryException {
         Calendar calender = Calendar.getInstance();
         java.util.Date d = calender.getTime();
         Date currentTime = new Date(d.getTime());
@@ -241,7 +242,7 @@ public class AiravataRegistryAPITest ext
     }
 
 
-    public void testRemoveGFacURI() {
+    public void testRemoveGFacURI() throws RegistryException {
         URI uri = URI.create("http://192.168.17.1:8080/axis2/services/GFacService");
         registry.addGFacURI(uri);
         registry.removeGFacURI(uri);
@@ -249,35 +250,35 @@ public class AiravataRegistryAPITest ext
     }
 
 
-    public void testRemoveAllGFacURI() {
+    public void testRemoveAllGFacURI() throws RegistryException {
         URI uri = URI.create("http://192.168.17.1:8080/axis2/services/GFacService");
         registry.addGFacURI(uri);
         registry.removeAllGFacURI();
         assertFalse("Gfac uri removed successfully", ResourceUtils.isConfigurationExist("gfac.url"));
     }
 
-    public void testRemoveWorkflowInterpreterURI() {
+    public void testRemoveWorkflowInterpreterURI() throws RegistryException {
         URI uri = URI.create("http://192.168.17.1:8080/axis2/services/WorkflowInterpretor");
         registry.addWorkflowInterpreterURI(uri);
         registry.removeWorkflowInterpreterURI(uri);
         assertFalse("workflow interpreter uri removed successfully", ResourceUtils.isConfigurationExist("interpreter.url"));
     }
 
-    public void testRemoveAllWorkflowInterpreterURI() {
+    public void testRemoveAllWorkflowInterpreterURI() throws RegistryException {
         URI uri = URI.create("http://192.168.17.1:8080/axis2/services/WorkflowInterpretor");
         registry.addWorkflowInterpreterURI(uri);
         registry.removeAllWorkflowInterpreterURI();
         assertFalse("workflow interpreter uri removed successfully", ResourceUtils.isConfigurationExist("interpreter.url"));
     }
 
-    public void testUnsetEventingURI() {
+    public void testUnsetEventingURI() throws RegistryException {
         URI uri = URI.create("http://192.168.17.1:8080/axis2/services/EventingService");
         registry.setEventingURI(uri);
         registry.unsetEventingURI();
         assertNotNull("eventing url removed successfully", ResourceUtils.isConfigurationExist("eventing.url"));
     }
 
-    public void testUnsetMessageBoxURI() {
+    public void testUnsetMessageBoxURI() throws RegistryException {
         URI uri = URI.create("http://192.168.17.1:8080/axis2/services/MsgBoxService");
         registry.setMessageBoxURI(uri);
         registry.unsetMessageBoxURI();

Modified: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ConfigurationRegistry.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ConfigurationRegistry.java?rev=1509124&r1=1509123&r2=1509124&view=diff
==============================================================================
--- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ConfigurationRegistry.java (original)
+++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ConfigurationRegistry.java Thu Aug  1 08:50:32 2013
@@ -25,33 +25,35 @@ import java.net.URI;
 import java.util.Date;
 import java.util.List;
 
+import org.apache.airavata.registry.api.exception.RegistryException;
+
 public interface ConfigurationRegistry extends AiravataSubRegistry {
-	public Object getConfiguration(String key);
-	public List<Object> getConfigurationList(String key);
-	public void setConfiguration(String key, String value, Date expire);
-	public void addConfiguration(String key, String value, Date expire);
-	public void removeAllConfiguration(String key);
-	public void removeConfiguration(String key, String value);
+	public Object getConfiguration(String key) throws RegistryException;
+	public List<Object> getConfigurationList(String key) throws RegistryException;
+	public void setConfiguration(String key, String value, Date expire) throws RegistryException;
+	public void addConfiguration(String key, String value, Date expire) throws RegistryException;
+	public void removeAllConfiguration(String key) throws RegistryException;
+	public void removeConfiguration(String key, String value) throws RegistryException;
 	
-	public List<URI> getGFacURIs();
-	public List<URI> getWorkflowInterpreterURIs();
-	public URI getEventingServiceURI();
-	public URI getMessageBoxURI();
+	public List<URI> getGFacURIs() throws RegistryException;
+	public List<URI> getWorkflowInterpreterURIs() throws RegistryException;
+	public URI getEventingServiceURI() throws RegistryException;
+	public URI getMessageBoxURI() throws RegistryException;
 	
-	public void addGFacURI(URI uri);
-	public void addWorkflowInterpreterURI(URI uri);
-	public void setEventingURI(URI uri);
-	public void setMessageBoxURI(URI uri);
+	public void addGFacURI(URI uri) throws RegistryException;
+	public void addWorkflowInterpreterURI(URI uri) throws RegistryException;
+	public void setEventingURI(URI uri) throws RegistryException;
+	public void setMessageBoxURI(URI uri) throws RegistryException;
 
-	public void addGFacURI(URI uri, Date expire);
-	public void addWorkflowInterpreterURI(URI uri, Date expire);
-	public void setEventingURI(URI uri, Date expire);
-	public void setMessageBoxURI(URI uri, Date expire);
+	public void addGFacURI(URI uri, Date expire) throws RegistryException;
+	public void addWorkflowInterpreterURI(URI uri, Date expire) throws RegistryException;
+	public void setEventingURI(URI uri, Date expire) throws RegistryException;
+	public void setMessageBoxURI(URI uri, Date expire) throws RegistryException;
 	
-	public void removeGFacURI(URI uri);
-	public void removeAllGFacURI();
-	public void removeWorkflowInterpreterURI(URI uri);
-	public void removeAllWorkflowInterpreterURI();
-	public void unsetEventingURI();
-	public void unsetMessageBoxURI();
+	public void removeGFacURI(URI uri) throws RegistryException;
+	public void removeAllGFacURI() throws RegistryException;
+	public void removeWorkflowInterpreterURI(URI uri) throws RegistryException;
+	public void removeAllWorkflowInterpreterURI() throws RegistryException;
+	public void unsetEventingURI() throws RegistryException;
+	public void unsetMessageBoxURI() throws RegistryException;
 }

Added: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/AiravataRegistryUninitializedException.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/AiravataRegistryUninitializedException.java?rev=1509124&view=auto
==============================================================================
--- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/AiravataRegistryUninitializedException.java (added)
+++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/AiravataRegistryUninitializedException.java Thu Aug  1 08:50:32 2013
@@ -0,0 +1,32 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.api.exception;
+
+public class AiravataRegistryUninitializedException extends RegistryException {
+
+	public AiravataRegistryUninitializedException(String message, Throwable e) {
+		super(message, e);
+	}
+
+	private static final long serialVersionUID = -6873054164386608256L;
+
+}

Propchange: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/AiravataRegistryUninitializedException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/RegistryException.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/RegistryException.java?rev=1509124&r1=1509123&r2=1509124&view=diff
==============================================================================
--- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/RegistryException.java (original)
+++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/exception/RegistryException.java Thu Aug  1 08:50:32 2013
@@ -23,12 +23,10 @@ package org.apache.airavata.registry.api
 
 public class RegistryException extends Exception {
 	
-    private final static String ERROR_MESSAGE = "Error occured while attempting to retrieve existing deployment descriptions";
-    
     private static final long serialVersionUID = -2849422320139467602L;
 
     public RegistryException(Throwable e) {
-        super(ERROR_MESSAGE, e);
+        super(e);
     }
     
     public RegistryException(String message) {

Modified: airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/utils/ApplicationVersion.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/utils/ApplicationVersion.java?rev=1509124&r1=1509123&r2=1509124&view=diff
==============================================================================
--- airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/utils/ApplicationVersion.java (original)
+++ airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/utils/ApplicationVersion.java Thu Aug  1 08:50:32 2013
@@ -28,7 +28,7 @@ public class ApplicationVersion {
     /**
      * Version number
      */
-    public final static Version VERSION = new Version("Airavata",0,8,null,null,null);
+    public final static Version VERSION = new Version("Airavata",0,9,null,null,null);
 
     /**
      * Prints the version

Modified: airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java?rev=1509124&r1=1509123&r2=1509124&view=diff
==============================================================================
--- airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java (original)
+++ airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java Thu Aug  1 08:50:32 2013
@@ -924,18 +924,26 @@ public class Workflow implements Cloneab
         return this.graph.equals(workflow.getGraph());
     }
 
+    private Object executionStateLock=new Object();
+    
     /**
      * @return
      */
     public synchronized WorkflowExecutionState getExecutionState() {
-        return this.executionState;
+    	WorkflowExecutionState result;
+    	synchronized (executionStateLock) {
+    		result=this.executionState;
+		}
+        return result;
     }
 
     /**
      * @param state
      */
     public synchronized void setExecutionState(WorkflowExecutionState state) {
-        this.executionState = state;
+    	synchronized (executionStateLock) {
+    		this.executionState = state;
+		}
     }
 
 	public boolean isEditable() {

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaVersion.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaVersion.java?rev=1509124&r1=1509123&r2=1509124&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaVersion.java (original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaVersion.java Thu Aug  1 08:50:32 2013
@@ -28,7 +28,7 @@ public class XBayaVersion {
     /**
      * Version number
      */
-    public final static Version VERSION = new Version("Airavata XBaya", 0, 8,
+    public final static Version VERSION = new Version("Airavata XBaya", 0, 9,
 			null, null, null);;
 
     /**

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/GUIWorkflowInterpreterInteractorImpl.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/GUIWorkflowInterpreterInteractorImpl.java?rev=1509124&r1=1509123&r2=1509124&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/GUIWorkflowInterpreterInteractorImpl.java (original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/GUIWorkflowInterpreterInteractorImpl.java Thu Aug  1 08:50:32 2013
@@ -44,7 +44,7 @@ public class GUIWorkflowInterpreterInter
 	private XBayaGUI xbayaGUI;
 	private Workflow workflow;
 	private XBayaEngine engine;
-
+	
 	private Map<String, WaitDialog> taskDialogs = new HashMap<String, WaitDialog>();
 
 	public GUIWorkflowInterpreterInteractorImpl(XBayaEngine engine,
@@ -169,6 +169,8 @@ public class GUIWorkflowInterpreterInter
 //									.getMessageBoxURL()), node.getID(),
 //					null);
 //			break;
+		default:
+			break;
 		}
 		return result;
 	}
@@ -181,4 +183,29 @@ public class GUIWorkflowInterpreterInter
 		this.workflow = workflow;
 	}
 
+	@Override
+	public void pauseExecution(WorkflowInterpreterConfiguration config) {
+		notify(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED,config, WorkflowExecutionState.PAUSED);
+	}
+
+	@Override
+	public void resumeExecution(WorkflowInterpreterConfiguration config) {
+		notify(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED,config, WorkflowExecutionState.RUNNING);
+	}
+
+	@Override
+	public void terminateExecution(WorkflowInterpreterConfiguration config) {
+		notify(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED,config, WorkflowExecutionState.STOPPED);
+	}
+
+	@Override
+	public boolean isExecutionPaused(WorkflowInterpreterConfiguration config) {
+		return config.getWorkflow().getExecutionState()==WorkflowExecutionState.PAUSED;
+	}
+
+	@Override
+	public boolean isExecutionTerminated(WorkflowInterpreterConfiguration config) {
+		return config.getWorkflow().getExecutionState()==WorkflowExecutionState.STOPPED;
+	}
+
 }

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SSWorkflowInterpreterInteractorImpl.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SSWorkflowInterpreterInteractorImpl.java?rev=1509124&r1=1509123&r2=1509124&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SSWorkflowInterpreterInteractorImpl.java (original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/SSWorkflowInterpreterInteractorImpl.java Thu Aug  1 08:50:32 2013
@@ -26,7 +26,7 @@ import org.apache.airavata.workflow.mode
 
 public class SSWorkflowInterpreterInteractorImpl implements
 		WorkflowInterpreterInteractor {
-
+	
 	@Override
 	public boolean notify(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration config, Object data) {
 		switch (messageType) {
@@ -34,10 +34,13 @@ public class SSWorkflowInterpreterIntera
 			break;
 		case EXECUTION_STATE_CHANGED:
 			WorkflowExecutionState state = (WorkflowExecutionState) data;
-			if (state == WorkflowExecutionState.PAUSED
-					|| state == WorkflowExecutionState.STOPPED) {
-				config.getWorkflow().setExecutionState(WorkflowExecutionState.STOPPED);
-			}
+			config.getWorkflow().setExecutionState(state);
+//			if (state == WorkflowExecutionState.PAUSED
+//					|| state == WorkflowExecutionState.STOPPED) {
+//				config.getWorkflow().setExecutionState(WorkflowExecutionState.STOPPED);
+//			}else if (state == WorkflowExecutionState.RUNNING) {
+//				config.getWorkflow().setExecutionState(WorkflowExecutionState.RUNNING);
+//			}
 			break;
 		case EXECUTION_TASK_START:
 			break;
@@ -81,8 +84,35 @@ public class SSWorkflowInterpreterIntera
 //							config.getMessageBoxURL()), node.getID(),
 //					null);
 //			break;
+		default:
+			break;
 		}
 		return result;
 	}
 
+	@Override
+	public void pauseExecution(WorkflowInterpreterConfiguration config) {
+		notify(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED,config, WorkflowExecutionState.PAUSED);
+	}
+
+	@Override
+	public void resumeExecution(WorkflowInterpreterConfiguration config) {
+		notify(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED,config, WorkflowExecutionState.RUNNING);
+	}
+
+	@Override
+	public void terminateExecution(WorkflowInterpreterConfiguration config) {
+		notify(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED,config, WorkflowExecutionState.STOPPED);
+	}
+
+	@Override
+	public boolean isExecutionPaused(WorkflowInterpreterConfiguration config) {
+		return config.getWorkflow().getExecutionState()==WorkflowExecutionState.PAUSED;
+	}
+
+	@Override
+	public boolean isExecutionTerminated(WorkflowInterpreterConfiguration config) {
+		return config.getWorkflow().getExecutionState()==WorkflowExecutionState.STOPPED;
+	}
+
 }

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java?rev=1509124&r1=1509123&r2=1509124&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java (original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java Thu Aug  1 08:50:32 2013
@@ -21,6 +21,25 @@
 
 package org.apache.airavata.xbaya.interpretor;
 
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.xml.namespace.QName;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
 import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
 import org.apache.airavata.common.utils.Pair;
 import org.apache.airavata.common.utils.WSDLUtil;
@@ -35,7 +54,19 @@ import org.apache.airavata.workflow.mode
 import org.apache.airavata.workflow.model.component.amazon.InstanceComponent;
 import org.apache.airavata.workflow.model.component.amazon.TerminateInstanceComponent;
 import org.apache.airavata.workflow.model.component.dynamic.DynamicComponent;
-import org.apache.airavata.workflow.model.component.system.*;
+import org.apache.airavata.workflow.model.component.system.ConstantComponent;
+import org.apache.airavata.workflow.model.component.system.DifferedInputComponent;
+import org.apache.airavata.workflow.model.component.system.DoWhileComponent;
+import org.apache.airavata.workflow.model.component.system.EndDoWhileComponent;
+import org.apache.airavata.workflow.model.component.system.EndForEachComponent;
+import org.apache.airavata.workflow.model.component.system.EndifComponent;
+import org.apache.airavata.workflow.model.component.system.ForEachComponent;
+import org.apache.airavata.workflow.model.component.system.IfComponent;
+import org.apache.airavata.workflow.model.component.system.InputComponent;
+import org.apache.airavata.workflow.model.component.system.MemoComponent;
+import org.apache.airavata.workflow.model.component.system.OutputComponent;
+import org.apache.airavata.workflow.model.component.system.S3InputComponent;
+import org.apache.airavata.workflow.model.component.system.SubWorkflowComponent;
 import org.apache.airavata.workflow.model.component.ws.WSComponent;
 import org.apache.airavata.workflow.model.component.ws.WSComponentPort;
 import org.apache.airavata.workflow.model.exceptions.WorkflowException;
@@ -50,42 +81,38 @@ import org.apache.airavata.workflow.mode
 import org.apache.airavata.workflow.model.graph.impl.EdgeImpl;
 import org.apache.airavata.workflow.model.graph.impl.NodeImpl;
 import org.apache.airavata.workflow.model.graph.subworkflow.SubWorkflowNode;
-import org.apache.airavata.workflow.model.graph.system.*;
+import org.apache.airavata.workflow.model.graph.system.ConstantNode;
+import org.apache.airavata.workflow.model.graph.system.DoWhileNode;
+import org.apache.airavata.workflow.model.graph.system.EndForEachNode;
+import org.apache.airavata.workflow.model.graph.system.EndifNode;
+import org.apache.airavata.workflow.model.graph.system.ForEachNode;
+import org.apache.airavata.workflow.model.graph.system.IfNode;
+import org.apache.airavata.workflow.model.graph.system.InputNode;
+import org.apache.airavata.workflow.model.graph.system.OutputNode;
 import org.apache.airavata.workflow.model.graph.ws.WSGraph;
 import org.apache.airavata.workflow.model.graph.ws.WSNode;
 import org.apache.airavata.workflow.model.graph.ws.WSPort;
 import org.apache.airavata.workflow.model.ode.ODEClient;
 import org.apache.airavata.workflow.model.wf.Workflow;
 import org.apache.airavata.workflow.model.wf.WorkflowExecutionState;
-import org.apache.airavata.ws.monitor.MonitorConfiguration;
 import org.apache.airavata.ws.monitor.MonitorException;
 import org.apache.airavata.xbaya.concurrent.PredicatedTaskRunner;
-import org.apache.airavata.xbaya.invoker.*;
+import org.apache.airavata.xbaya.invoker.DynamicInvoker;
+import org.apache.airavata.xbaya.invoker.EmbeddedGFacInvoker;
+import org.apache.airavata.xbaya.invoker.GenericInvoker;
+import org.apache.airavata.xbaya.invoker.Invoker;
+import org.apache.airavata.xbaya.invoker.WorkflowInputUtil;
 import org.apache.airavata.xbaya.provenance.ProvenanceReader;
 import org.apache.airavata.xbaya.provenance.ProvenanceWrite;
 import org.apache.airavata.xbaya.util.AmazonUtil;
 import org.apache.airavata.xbaya.util.InterpreterUtil;
-import org.apache.airavata.xbaya.util.XBayaUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xmlpull.infoset.XmlElement;
-import xsul.lead.LeadContextHeader;
+
 import xsul.lead.LeadResourceMapping;
 import xsul5.XmlConstants;
 
-import javax.xml.namespace.QName;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-import java.awt.image.VolatileImage;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.*;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicInteger;
-
 public class WorkflowInterpreter {
     private static final Logger log = LoggerFactory.getLogger(WorkflowInterpreter.class);
 
@@ -123,6 +150,9 @@ public class WorkflowInterpreter {
         setWorkflowInterpreterConfigurationThreadLocal(config);
 	}
 
+	public WorkflowInterpreterInteractor getInteractor(){
+		return this.interactor;
+	}
 	public void setResourceMapping(LeadResourceMapping resourceMapping) {
 		this.resourceMapping = resourceMapping;
 	}
@@ -172,12 +202,19 @@ public class WorkflowInterpreter {
                     notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED, WorkflowExecutionState.PAUSED);
                 }
                 // ok we have paused sleep
-                while (this.getWorkflow().getExecutionState() == WorkflowExecutionState.PAUSED) {
-                    try {
-                        Thread.sleep(400);
-                    } catch (InterruptedException e) {
-                        e.printStackTrace();
-                    }
+                if (this.getWorkflow().getExecutionState() == WorkflowExecutionState.PAUSED) {
+                	log.info("Workflow execution "+config.getTopic()+" is paused.");
+	                while (this.getWorkflow().getExecutionState() == WorkflowExecutionState.PAUSED) {
+	                    try {
+	                        Thread.sleep(400);
+	                    } catch (InterruptedException e) {
+	                        e.printStackTrace();
+	                    }
+	                }
+	                if (this.getWorkflow().getExecutionState() == WorkflowExecutionState.STOPPED) {
+	                	continue;
+	                }
+	                log.info("Workflow execution "+config.getTopic()+" is resumed.");
                 }
                 // get task list and execute them
 				for (final Node node : readyNodes) {
@@ -227,7 +264,7 @@ public class WorkflowInterpreter {
 					// of failure
 					// so we should pause the execution
 					if (InterpreterUtil.getRunningNodeCountDynamically(this.getGraph()) == 0
-							&& InterpreterUtil.getFailedNodeCountDynamically(this.getGraph()) != 0) {
+							/**&& InterpreterUtil.getFailedNodeCountDynamically(this.getGraph()) != 0**/) {
                         //Since airavata only support workflow interpreter server mode we do not want to keep thread in sleep mode
                         // continuously, so we make the workflow stop when there's nothing to do.
 						this.getWorkflow().setExecutionState(WorkflowExecutionState.STOPPED);

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterInteractor.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterInteractor.java?rev=1509124&r1=1509123&r2=1509124&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterInteractor.java (original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreterInteractor.java Thu Aug  1 08:50:32 2013
@@ -25,6 +25,13 @@ package org.apache.airavata.xbaya.interp
 public interface WorkflowInterpreterInteractor {
 	public boolean notify(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration config, Object data);
 	public Object retrieveData(WorkflowExecutionMessage messageType, WorkflowInterpreterConfiguration config, Object data) throws Exception;
+	public void pauseExecution(WorkflowInterpreterConfiguration config);
+	public void resumeExecution(WorkflowInterpreterConfiguration config);
+	public void terminateExecution(WorkflowInterpreterConfiguration config);
+	
+	public boolean isExecutionPaused(WorkflowInterpreterConfiguration config);
+	public boolean isExecutionTerminated(WorkflowInterpreterConfiguration config);
+	
 	public static class TaskNotification{
 		String messageTitle;
 		String message;

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java?rev=1509124&r1=1509123&r2=1509124&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java (original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java Thu Aug  1 08:50:32 2013
@@ -21,6 +21,23 @@
 
 package org.apache.airavata.xbaya.interpretor;
 
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.jcr.RepositoryException;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
 import org.apache.airavata.client.AiravataAPIFactory;
 import org.apache.airavata.client.api.AiravataAPI;
 import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
@@ -43,6 +60,7 @@ import org.apache.airavata.workflow.mode
 import org.apache.airavata.workflow.model.graph.system.InputNode;
 import org.apache.airavata.workflow.model.ode.ODEClient;
 import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.workflow.model.wf.WorkflowExecutionState;
 import org.apache.airavata.ws.monitor.MonitorException;
 import org.apache.airavata.xbaya.XBayaConfiguration;
 import org.apache.airavata.xbaya.XBayaConstants;
@@ -58,18 +76,6 @@ import org.apache.axis2.engine.ServiceLi
 import org.apache.xmlbeans.XmlException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
-import javax.jcr.RepositoryException;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.*;
 //import org.apache.airavata.registry.api.AiravataRegistry2;
 
 /**
@@ -105,6 +111,8 @@ public class WorkflowInterpretorSkeleton
     public static  ConfigurationContext configurationContext;
     public static final String SERVICE_NAME="WorkflowInterpretor";
     public static boolean notInterrupted = true;
+    public Map<String, WorkflowInterpreterConfiguration> workflowConfigurations=new HashMap<String, WorkflowInterpreterConfiguration>();
+    private WorkflowInterpreterInteractor interactor;
     private String gateway;
 
 	protected static final String SERVICE_URL = "interpreter_service_url";
@@ -129,6 +137,13 @@ public class WorkflowInterpretorSkeleton
 		return airavataAPI;
     }
 
+    private WorkflowInterpreterInteractor getInteractor(){
+    	if (interactor==null){
+        	interactor=new SSWorkflowInterpreterInteractorImpl();
+    	}
+    	return interactor;
+    }
+    
     public void startUp(final ConfigurationContext configctx, AxisService service) {
     	AiravataUtils.setExecutionAsServer();
     	new Thread(){
@@ -194,7 +209,6 @@ public class WorkflowInterpretorSkeleton
 		        } catch (IOException e) {
 		            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
 		        } catch (URISyntaxException e) {
-					// TODO Auto-generated catch block
 					e.printStackTrace();
 				} catch (ApplicationSettingsException e) {
                     e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
@@ -205,6 +219,43 @@ public class WorkflowInterpretorSkeleton
 
     }
     
+    public void suspendWorkflow(String experimentId)throws Exception{
+    	if (workflowConfigurations.containsKey(experimentId)){
+    		if (getInteractor().isExecutionPaused(workflowConfigurations.get(experimentId))){
+    			throw new Exception("Experiment '"+experimentId+"' is already paused!!!");
+    		}else{
+    			log.info("Suspending workflow execution "+experimentId+"...");
+    			getInteractor().pauseExecution(workflowConfigurations.get(experimentId));
+    		}
+    	}else{
+    		throw new Exception("Invalid Experiment id: Experiment "+experimentId+" not running");
+    	}
+    }
+    
+    public void resumeWorkflow(String experimentId)throws Exception{
+    	if (workflowConfigurations.containsKey(experimentId)){
+    		if (getInteractor().isExecutionPaused(workflowConfigurations.get(experimentId)) || workflowConfigurations.get(experimentId).getWorkflow().getExecutionState()==WorkflowExecutionState.STOPPED){
+    			log.info("Resuming workflow execution "+experimentId+"...");
+    			getInteractor().resumeExecution(workflowConfigurations.get(experimentId));
+    			
+    		}else{
+    			throw new Exception("Experiment '"+experimentId+"' is not suspended!!!");
+    		}
+    	}else{
+    		//TODO chk to see if the experiment is present in registry if so reload it and resume execution else error
+    		throw new Exception("Invalid Experiment id: Experiment "+experimentId+" not running");
+    	}
+    }
+    
+    public void haltWorkflow(String experimentId)throws Exception{
+    	if (workflowConfigurations.containsKey(experimentId)){
+			log.info("Terminating workflow execution "+experimentId+"...");
+			getInteractor().terminateExecution(workflowConfigurations.get(experimentId));
+    	}else{
+    		throw new Exception("Invalid Experiment id: Experiment "+experimentId+" not running");
+    	}
+    }
+    
     /**
      *
      * @param workflowAsString
@@ -213,7 +264,6 @@ public class WorkflowInterpretorSkeleton
      * @return
      * @throws XMLStreamException
      */
-
 	public java.lang.String launchWorkflow(java.lang.String workflowAsString, java.lang.String topic, NameValue[] inputs) throws XMLStreamException {
         OMElement workflowContext = getWorkflowContextHeader();
         if(workflowContext == null){
@@ -259,7 +309,7 @@ public class WorkflowInterpretorSkeleton
     private OMElement getWorkflowContextHeader() {
         MessageContext currentMessageContext = MessageContext.getCurrentMessageContext();
         SOAPHeader header = currentMessageContext.getEnvelope().getHeader();
-        Iterator childrenWithName = header.getChildrenWithName(new QName("http://airavata.apache.org/schemas/wec/2012/05", "context-header"));
+        Iterator<?> childrenWithName = header.getChildrenWithName(new QName("http://airavata.apache.org/schemas/wec/2012/05", "context-header"));
         if (childrenWithName.hasNext()) {
             return (OMElement) childrenWithName.next();
         } else {
@@ -344,7 +394,7 @@ public class WorkflowInterpretorSkeleton
             workflowInterpreterConfiguration.setAwsAccessKey(builder.getSecurityContext().getAmazonWebservices().getAccessKeyId());
         }
         // WorkflowInterpreter object should create prior creation of Listener, because listener needs the threadlocal variable
-        interpreter = new WorkflowInterpreter(workflowInterpreterConfiguration, new SSWorkflowInterpreterInteractorImpl());
+        interpreter = new WorkflowInterpreter(workflowInterpreterConfiguration, getInteractor());
         listener = new WorkflowInterpretorEventListener(workflow, conf);
         try {
         	log.debug("start listener set");
@@ -384,11 +434,15 @@ public class WorkflowInterpretorSkeleton
 
     private void executeWorkflow(WorkflowInterpreter interpreter, WorkflowInterpretorEventListener listener,String experimentId) {
         try {
+        	workflowConfigurations.put(experimentId,interpreter.getConfig());
             interpreter.scheduleDynamically();
             log.debug("Interpreter invoked...");
         } catch (Exception e) {
             throw new WorkflowRuntimeException(e);
         } finally {
+        	if (workflowConfigurations.containsKey(experimentId)){
+        		workflowConfigurations.remove(experimentId);
+        	}
             /*
              * stop listener no matter what happens
              */
@@ -419,7 +473,7 @@ public class WorkflowInterpretorSkeleton
 		return configuration;
 	}
 
-	public String findValue(Map<String,String> vals, String key, String defaultVal) {
+	private String findValue(Map<String,String> vals, String key, String defaultVal) {
 		if(vals.get(key) != null) {
             return vals.get(key);
         }
@@ -467,7 +521,7 @@ public class WorkflowInterpretorSkeleton
         }
         StAXOMBuilder builder = new StAXOMBuilder(reader);
         OMElement documentElement = builder.getDocumentElement();
-        Iterator server = documentElement.getChildrenWithName(new QName("server"));
+        Iterator<?> server = documentElement.getChildrenWithName(new QName("server"));
         while (server.hasNext()) {
             OMElement next = (OMElement) server.next();
             HostDescription hostDescription;



Mime
View raw message