airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject svn commit: r1411407 - in /airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client: AiravataClient.java AiravataClientUtils.java
Date Mon, 19 Nov 2012 20:58:50 GMT
Author: chathuri
Date: Mon Nov 19 20:58:50 2012
New Revision: 1411407

URL: http://svn.apache.org/viewvc?rev=1411407&view=rev
Log:
adding airavata client initialization method with callback impl

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

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=1411407&r1=1411406&r2=1411407&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
Mon Nov 19 20:58:50 2012
@@ -65,6 +65,7 @@ import org.apache.airavata.registry.api.
 import org.apache.airavata.registry.api.exception.RegistryException;
 import org.apache.airavata.registry.api.workflow.ExperimentData;
 import org.apache.airavata.rest.client.*;
+import org.apache.airavata.rest.utils.Callback;
 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;
@@ -107,7 +108,7 @@ public class AiravataClient implements A
 	private String currentUser;
     private String password;
     private URI regitryURI;
-    private PasswordCallBackImpl passwordCallBack;
+    private Callback callBack;
 
 	private AiravataRegistry2 registry;
 
@@ -506,50 +507,42 @@ public class AiravataClient implements A
 	}
 
 	public ConfigurationResourceClient getConfigurationResourceClient (){
-        passwordCallBack = new PasswordCallBackImpl(getCurrentUser(), getPassword());
-        ConfigurationResourceClient configurationResourceClient = new ConfigurationResourceClient(getCurrentUser(),
passwordCallBack);
+        ConfigurationResourceClient configurationResourceClient = new ConfigurationResourceClient(getCurrentUser(),
getCallBack());
         return configurationResourceClient;
     }
 
     public DescriptorResourceClient getDescriptorResourceClient (){
-        passwordCallBack = new PasswordCallBackImpl(getCurrentUser(), getPassword());
-        DescriptorResourceClient descriptorResourceClient = new DescriptorResourceClient(getCurrentUser(),
passwordCallBack);
+        DescriptorResourceClient descriptorResourceClient = new DescriptorResourceClient(getCurrentUser(),
getCallBack());
         return descriptorResourceClient;
     }
 
     public ExperimentResourceClient getExperimentResourceClient (){
-        passwordCallBack = new PasswordCallBackImpl(getCurrentUser(), getPassword());
-        ExperimentResourceClient experimentResourceClient = new ExperimentResourceClient(getCurrentUser(),
passwordCallBack);
+        ExperimentResourceClient experimentResourceClient = new ExperimentResourceClient(getCurrentUser(),
getCallBack());
         return experimentResourceClient;
     }
 
     public ProvenanceResourceClient getProvenanceResouceClient (){
-        passwordCallBack = new PasswordCallBackImpl(getCurrentUser(), getPassword());
-        ProvenanceResourceClient provenanceResourceClient = new ProvenanceResourceClient(getCurrentUser(),
passwordCallBack);
+        ProvenanceResourceClient provenanceResourceClient = new ProvenanceResourceClient(getCurrentUser(),
getCallBack());
         return provenanceResourceClient;
     }
 
     public ProjectResourceClient getProjectResourceClient (){
-        PasswordCallBackImpl passwordCallBack = new PasswordCallBackImpl(getCurrentUser(),
getPassword());
-        ProjectResourceClient projectResourceClient = new ProjectResourceClient(getCurrentUser(),
passwordCallBack);
+        ProjectResourceClient projectResourceClient = new ProjectResourceClient(getCurrentUser(),
getCallBack());
         return projectResourceClient;
     }
 
     public PublishedWorkflowResourceClient getPublishedWFResourceClient (){
-        passwordCallBack = new PasswordCallBackImpl(getCurrentUser(), getPassword());
-        PublishedWorkflowResourceClient publishedWorkflowResourceClient = new PublishedWorkflowResourceClient(getCurrentUser(),
passwordCallBack);
+        PublishedWorkflowResourceClient publishedWorkflowResourceClient = new PublishedWorkflowResourceClient(getCurrentUser(),
getCallBack());
         return publishedWorkflowResourceClient;
     }
 
     public UserWorkflowResourceClient getUserWFResourceClient () {
-        passwordCallBack = new PasswordCallBackImpl(getCurrentUser(), getPassword());
-        UserWorkflowResourceClient userWorkflowResourceClient = new UserWorkflowResourceClient(getCurrentUser(),
passwordCallBack);
+        UserWorkflowResourceClient userWorkflowResourceClient = new UserWorkflowResourceClient(getCurrentUser(),
getCallBack());
         return userWorkflowResourceClient;
     }
 
     public BasicRegistryResourceClient getBasicResourceClient (){
-        passwordCallBack = new PasswordCallBackImpl(getCurrentUser(), getPassword());
-        BasicRegistryResourceClient basicRegistryResourceClient = new BasicRegistryResourceClient(getCurrentUser(),
passwordCallBack);
+        BasicRegistryResourceClient basicRegistryResourceClient = new BasicRegistryResourceClient(getCurrentUser(),
getCallBack());
         return basicRegistryResourceClient;
     }
 
@@ -1037,4 +1030,12 @@ public class AiravataClient implements A
     public URI getRegitryURI() {
         return regitryURI;
     }
+
+    public Callback getCallBack() {
+        return callBack;
+    }
+
+    public void setCallBack(Callback callBack) {
+        this.callBack = callBack;
+    }
 }

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=1411407&r1=1411406&r2=1411407&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
Mon Nov 19 20:58:50 2012
@@ -30,12 +30,22 @@ import javax.jcr.RepositoryException;
 
 import org.apache.airavata.client.api.AiravataAPI;
 import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.rest.utils.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, Callback callback)
throws MalformedURLException, RepositoryException, RegistryException{
+        AiravataClient apiObj = new AiravataClient();
+        apiObj.setCurrentUser(username);
+        apiObj.setCallBack(callback);
+        apiObj.setPassword(callback.getPassword(username));
+        apiObj.setRegitryURI(registryURL);
+        return apiObj;
+    }
+
 	public static AiravataAPI getAPI(URI registryURL, String username, String password, String
alternateUsername) throws MalformedURLException, RepositoryException, RegistryException{
 		AiravataClient apiObj = new AiravataClient();
 		apiObj.setCurrentUser(alternateUsername);



Mime
View raw message