You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2012/11/21 16:56:18 UTC

svn commit: r1412158 - in /airavata/trunk/modules: airavata-client/src/main/java/org/apache/airavata/client/ airavata-client/src/main/java/org/apache/airavata/client/impl/ registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/reg...

Author: samindaw
Date: Wed Nov 21 15:56:17 2012
New Revision: 1412158

URL: http://svn.apache.org/viewvc?rev=1412158&view=rev
Log:
updating API

Modified:
    airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java
    airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClientUtils.java
    airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/AiravataManagerImpl.java
    airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ApplicationManagerImpl.java
    airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ProvenanceManagerImpl.java
    airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowManagerImpl.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
    airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java
    airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryFactory.java
    airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataSubRegistry.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/RegistryClient.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=1412158&r1=1412157&r2=1412158&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 Wed Nov 21 15:56:17 2012
@@ -63,15 +63,21 @@ import org.apache.airavata.client.impl.U
 import org.apache.airavata.client.impl.WorkflowManagerImpl;
 import org.apache.airavata.client.stub.interpretor.NameValue;
 import org.apache.airavata.client.stub.interpretor.WorkflowInterpretorStub;
+import org.apache.airavata.common.exception.AiravataConfigurationException;
 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.AiravataRegistry2;
 import org.apache.airavata.registry.api.AiravataRegistryFactory;
+import org.apache.airavata.registry.api.AiravataUser;
+import org.apache.airavata.registry.api.Callback;
+import org.apache.airavata.registry.api.Gateway;
+import org.apache.airavata.registry.api.exception.RegistryAccessorInstantiateException;
+import org.apache.airavata.registry.api.exception.RegistryAccessorInvalidException;
+import org.apache.airavata.registry.api.exception.RegistryAccessorNotFoundException;
+import org.apache.airavata.registry.api.exception.RegistryAccessorUndefinedException;
 import org.apache.airavata.registry.api.exception.RegistryException;
 import org.apache.airavata.registry.api.workflow.ExperimentData;
-import org.apache.airavata.rest.client.RegistryClient;
-import org.apache.airavata.registry.api.Callback;
 import org.apache.airavata.workflow.model.component.ComponentException;
 import org.apache.airavata.workflow.model.component.ws.WSComponentPort;
 import org.apache.airavata.workflow.model.graph.GraphException;
@@ -124,6 +130,7 @@ public class AiravataClient implements A
 	private ProvenanceManagerImpl provenanceManagerImpl;
 	private UserManagerImpl userManagerImpl;
 	private ExecutionManagerImpl executionManagerImpl;
+	private String gateway;
 
 	// private NameValue[] configurations = new NameValue[7];
 
@@ -353,21 +360,21 @@ public class AiravataClient implements A
 		}
 	}
 
-	public String runWorkflow(String topic) {
+	public String runWorkflow(String topic) throws AiravataConfigurationException {
 		return runWorkflow(topic, (String) null);
 	}
 
-	public String runWorkflow(String topic, String user) {
+	public String runWorkflow(String topic, String user) throws AiravataConfigurationException {
 		return runWorkflow(topic, user, null, topic);
 	}
 
 	public String runWorkflow(String topic, String user, String metadata,
-			String workflowInstanceName) {
+			String workflowInstanceName) throws AiravataConfigurationException {
 		return runWorkflow(topic, user, metadata, workflowInstanceName, builder);
 	}
 
 	public String runWorkflow(String topic, String user, String metadata,
-			String workflowInstanceName, WorkflowContextHeaderBuilder builder) {
+			String workflowInstanceName, WorkflowContextHeaderBuilder builder) throws AiravataConfigurationException {
 		String worflowoutput = null;
 		try {
 			WorkflowInterpretorStub stub = new WorkflowInterpretorStub(
@@ -414,7 +421,7 @@ public class AiravataClient implements A
 	}
 
 	private void runPreWorkflowExecutionTasks(String topic, String user,
-			String metadata, String experimentName) throws RegistryException {
+			String metadata, String experimentName) throws RegistryException, AiravataConfigurationException {
 		if (user != null) {
 			getRegistryClient().updateExperimentExecutionUser(topic, user);
 		}
@@ -447,7 +454,7 @@ public class AiravataClient implements A
 	public String runWorkflow(final String topic, final NameValue[] inputs,
 			final String user, final String metadata,
 			final String experimentName,
-			final WorkflowContextHeaderBuilder builder) throws AiravataAPIInvocationException {
+			final WorkflowContextHeaderBuilder builder) throws AiravataAPIInvocationException, AiravataConfigurationException {
 		return runWorkflow(topic, inputs, user, metadata, experimentName,
 				builder, true);
 	}
@@ -459,7 +466,7 @@ public class AiravataClient implements A
 			final String user, final String metadata,
 			final String experimentName,
 			final WorkflowContextHeaderBuilder builder, boolean launchOnThread)
-			throws AiravataAPIInvocationException {
+			throws AiravataAPIInvocationException, AiravataConfigurationException {
 		try {
 			runPreWorkflowExecutionTasks(topic, user, metadata, experimentName);
 		} catch (RegistryException e) {
@@ -490,12 +497,12 @@ public class AiravataClient implements A
 	}
 
 	public List<ExperimentData> getWorkflowExecutionDataByUser(String user)
-			throws RegistryException {
+			throws RegistryException, AiravataConfigurationException {
 		return getRegistryClient().getExperimentByUser(user);
 	}
 
 	public ExperimentData getWorkflowExecutionData(String topic)
-			throws RegistryException {
+			throws RegistryException, AiravataConfigurationException {
 		return getRegistryClient().getExperiment(topic);
 	}
 
@@ -513,9 +520,13 @@ public class AiravataClient implements A
 		AiravataClient.workflow = workflow;
 	}
 
-	public AiravataRegistry2 getRegistryClient(){
-        RegistryClient registryClient = new RegistryClient(getCurrentUser(), getCallBack());
-        return registryClient;
+	public AiravataRegistry2 getRegistryClient() throws RegistryAccessorNotFoundException, RegistryAccessorUndefinedException, RegistryAccessorInstantiateException, AiravataConfigurationException, RegistryAccessorInvalidException{
+		if (registry==null) {
+			registry = AiravataRegistryFactory.getRegistry(getRegitryURI(),
+					new Gateway(getGateway()), new AiravataUser(
+							getCurrentUser()), getCallBack());
+		}
+        return registry;
     }
 
 
@@ -1004,4 +1015,13 @@ public class AiravataClient implements A
     public void setCallBack(Callback callBack) {
         this.callBack = callBack;
     }
+    
+
+	public String getGateway() {
+		return gateway;
+	}
+
+	public void setGateway(String gateway) {
+		this.gateway = gateway;
+	}
 }

Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClientUtils.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClientUtils.java?rev=1412158&r1=1412157&r2=1412158&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClientUtils.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClientUtils.java Wed Nov 21 15:56:17 2012
@@ -34,26 +34,34 @@ import org.apache.airavata.registry.api.
 import org.apache.airavata.registry.api.Callback;
 
 public class AiravataClientUtils {
-	public static AiravataAPI getAPI(URI registryURL, String username, String password) throws MalformedURLException, RepositoryException, RegistryException{
-		return getAPI(registryURL, username, password, username);
-	}
-
-    public static AiravataAPI getAPI(URI registryURL, String username, String alternateUsername, Callback callback) throws MalformedURLException, RepositoryException, RegistryException{
+	
+	public static AiravataAPI getAPI(URI registryURL, String gateway, String username, Callback callback) throws MalformedURLException, RepositoryException, RegistryException{
+        return getAPI(registryURL, gateway, username, username, callback);
+    }
+    
+    public static AiravataAPI getAPI(URI registryURL, String gateway, String username, String alternateUsername, Callback callback) throws MalformedURLException, RepositoryException, RegistryException{
         AiravataClient apiObj = new AiravataClient();
         apiObj.setCurrentUser(alternateUsername);
         apiObj.setCallBack(callback);
         apiObj.setPassword(callback.getPassword(username));
         apiObj.setRegitryURI(registryURL);
+        apiObj.setGateway(gateway);
         return apiObj;
     }
 
+	@Deprecated
+    public static AiravataAPI getAPI(URI registryURL, String username, String password) throws MalformedURLException, RepositoryException, RegistryException{
+		return getAPI(registryURL, username, password, username);
+	}
+	
+    @Deprecated
     public static AiravataAPI getAPI(URI registryURL, String username, Callback callback) throws MalformedURLException, RepositoryException, RegistryException{
         return getAPI(registryURL, username, username, callback);
     }
 
+    @Deprecated
 	public static AiravataAPI getAPI(URI registryURL, String username, String password, String alternateUsername) throws MalformedURLException, RepositoryException, RegistryException{
-        AiravataAPI airavataAPI = getAPI(registryURL, username, new PasswordCallBackImpl(username, password));
-		return airavataAPI;
+		return getAPI(registryURL, username, new PasswordCallBackImpl(username, password));
 	}
 
     @Deprecated

Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/AiravataManagerImpl.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/AiravataManagerImpl.java?rev=1412158&r1=1412157&r2=1412158&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/AiravataManagerImpl.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/AiravataManagerImpl.java Wed Nov 21 15:56:17 2012
@@ -32,7 +32,6 @@ import org.apache.airavata.client.api.Ai
 import org.apache.airavata.client.api.AiravataManager;
 import org.apache.airavata.registry.api.AiravataUser;
 import org.apache.airavata.registry.api.Gateway;
-import org.apache.airavata.registry.api.exception.RegistryException;
 
 public class AiravataManagerImpl implements AiravataManager {
 	private AiravataClient client;
@@ -351,12 +350,20 @@ public class AiravataManagerImpl impleme
 
     @Override
     public Gateway getGateway() throws AiravataAPIInvocationException {
-        return getClient().getRegistryClient().getGateway();
+        try {
+			return getClient().getRegistryClient().getGateway();
+		} catch (Exception e) {
+			throw new AiravataAPIInvocationException(e);
+		}
     }
 
     @Override
     public AiravataUser getUser() throws AiravataAPIInvocationException {
-        return getClient().getRegistryClient().getUser();
+    	try{
+    		return getClient().getRegistryClient().getUser();
+    	} catch (Exception e) {
+			throw new AiravataAPIInvocationException(e);
+		}
     }
 
 }

Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ApplicationManagerImpl.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ApplicationManagerImpl.java?rev=1412158&r1=1412157&r2=1412158&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ApplicationManagerImpl.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ApplicationManagerImpl.java Wed Nov 21 15:56:17 2012
@@ -29,12 +29,10 @@ import java.util.Map;
 import org.apache.airavata.client.AiravataClient;
 import org.apache.airavata.client.api.AiravataAPIInvocationException;
 import org.apache.airavata.client.api.ApplicationManager;
-import org.apache.airavata.registry.api.exception.RegistryException;
 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;
-import org.apache.airavata.registry.api.exception.gateway.MalformedDescriptorException;
 
 public class ApplicationManagerImpl implements ApplicationManager {
 	private AiravataClient client;
@@ -240,9 +238,7 @@ public class ApplicationManagerImpl impl
         try{
             Map<String, ApplicationDeploymentDescription> applicationDescriptors = getClient().getRegistryClient().getApplicationDescriptors(serviceName);
             return applicationDescriptors;
-        } catch (MalformedDescriptorException e) {
-            throw new AiravataAPIInvocationException(e);
-        } catch (RegistryException e) {
+        } catch (Exception e) {
             throw new AiravataAPIInvocationException(e);
         }
     }
@@ -251,7 +247,7 @@ public class ApplicationManagerImpl impl
     public boolean isHostDescriptorExists(String descriptorName) throws AiravataAPIInvocationException {
         try {
             return getClient().getRegistryClient().isHostDescriptorExists(descriptorName);
-        } catch (RegistryException e) {
+        } catch (Exception e) {
             throw new AiravataAPIInvocationException(e);
         }
     }
@@ -260,7 +256,7 @@ public class ApplicationManagerImpl impl
     public void removeHostDescriptor(String hostName) throws AiravataAPIInvocationException {
         try {
             getClient().getRegistryClient().removeHostDescriptor(hostName);
-        } catch (RegistryException e) {
+        } catch (Exception e) {
             throw new AiravataAPIInvocationException(e);
         }
     }
@@ -269,7 +265,7 @@ public class ApplicationManagerImpl impl
     public boolean isServiceDescriptorExists(String descriptorName) throws AiravataAPIInvocationException {
         try {
             return getClient().getRegistryClient().isServiceDescriptorExists(descriptorName);
-        } catch (RegistryException e) {
+        } catch (Exception e) {
             throw new AiravataAPIInvocationException(e);
         }
     }
@@ -278,7 +274,7 @@ public class ApplicationManagerImpl impl
     public void removeServiceDescriptor(String serviceName) throws AiravataAPIInvocationException {
         try {
             getClient().getRegistryClient().removeServiceDescriptor(serviceName);
-        } catch (RegistryException e) {
+        } catch (Exception e) {
             throw new AiravataAPIInvocationException(e);
         }
     }
@@ -287,7 +283,7 @@ public class ApplicationManagerImpl impl
     public void removeApplicationDescriptor(String serviceName, String hostName, String applicationName) throws AiravataAPIInvocationException {
         try {
             getClient().getRegistryClient().removeApplicationDescriptor(serviceName, hostName, applicationName);
-        } catch (RegistryException e) {
+        } catch (Exception e) {
             throw new AiravataAPIInvocationException(e);
         }
     }
@@ -296,7 +292,7 @@ public class ApplicationManagerImpl impl
     public void updateHostDescriptor(HostDescription descriptor) throws AiravataAPIInvocationException {
         try {
             getClient().getRegistryClient().updateHostDescriptor(descriptor);
-        } catch (RegistryException e) {
+        } catch (Exception e) {
             throw new AiravataAPIInvocationException(e);
         }
     }
@@ -305,7 +301,7 @@ public class ApplicationManagerImpl impl
     public void updateServiceDescriptor(ServiceDescription descriptor) throws AiravataAPIInvocationException {
         try {
             getClient().getRegistryClient().updateServiceDescriptor(descriptor);
-        } catch (RegistryException e) {
+        } catch (Exception e) {
             throw new AiravataAPIInvocationException(e);
         }
     }
@@ -314,7 +310,7 @@ public class ApplicationManagerImpl impl
     public void updateApplicationDescriptor(String serviceName, String hostName, ApplicationDeploymentDescription descriptor) throws AiravataAPIInvocationException {
         try {
             getClient().getRegistryClient().updateApplicationDescriptor(serviceName, hostName, descriptor);
-        } catch (RegistryException e) {
+        } catch (Exception e) {
             throw new AiravataAPIInvocationException(e);
         }
     }
@@ -323,7 +319,7 @@ public class ApplicationManagerImpl impl
     public ApplicationDeploymentDescription getApplicationDescriptor(String serviceName, String hostname, String applicationName) throws AiravataAPIInvocationException {
         try {
             return getClient().getRegistryClient().getApplicationDescriptor(serviceName, hostname, applicationName);
-        } catch (RegistryException e) {
+        } catch (Exception e) {
             throw new AiravataAPIInvocationException(e);
         }
     }

Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ProvenanceManagerImpl.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ProvenanceManagerImpl.java?rev=1412158&r1=1412157&r2=1412158&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ProvenanceManagerImpl.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ProvenanceManagerImpl.java Wed Nov 21 15:56:17 2012
@@ -429,7 +429,7 @@ public class ProvenanceManagerImpl imple
     public void saveWorkflowExecutionOutput(String experimentId, String outputNodeName, String output) throws AiravataAPIInvocationException {
         try {
             getClient().getRegistryClient().saveWorkflowExecutionOutput(experimentId, outputNodeName, output);
-        } catch (RegistryException e) {
+        } catch (Exception e) {
             throw new AiravataAPIInvocationException(e);
         }
     }

Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowManagerImpl.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowManagerImpl.java?rev=1412158&r1=1412157&r2=1412158&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowManagerImpl.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowManagerImpl.java Wed Nov 21 15:56:17 2012
@@ -30,7 +30,6 @@ import org.apache.airavata.client.Airava
 import org.apache.airavata.client.api.AiravataAPIInvocationException;
 import org.apache.airavata.client.api.WorkflowManager;
 import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.registry.api.exception.RegistryException;
 import org.apache.airavata.workflow.model.wf.Workflow;
 import org.apache.airavata.workflow.model.wf.WorkflowData;
 import org.apache.airavata.workflow.model.wf.WorkflowInput;
@@ -333,7 +332,7 @@ public class WorkflowManagerImpl impleme
     public boolean isWorkflowExists(String workflowName) throws AiravataAPIInvocationException {
         try {
             return getClient().getRegistryClient().isWorkflowExists(workflowName);
-        } catch (RegistryException e) {
+        } catch (Exception e) {
             throw new AiravataAPIInvocationException(e);
         }
     }
@@ -342,7 +341,7 @@ public class WorkflowManagerImpl impleme
     public void updateWorkflow(String workflowName, String workflowGraphXml) throws AiravataAPIInvocationException {
         try {
             getClient().getRegistryClient().updateWorkflow(workflowName, workflowGraphXml);
-        } catch (RegistryException e) {
+        } catch (Exception e) {
             throw new AiravataAPIInvocationException(e);
         }
     }
@@ -351,7 +350,7 @@ public class WorkflowManagerImpl impleme
     public void removeWorkflow(String workflowName) throws AiravataAPIInvocationException {
         try {
             getClient().getRegistryClient().removeWorkflow(workflowName);
-        } catch (RegistryException e) {
+        } catch (Exception e) {
             throw new AiravataAPIInvocationException(e);
         }
     }

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=1412158&r1=1412157&r2=1412158&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 Wed Nov 21 15:56:17 2012
@@ -56,6 +56,7 @@ import org.apache.airavata.persistance.r
 import org.apache.airavata.registry.api.AiravataExperiment;
 import org.apache.airavata.registry.api.AiravataRegistry2;
 import org.apache.airavata.registry.api.AiravataUser;
+import org.apache.airavata.registry.api.Callback;
 import org.apache.airavata.registry.api.Gateway;
 import org.apache.airavata.registry.api.ResourceMetadata;
 import org.apache.airavata.registry.api.WorkspaceProject;
@@ -98,6 +99,9 @@ public class AiravataJPARegistry extends
     private boolean active=false;
     private static final String DEFAULT_PROJECT_NAME = "default";
     private static final Version API_VERSION=new Version("Airavata Registry API",0,5,null,null,null);
+    private URI registryConnectionURI;
+    
+    private Callback callback;
     
     @Override
     protected void initialize() {
@@ -1430,4 +1434,28 @@ public class AiravataJPARegistry extends
 		return API_VERSION;
 	}
 
+
+	@Override
+	public void setConnectionURI(URI connectionURI) {
+		registryConnectionURI=connectionURI;
+	}
+
+
+	@Override
+	public URI getConnectionURI() {
+		return registryConnectionURI;
+	}
+
+
+	@Override
+	public void setCallback(Callback callback) {
+		this.callback=callback;
+	}
+
+
+	@Override
+	public Callback getCallback() {
+		return callback;
+	}
+
 }

Modified: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java?rev=1412158&r1=1412157&r2=1412158&view=diff
==============================================================================
--- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java (original)
+++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry2.java Wed Nov 21 15:56:17 2012
@@ -21,6 +21,7 @@
 
 package org.apache.airavata.registry.api;
 
+import java.net.URI;
 import java.util.Observable;
 
 
@@ -35,6 +36,13 @@ public abstract class AiravataRegistry2 
 		setUser(user);
 	}
 	
+	protected void preInitialize(URI connectionURI, Gateway gateway, AiravataUser user, Callback callback) {
+		setConnectionURI(connectionURI);
+		setGateway(gateway);
+		setUser(user);
+		setCallback(callback);
+	}
+	
 	protected abstract void initialize();
 	
 	public Gateway getGateway() {

Modified: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryFactory.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryFactory.java?rev=1412158&r1=1412157&r2=1412158&view=diff
==============================================================================
--- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryFactory.java (original)
+++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistryFactory.java Wed Nov 21 15:56:17 2012
@@ -22,6 +22,7 @@
 package org.apache.airavata.registry.api;
 
 import java.io.IOException;
+import java.net.URI;
 import java.net.URL;
 import java.util.Properties;
 
@@ -40,7 +41,7 @@ public class AiravataRegistryFactory {
 	/***
 	 * Return a registry accessor object capable of handling all data in the
 	 * registry
-	 *
+	 * @deprecated
 	 * @param gateway
 	 * @param user
 	 * @return
@@ -65,6 +66,34 @@ public class AiravataRegistryFactory {
 		throw new RegistryAccessorInvalidException(registryObj.getClass()
 				.getName());
 	}
+	
+	/***
+	 * Return a registry accessor object capable of handling all data in the
+	 * registry
+	 * @param gateway
+	 * @param user
+	 * @return
+	 * @throws RegistryAccessorNotFoundException
+	 * @throws RegistryAccessorUndefinedException
+	 * @throws RegistryAccessorInstantiateException
+	 * @throws AiravataConfigurationException
+	 * @throws RegistryAccessorInvalidException
+	 */
+	public static AiravataRegistry2 getRegistry(URI connectionURI, Gateway gateway,
+			AiravataUser user, Callback callback) throws RegistryAccessorNotFoundException,
+			RegistryAccessorUndefinedException,
+			RegistryAccessorInstantiateException,
+			AiravataConfigurationException, RegistryAccessorInvalidException {
+		Object registryObj = getRegistryClass(REGISTRY_ACCESSOR_CLASS);
+		if (registryObj instanceof AiravataRegistry2) {
+			AiravataRegistry2 registry = (AiravataRegistry2) registryObj;
+			registry.preInitialize(connectionURI, gateway, user, callback);
+			registry.initialize();
+			return registry;
+		}
+		throw new RegistryAccessorInvalidException(registryObj.getClass()
+				.getName());
+	}
 
 	/***
 	 * Given the key in the <code>REPOSITORY_PROPERTIES</code> file it will

Modified: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataSubRegistry.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataSubRegistry.java?rev=1412158&r1=1412157&r2=1412158&view=diff
==============================================================================
--- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataSubRegistry.java (original)
+++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataSubRegistry.java Wed Nov 21 15:56:17 2012
@@ -21,6 +21,8 @@
 
 package org.apache.airavata.registry.api;
 
+import java.net.URI;
+
 import org.apache.airavata.common.utils.Version;
 
 public interface AiravataSubRegistry {
@@ -48,4 +50,12 @@ public interface AiravataSubRegistry {
 	 */
 	public Version getVersion();
 	
+	public void setConnectionURI(URI connectionURI);
+	
+	public URI getConnectionURI();
+	
+	public void setCallback(Callback callback);
+	
+	public Callback getCallback();
+	
 }
\ No newline at end of file

Modified: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/RegistryClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/RegistryClient.java?rev=1412158&r1=1412157&r2=1412158&view=diff
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/RegistryClient.java (original)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/RegistryClient.java Wed Nov 21 15:56:17 2012
@@ -38,6 +38,10 @@ import java.util.List;
 import java.util.Map;
 
 public class RegistryClient extends AiravataRegistry2 {
+
+    private URI connectionURI;
+    private Callback callback;
+    
     private BasicRegistryResourceClient basicRegistryResourceClient;
     private ConfigurationResourceClient configurationResourceClient;
     private DescriptorResourceClient descriptorResourceClient;
@@ -780,4 +784,24 @@ public class RegistryClient extends Aira
     public Version getVersion() {
         return getBasicRegistryResourceClient().getVersion();
     }
+    
+	@Override
+	public void setConnectionURI(URI connectionURI) {
+		this.connectionURI=connectionURI;
+	}
+
+	@Override
+	public URI getConnectionURI() {
+		return connectionURI;
+	}
+
+	@Override
+	public void setCallback(Callback callback) {
+		this.callback=callback;
+	}
+
+	@Override
+	public Callback getCallback() {
+		return callback;
+	}
 }