airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1382669 - in /incubator/airavata/trunk/modules: airavata-client/src/main/java/org/apache/airavata/client/ airavata-client/src/main/java/org/apache/airavata/client/api/ airavata-client/src/main/java/org/apache/airavata/client/impl/ commons/...
Date Mon, 10 Sep 2012 07:20:20 GMT
Author: samindaw
Date: Mon Sep 10 07:20:19 2012
New Revision: 1382669

URL: http://svn.apache.org/viewvc?rev=1382669&view=rev
Log:
updating airavata client to support new registry api

Modified:
    incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java
    incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ApplicationManager.java
    incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/AiravataManagerImpl.java
    incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ApplicationManagerImpl.java
    incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java
    incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowManagerImpl.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/context/invocation/ExecutionContext.java
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/context/invocation/impl/DefaultExecutionContext.java
    incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java

Modified: incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java?rev=1382669&r1=1382668&r2=1382669&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java
(original)
+++ incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java
Mon Sep 10 07:20:19 2012
@@ -50,7 +50,6 @@ import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
 import javax.jcr.ValueFormatException;
-import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 
 import org.apache.airavata.client.api.AiravataAPI;
@@ -70,11 +69,11 @@ import org.apache.airavata.common.regist
 import org.apache.airavata.common.utils.Version;
 import org.apache.airavata.common.utils.XMLUtil;
 import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder;
-import org.apache.airavata.registry.api.AiravataRegistry;
+import org.apache.airavata.registry.api.AiravataRegistry2;
 import org.apache.airavata.registry.api.impl.AiravataJCRRegistry;
 import org.apache.airavata.registry.api.workflow.WorkflowExecution;
-import org.apache.airavata.schemas.wec.WorkflowSchedulingContextDocument.WorkflowSchedulingContext;
 import org.apache.airavata.workflow.model.component.ComponentException;
+import org.apache.airavata.workflow.model.component.registry.JCRComponentRegistry;
 import org.apache.airavata.workflow.model.component.ws.WSComponentPort;
 import org.apache.airavata.workflow.model.graph.GraphException;
 import org.apache.airavata.workflow.model.graph.impl.NodeImpl;
@@ -118,7 +117,7 @@ public class AiravataClient implements A
     private static WorkflowContextHeaderBuilder builder;
     private String currentUser;
     
-	private AiravataRegistry registry;
+	private AiravataRegistry2 registry;
 
     private Map<String, String> configuration = new HashMap<String, String>();
 	private AiravataManagerImpl airavataManagerImpl;
@@ -175,15 +174,15 @@ public class AiravataClient implements A
 		config.put(AiravataClient.JCR,registryUrl.toString());
 		config.put(AiravataClient.JCR_USERNAME,username);
 		config.put(AiravataClient.JCR_PASSWORD,password);
-		AiravataRegistry registryObject = getRegistryObject(registryUrl, username, password);
+		AiravataRegistry2 registryObject = getRegistryObject(registryUrl, username, password);
 		if (registryObject!=null){
-			List<URI> URLList = registryObject.getEventingServiceURLList();
-			config.put(AiravataClient.BROKER,URLList==null || URLList.size()==0? "http://localhost:8080/axis2/services/EventingService":URLList.get(0).toString());
-			URLList = registryObject.getMessageBoxServiceURLList();
-			config.put(AiravataClient.MSGBOX,URLList==null || URLList.size()==0? "http://localhost:8080/axis2/services/MsgBoxService":URLList.get(0).toString());
-			URLList = registryObject.getInterpreterServiceURLList();
+			URI uri = registryObject.getEventingServiceURI();
+			config.put(AiravataClient.BROKER,uri==null? "http://localhost:8080/axis2/services/EventingService":uri.toString());
+			uri = registryObject.getMessageBoxURI();
+			config.put(AiravataClient.MSGBOX,uri==null? "http://localhost:8080/axis2/services/MsgBoxService":uri.toString());
+			List<URI> URLList = registryObject.getWorkflowInterpreterURIs();
 			config.put(AiravataClient.WORKFLOWSERVICEURL,URLList==null || URLList.size()==0? "http://localhost:8080/axis2/services/WorkflowInterpretor?wsdl":URLList.get(0).toString());
-			List<String> urlList = registryObject.getGFacDescriptorList();
+			List<URI> urlList = registryObject.getGFacURIs();
 			config.put(AiravataClient.GFAC,urlList==null || urlList.size()==0? "http://localhost:8080/axis2/services/GFacService":urlList.get(0).toString());
 			config.put(AiravataClient.WITHLISTENER,"true");
 		}
@@ -228,7 +227,7 @@ public class AiravataClient implements A
 		
 		if (clientConfiguration.getJcrURL()!=null && clientConfiguration.getGfacURL()==null){
 			try {
-				clientConfiguration.setGfacURL(new URL(getRegistry().getGFacDescriptorList().get(0)));
+				clientConfiguration.setGfacURL(getRegistry().getGFacURIs().get(0).toURL());
 				configuration.put(GFAC,clientConfiguration.getGfacURL().toString());
 			} catch (Exception e) {
 				e.printStackTrace();
@@ -479,7 +478,7 @@ public class AiravataClient implements A
 		AiravataClient.workflow = workflow;
 	}
 
-	public AiravataRegistry getRegistry() throws RegistryException {
+	public AiravataRegistry2 getRegistry() throws RegistryException {
 		if (registry == null) {
 			try {
 				URL jcrURL = getClientConfiguration().getJcrURL();
@@ -494,17 +493,13 @@ public class AiravataClient implements A
 		return registry;
 	}
 
-	private static AiravataRegistry getRegistryObject(URI uri,
+	private static AiravataRegistry2 getRegistryObject(URI uri,
                                                       String jcrUsername,
                                                       String jcrPassword)
             throws RegistryException {
         HashMap<String, String> map = new HashMap<String, String>();
         map.put("org.apache.jackrabbit.repository.uri", uri.toString());
-        AiravataRegistry registry = new AiravataJCRRegistry(
-                uri,
-                "org.apache.jackrabbit.rmi.repository.RmiRepositoryFactory",
-                jcrUsername,
-                jcrPassword, map);
+        AiravataRegistry2 registry = new JCRComponentRegistry(jcrUsername,jcrPassword).getRegistry();
         return registry;
 	}
 
@@ -556,12 +551,11 @@ public class AiravataClient implements A
 
 	public List<String> getWorkflowTemplateIds() {
 		List<String> workflowList = new ArrayList<String>();
-		Map<QName, Node> workflows;
+		Map<String, String> workflows;
 		try {
-			workflows = getRegistry().getWorkflows(
-					getClientConfiguration().getJcrUsername());
-			for (QName qname : workflows.keySet()) {
-				workflowList.add(qname.getLocalPart());
+			workflows = getRegistry().getWorkflows();
+			for (String name : workflows.keySet()) {
+				workflowList.add(name);
 			}
 		} catch (RegistryException e) {
 			// TODO Auto-generated catch block
@@ -571,11 +565,11 @@ public class AiravataClient implements A
 	}
 	
 	public String runWorkflow(String workflowTemplateId,List<WorkflowInput> inputs) throws
Exception{
-		return runWorkflow(workflowTemplateId,inputs,getRegistry().getUsername(),null,workflowTemplateId+"_"+Calendar.getInstance().getTime().toString());
+		return runWorkflow(workflowTemplateId,inputs,getRegistry().getUser().getUserName(),null,workflowTemplateId+"_"+Calendar.getInstance().getTime().toString());
 	}
 	
 	public String runWorkflow(String workflowTemplateId,List<WorkflowInput> inputs,String
workflowInstanceName) throws Exception{
-		return runWorkflow(workflowTemplateId,inputs,getRegistry().getUsername(),null,workflowInstanceName);
+		return runWorkflow(workflowTemplateId,inputs,getRegistry().getUser().getUserName(),null,workflowInstanceName);
 	}
 	
 	public String runWorkflow(String workflowTemplateId,List<WorkflowInput> inputs, String
user, String metadata, String workflowInstanceName) throws Exception{
@@ -663,13 +657,13 @@ public class AiravataClient implements A
 		return null;
 	}
 
-	public Property getWorkflowAsString(String workflowTemplateId)
+	public String getWorkflowAsString(String workflowTemplateId)
 			throws RegistryException, PathNotFoundException,
 			RepositoryException {
-		Map<QName, Node> workflows = getRegistry().getWorkflows(getClientConfiguration().getJcrUsername());
-		for (QName qname : workflows.keySet()) {
-			if (qname.getLocalPart().equals(workflowTemplateId)){
-				return workflows.get(qname).getProperty("workflow");
+		Map<String, String> workflows = getRegistry().getWorkflows();
+		for (String name : workflows.keySet()) {
+			if (name.equals(workflowTemplateId)){
+				return workflows.get(name);
 			}
 		}
 		return null;
@@ -688,8 +682,7 @@ public class AiravataClient implements A
 			throws RegistryException, PathNotFoundException,
 			RepositoryException, GraphException, ComponentException,
 			ValueFormatException {
-		Property workflowAsString = getWorkflowAsString(workflowTemplateId);
-		Workflow workflow = new Workflow(workflowAsString.getString());
+		Workflow workflow = new Workflow(getWorkflowAsString(workflowTemplateId));
 		return workflow;
 	}
 
@@ -870,10 +863,8 @@ public class AiravataClient implements A
 
 
     public List<String> getWorkflowServiceNodeIDs(String templateID) {
-        Property workflowAsString = null;
         try {
-            workflowAsString = this.getWorkflowAsString(templateID);
-            Workflow workflow = new Workflow(workflowAsString.getString());
+            Workflow workflow = new Workflow(getWorkflowAsString(templateID));
             return workflow.getWorkflowServiceNodeIDs();
         } catch (RegistryException e) {
             e.printStackTrace();

Modified: incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ApplicationManager.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ApplicationManager.java?rev=1382669&r1=1382668&r2=1382669&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ApplicationManager.java
(original)
+++ incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ApplicationManager.java
Mon Sep 10 07:20:19 2012
@@ -100,11 +100,11 @@ public interface ApplicationManager {
     public List<ApplicationDeploymentDescription> searchDeploymentDescription(String
serviceName, String hostName)throws AiravataAPIInvocationException;
 
     /**
-     * Retrieve all registered deployment descriptions
+     * Retrieve all registered deployment descriptions, The key represents the service name
& host name in string array
      * @return
      * @throws AiravataAPIInvocationException
      */
-    public Map<ApplicationDeploymentDescription, String> getAllDeploymentDescriptions()
throws AiravataAPIInvocationException;
+    public Map<String[], ApplicationDeploymentDescription> getAllDeploymentDescriptions()
throws AiravataAPIInvocationException;
 
     /**
      * Retrieve list of registered deployment descriptions of the given regex service name,
regex host name & regex application name 

Modified: incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/AiravataManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/AiravataManagerImpl.java?rev=1382669&r1=1382668&r2=1382669&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/AiravataManagerImpl.java
(original)
+++ incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/AiravataManagerImpl.java
Mon Sep 10 07:20:19 2012
@@ -42,13 +42,9 @@ public class AiravataManagerImpl impleme
 	public List<URI> getGFaCURLs()  throws AiravataAPIInvocationException{
 		List<URI> list=new ArrayList<URI>();
 		try {
-			List<String> gFacDescriptorList = getClient().getRegistry().getGFacDescriptorList();
-			for (String urlString : gFacDescriptorList) {
-				try {
-					list.add(new URI(urlString));
-				} catch (URISyntaxException e) {
-					e.printStackTrace();
-				}
+			List<URI> gFacDescriptorList = getClient().getRegistry().getGFacURIs();
+			for (URI url : gFacDescriptorList) {
+				list.add(url);
 			}
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
@@ -76,7 +72,7 @@ public class AiravataManagerImpl impleme
 	@Override
 	public List<URI> getWorkflowInterpreterServiceURLs()  throws AiravataAPIInvocationException{
 		try {
-			return getClient().getRegistry().getInterpreterServiceURLList();
+			return getClient().getRegistry().getWorkflowInterpreterURIs();
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
 		}
@@ -112,11 +108,12 @@ public class AiravataManagerImpl impleme
 		
 	}
 
+	@SuppressWarnings("serial")
 	@Override
 	public List<URI> getMessageBoxServiceURLs()
 			throws AiravataAPIInvocationException {
 		try {
-			return getClient().getRegistry().getMessageBoxServiceURLList();
+			return new ArrayList<URI>(){{add(getClient().getRegistry().getMessageBoxURI());}};
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
 		}
@@ -140,11 +137,12 @@ public class AiravataManagerImpl impleme
 		return getMessageBoxServiceURL();
 	}
 
+	@SuppressWarnings("serial")
 	@Override
 	public List<URI> getEventingServiceURLs()
 			throws AiravataAPIInvocationException {
 		try {
-			return getClient().getRegistry().getEventingServiceURLList();
+			return new ArrayList<URI>(){{add(getClient().getRegistry().getEventingServiceURI());}};
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
 		}

Modified: incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ApplicationManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ApplicationManagerImpl.java?rev=1382669&r1=1382668&r2=1382669&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ApplicationManagerImpl.java
(original)
+++ incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ApplicationManagerImpl.java
Mon Sep 10 07:20:19 2012
@@ -21,6 +21,8 @@
 
 package org.apache.airavata.client.impl;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -31,6 +33,7 @@ import org.apache.airavata.common.regist
 import org.apache.airavata.commons.gfac.type.ApplicationDeploymentDescription;
 import org.apache.airavata.commons.gfac.type.HostDescription;
 import org.apache.airavata.commons.gfac.type.ServiceDescription;
+import org.apache.airavata.registry.api.exception.UnimplementedRegistryOperationException;
 
 public class ApplicationManagerImpl implements ApplicationManager {
 	private AiravataClient client;
@@ -43,7 +46,7 @@ public class ApplicationManagerImpl impl
 	public ServiceDescription getServiceDescription(String serviceId)
 			throws AiravataAPIInvocationException {
 		try {
-			ServiceDescription desc = getClient().getRegistry().getServiceDescription(serviceId);
+			ServiceDescription desc = getClient().getRegistry().getServiceDescriptor(serviceId);
 			if(desc!=null){
 	        	return desc;
 	        }
@@ -57,7 +60,7 @@ public class ApplicationManagerImpl impl
 	public List<ServiceDescription> getAllServiceDescriptions()
 			throws AiravataAPIInvocationException {
 		try {
-			return getClient().getRegistry().searchServiceDescription(".*");
+			return getClient().getRegistry().getServiceDescriptors();
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
 		}
@@ -67,7 +70,12 @@ public class ApplicationManagerImpl impl
 	public String saveServiceDescription(ServiceDescription service)
 			throws AiravataAPIInvocationException {
 		try {
-			return getClient().getRegistry().saveServiceDescription(service);
+			if (getClient().getRegistry().isServiceDescriptorExists(service.getType().getName()))
{
+				getClient().getRegistry().updateServiceDescriptor(service);
+			}else{
+				getClient().getRegistry().addServiceDescriptor(service);
+			}
+			return service.getType().getName();
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
 		}
@@ -77,7 +85,7 @@ public class ApplicationManagerImpl impl
 	public void deleteServiceDescription(String serviceId)
 			throws AiravataAPIInvocationException {
 		try {
-			getClient().getRegistry().deleteServiceDescription(serviceId);
+			getClient().getRegistry().removeServiceDescriptor(serviceId);
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
 		}
@@ -87,11 +95,7 @@ public class ApplicationManagerImpl impl
 	@Override
 	public List<ServiceDescription> searchServiceDescription(String nameRegEx)
 			throws AiravataAPIInvocationException {
-		try {
-			return getClient().getRegistry().searchServiceDescription(nameRegEx);
-		} catch (RegistryException e) {
-			throw new AiravataAPIInvocationException(e);
-		}
+		throw new AiravataAPIInvocationException(new UnimplementedRegistryOperationException());
 	}
 
 	@Override
@@ -99,7 +103,7 @@ public class ApplicationManagerImpl impl
 			String serviceId, String hostId)
 			throws AiravataAPIInvocationException {
 		try {
-			return getClient().getRegistry().getDeploymentDescription(serviceId, hostId);
+			return getClient().getRegistry().getApplicationDescriptors(serviceId, hostId);
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
 		}
@@ -110,7 +114,12 @@ public class ApplicationManagerImpl impl
 			ApplicationDeploymentDescription app)
 			throws AiravataAPIInvocationException {
 		try {
-			return getClient().getRegistry().saveDeploymentDescription(serviceId, hostId, app);
+			if (getClient().getRegistry().isApplicationDescriptorExists(serviceId, hostId, app.getType().getApplicationName().getStringValue()))
{
+				getClient().getRegistry().updateApplicationDescriptor(serviceId, hostId, app);
+			}else{
+				getClient().getRegistry().addApplicationDescriptor(serviceId, hostId, app);
+			}
+			return app.getType().getApplicationName().getStringValue();
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
 		}
@@ -120,18 +129,14 @@ public class ApplicationManagerImpl impl
 	public List<ApplicationDeploymentDescription> searchDeploymentDescription(
 			String serviceName, String hostName)
 			throws AiravataAPIInvocationException {
-		try {
-			return getClient().getRegistry().searchDeploymentDescription(serviceName, hostName);
-		} catch (RegistryException e) {
-			throw new AiravataAPIInvocationException(e);
-		}
+		throw new AiravataAPIInvocationException(new UnimplementedRegistryOperationException());
 	}
 
 	@Override
-	public Map<ApplicationDeploymentDescription, String> getAllDeploymentDescriptions()
+	public Map<String[], ApplicationDeploymentDescription> getAllDeploymentDescriptions()
 			throws AiravataAPIInvocationException {
 		try {
-			return getClient().getRegistry().searchDeploymentDescription();
+			return getClient().getRegistry().getApplicationDescriptors();
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
 		}
@@ -141,19 +146,22 @@ public class ApplicationManagerImpl impl
 	public List<ApplicationDeploymentDescription> searchDeploymentDescription(
 			String serviceName, String hostName, String applicationName)
 			throws AiravataAPIInvocationException {
-		try {
-			return getClient().getRegistry().searchDeploymentDescription(serviceName, hostName, applicationName);
-		} catch (RegistryException e) {
-			throw new AiravataAPIInvocationException(e);
-		}
+		throw new AiravataAPIInvocationException(new UnimplementedRegistryOperationException());
 	}
 
 	@Override
 	public Map<HostDescription, List<ApplicationDeploymentDescription>> searchDeploymentDescription(
 			String serviceName) throws AiravataAPIInvocationException {
 		try {
-			return getClient().getRegistry().searchDeploymentDescription(serviceName);
-		} catch (RegistryException e) {
+			Map<HostDescription, List<ApplicationDeploymentDescription>> map=new HashMap<HostDescription,
List<ApplicationDeploymentDescription>>();
+			Map<String, ApplicationDeploymentDescription> applicationDescriptors = getClient().getRegistry().getApplicationDescriptors(serviceName);
+			for (String hostName : applicationDescriptors.keySet()) {
+				ArrayList<ApplicationDeploymentDescription> list = new ArrayList<ApplicationDeploymentDescription>();
+				list.add(applicationDescriptors.get(hostName));
+				map.put(getClient().getRegistry().getHostDescriptor(hostName),list);
+			}
+			return map;
+		} catch (Exception e) {
 			throw new AiravataAPIInvocationException(e);
 		}
 	}
@@ -163,7 +171,7 @@ public class ApplicationManagerImpl impl
 			String hostName, String applicationName)
 			throws AiravataAPIInvocationException {
 		try {
-			getClient().getRegistry().deleteDeploymentDescription(serviceName, hostName, applicationName);
+			getClient().getRegistry().removeApplicationDescriptor(serviceName, hostName, applicationName);
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
 		}
@@ -173,7 +181,7 @@ public class ApplicationManagerImpl impl
 	public HostDescription getHostDescription(String hostId)
 			throws AiravataAPIInvocationException {
 		try {
-			return getClient().getRegistry().getHostDescription(hostId);
+			return getClient().getRegistry().getHostDescriptor(hostId);
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
 		}
@@ -183,7 +191,7 @@ public class ApplicationManagerImpl impl
 	public List<HostDescription> getAllHostDescriptions()
 			throws AiravataAPIInvocationException {
 		try {
-			return getClient().getRegistry().searchHostDescription(".*");
+			return getClient().getRegistry().getHostDescriptors();
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
 		}
@@ -193,7 +201,12 @@ public class ApplicationManagerImpl impl
 	public String saveHostDescription(HostDescription host)
 			throws AiravataAPIInvocationException {
 		try {
-			return getClient().getRegistry().saveHostDescription(host);
+			if (getClient().getRegistry().isHostDescriptorExists(host.getType().getHostName())) {
+				getClient().getRegistry().updateHostDescriptor(host);
+			}else{
+				getClient().getRegistry().addHostDescriptor(host);
+			}
+			return host.getType().getHostName();
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
 		}
@@ -202,18 +215,14 @@ public class ApplicationManagerImpl impl
 	@Override
 	public List<HostDescription> searchHostDescription(String regExName)
 			throws AiravataAPIInvocationException {
-		try {
-			return getClient().getRegistry().searchHostDescription(regExName);
-		} catch (RegistryException e) {
-			throw new AiravataAPIInvocationException(e);
-		}
+		throw new AiravataAPIInvocationException(new UnimplementedRegistryOperationException());
 	}
 
 	@Override
 	public void deleteHostDescription(String hostId)
 			throws AiravataAPIInvocationException {
 		try {
-			getClient().getRegistry().deleteHostDescription(hostId);
+			getClient().getRegistry().removeHostDescriptor(hostId);
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
 		}
@@ -222,11 +231,7 @@ public class ApplicationManagerImpl impl
 	@Override
 	public boolean deployServiceOnHost(String serviceName, String hostName)
 			throws AiravataAPIInvocationException {
-		try {
-			return getClient().getRegistry().deployServiceOnHost(serviceName, hostName);
-		} catch (RegistryException e) {
-			throw new AiravataAPIInvocationException(e);
-		}
+		throw new AiravataAPIInvocationException(new UnimplementedRegistryOperationException());
 	}
 
 	public AiravataClient getClient() {

Modified: incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java?rev=1382669&r1=1382668&r2=1382669&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java
(original)
+++ incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java
Mon Sep 10 07:20:19 2012
@@ -31,7 +31,6 @@ import org.apache.airavata.client.api.Ex
 import org.apache.airavata.common.registry.api.exception.RegistryException;
 import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder;
 import org.apache.airavata.core.gfac.context.invocation.impl.DefaultExecutionContext;
-import org.apache.airavata.core.gfac.notification.impl.LoggingNotification;
 import org.apache.airavata.workflow.model.wf.Workflow;
 import org.apache.airavata.workflow.model.wf.WorkflowInput;
 import org.apache.airavata.xbaya.monitor.Monitor;

Modified: incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowManagerImpl.java?rev=1382669&r1=1382668&r2=1382669&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowManagerImpl.java
(original)
+++ incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowManagerImpl.java
Mon Sep 10 07:20:19 2012
@@ -25,23 +25,15 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
-import javax.jcr.Node;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.RepositoryException;
-import javax.jcr.ValueFormatException;
-import javax.xml.namespace.QName;
-
 import org.apache.airavata.client.AiravataClient;
 import org.apache.airavata.client.api.AiravataAPIInvocationException;
 import org.apache.airavata.client.api.WorkflowManager;
 import org.apache.airavata.common.registry.api.exception.RegistryException;
-import org.apache.airavata.common.utils.StringUtil;
 import org.apache.airavata.common.utils.XMLUtil;
 import org.apache.airavata.workflow.model.wf.Workflow;
 
 public class WorkflowManagerImpl implements WorkflowManager {
 	private AiravataClient client;
-    private static final String OGCE_WORKFLOW_NS = "http://workflow.ogce.org/";
 
 	public WorkflowManagerImpl(AiravataClient client) {
 		setClient(client);
@@ -54,10 +46,6 @@ public class WorkflowManagerImpl impleme
 	public void setClient(AiravataClient client) {
 		this.client = client;
 	}
-
-	private String getWorkflowStringFromNode(Node node) throws ValueFormatException, IllegalStateException,
PathNotFoundException, RepositoryException{
-		return node.getProperty("workflow").getValue().getString();
-	}
 	
 	@Override
 	public boolean saveWorkflow(String workflowAsString, String owner)
@@ -74,7 +62,15 @@ public class WorkflowManagerImpl impleme
 	private boolean saveWorkflow(Workflow workflow, String workflowAsString,String owner)
 			throws AiravataAPIInvocationException {
 		try {
-			getClient().getRegistry().saveWorkflow(new QName(OGCE_WORKFLOW_NS,StringUtil.convertToJavaIdentifier(workflow.getName())),
workflow.getName(), workflow.getDescription(), workflowAsString, owner, owner==null? true:false);
+			
+			if (getClient().getRegistry().isWorkflowExists(workflow.getName())) {
+				getClient().getRegistry().updateWorkflow(workflow.getName(),workflowAsString);
+			}else{
+				getClient().getRegistry().addWorkflow(workflow.getName(),workflowAsString);
+			}
+			if (owner==null){
+				getClient().getRegistry().publishWorkflow(workflow.getName());
+			}
 			return true;
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
@@ -86,9 +82,9 @@ public class WorkflowManagerImpl impleme
 			throws AiravataAPIInvocationException {
 		try {
 			List<Workflow> workflows=new ArrayList<Workflow>();
-			Map<QName, Node> workflowMap = getClient().getRegistry().getWorkflows(owner);
-			for(Node node:workflowMap.values()){
-				workflows.add(getWorkflowFromString(getWorkflowStringFromNode(node)));
+			Map<String, String> workflowMap = getClient().getRegistry().getWorkflows();
+			for(String workflowStr:workflowMap.values()){
+				workflows.add(getWorkflowFromString(workflowStr));
 			}
 			return workflows;
 		} catch (Exception e) {
@@ -101,10 +97,10 @@ public class WorkflowManagerImpl impleme
 			throws AiravataAPIInvocationException {
 		try {
 			List<String> workflowList = new ArrayList<String>();
-			Map<QName, Node> workflows;
-			workflows = getClient().getRegistry().getWorkflows(owner);
-			for (QName qname : workflows.keySet()) {
-				workflowList.add(qname.getLocalPart());
+			Map<String, String> workflows;
+			workflows = getClient().getRegistry().getWorkflows();
+			for (String name : workflows.keySet()) {
+				workflowList.add(name);
 			}
 			return workflowList;
 		} catch (RegistryException e) {
@@ -122,7 +118,7 @@ public class WorkflowManagerImpl impleme
 	public String getWorkflowAsString(String workflowName, String owner)
 			throws AiravataAPIInvocationException {
 		try {
-			return getWorkflowStringFromNode(getClient().getRegistry().getWorkflow(new QName(workflowName),
owner));
+			return getClient().getRegistry().getWorkflowGraphXML(workflowName);
 		} catch (Exception e) {
 			throw new AiravataAPIInvocationException(e);
 		}
@@ -132,7 +128,8 @@ public class WorkflowManagerImpl impleme
 	public boolean deleteWorkflow(String workflowName, String owner)
 			throws AiravataAPIInvocationException {
 		try {
-			return getClient().getRegistry().deleteWorkflow(new QName(workflowName), owner);
+			getClient().getRegistry().removeWorkflow(workflowName);
+			return true;
 		} catch (RegistryException e) {
 			throw new AiravataAPIInvocationException(e);
 		}

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java?rev=1382669&r1=1382668&r2=1382669&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java
(original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java
Mon Sep 10 07:20:19 2012
@@ -75,6 +75,16 @@ public interface ProvenanceRegistry exte
 	public abstract boolean saveWorkflowExecutionStatus(String experimentId,ExecutionStatus
status)throws RegistryException;
 
     /**
+     * Save a status for this workflow execution
+     * @param experimentId
+     * @param status - contains the status
+     * @return
+     * @throws RegistryException
+     */
+	public abstract boolean saveWorkflowExecutionStatus(String experimentId,WorkflowInstanceStatus
status)throws RegistryException;
+
+	
+    /**
      * Return the status of the execution
      * @param experimentId
      * @return

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/context/invocation/ExecutionContext.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/context/invocation/ExecutionContext.java?rev=1382669&r1=1382668&r2=1382669&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/context/invocation/ExecutionContext.java
(original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/context/invocation/ExecutionContext.java
Mon Sep 10 07:20:19 2012
@@ -23,9 +23,8 @@ package org.apache.airavata.core.gfac.co
 
 import org.apache.airavata.core.gfac.notification.GFacNotifiable;
 import org.apache.airavata.core.gfac.notification.GFacNotifier;
-import org.apache.airavata.registry.api.AiravataRegistry;
+import org.apache.airavata.registry.api.AiravataRegistry2;
 import org.apache.axiom.om.OMElement;
-import xsul.lead.LeadContextHeader;
 
 /**
  * The Execution Context is used for passing information around the whole service. It keeps
information about general
@@ -54,7 +53,7 @@ public interface ExecutionContext {
      * 
      * @return Registry object
      */
-    AiravataRegistry getRegistryService();
+    AiravataRegistry2 getRegistryService();
 
     /**
      * Set Registry object.
@@ -62,7 +61,7 @@ public interface ExecutionContext {
      * @param AiravataRegistry
      *            object to used.
      */
-    void setRegistryService(AiravataRegistry value);
+    void setRegistryService(AiravataRegistry2 value);
 
     public OMElement getSecurityContextHeader();
 

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/context/invocation/impl/DefaultExecutionContext.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/context/invocation/impl/DefaultExecutionContext.java?rev=1382669&r1=1382668&r2=1382669&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/context/invocation/impl/DefaultExecutionContext.java
(original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/context/invocation/impl/DefaultExecutionContext.java
Mon Sep 10 07:20:19 2012
@@ -25,7 +25,7 @@ import org.apache.airavata.core.gfac.con
 import org.apache.airavata.core.gfac.notification.GFacNotifiable;
 import org.apache.airavata.core.gfac.notification.GFacNotifier;
 import org.apache.airavata.core.gfac.notification.impl.DefaultNotifier;
-import org.apache.airavata.registry.api.AiravataRegistry;
+import org.apache.airavata.registry.api.AiravataRegistry2;
 import org.apache.axiom.om.OMElement;
 
 /**
@@ -35,7 +35,7 @@ import org.apache.axiom.om.OMElement;
 public class DefaultExecutionContext implements ExecutionContext {
 
     private GFacNotifier notificationService = new DefaultNotifier();
-    private AiravataRegistry registryService;
+    private AiravataRegistry2 registryService;
     private OMElement header;
 
     public GFacNotifier getNotifier() {
@@ -46,11 +46,11 @@ public class DefaultExecutionContext imp
         this.notificationService.addNotifiable(service);
     }
 
-    public AiravataRegistry getRegistryService() {
+    public AiravataRegistry2 getRegistryService() {
         return this.registryService;
     }
 
-    public void setRegistryService(AiravataRegistry registryService) {
+    public void setRegistryService(AiravataRegistry2 registryService) {
         this.registryService = registryService;
     }
 

Modified: incubator/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/incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java?rev=1382669&r1=1382668&r2=1382669&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
(original)
+++ incubator/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
Mon Sep 10 07:20:19 2012
@@ -1078,4 +1078,11 @@ public class AiravataJPARegistry extends
 		
 	}
 
+	@Override
+	public boolean saveWorkflowExecutionStatus(String experimentId,
+			WorkflowInstanceStatus status) throws RegistryException {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
 }



Mime
View raw message