Author: chathuri
Date: Thu Nov 29 16:15:04 2012
New Revision: 1415239

URL: http://svn.apache.org/viewvc?rev=1415239&view=rev
Log:
fixing xbaya issues

Removed:
    
airavata/trunk/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/PasswordCallBackImpl.java
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/api/AiravataManager.java
    
airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/AiravataManagerImpl.java
    airavata/trunk/modules/distribution/src/main/assembly/bin-assembly.xml
    
airavata/trunk/modules/distribution/src/main/resources/conf/airavata-server.properties
    
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java
    
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
    airavata/trunk/modules/security/src/test/resources/testdb/test.h2.db
    
airavata/trunk/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java
    airavata/trunk/modules/xbaya-gui/pom.xml
    
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java
    
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java
    
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConstants.java
    
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java
    
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpretorSkeleton.java
    
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/JCRRegistryWindow.java
    airavata/trunk/modules/xbaya-gui/src/main/resources/registry.properties

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=1415239&r1=1415238&r2=1415239&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 Nov 29 16:15:04 2012
@@ -262,9 +262,9 @@ public class AiravataClient implements A
                        clientConfiguration.setMessagebrokerURL(new 
URL(configuration
                                        .get(BROKER)));
                }
-                if (configuration.containsKey(REGISTRY)) {
-                        clientConfiguration.setRegistryURL(new 
URL(configuration.get(REGISTRY)));
-                }
+//             if (configuration.containsKey(REGISTRY)) {
+//                      clientConfiguration.setRegistryURL(new 
URL(configuration.get(REGISTRY)));
+//             }
                if (configuration.get(WORKFLOWSERVICEURL) != null) {
                        clientConfiguration.setXbayaServiceURL(new 
URL(configuration
                                        .get(WORKFLOWSERVICEURL)));
@@ -496,6 +496,9 @@ public class AiravataClient implements A
                        final String experimentName,
                        final WorkflowContextHeaderBuilder builder, boolean 
launchOnThread)
                        throws AiravataAPIInvocationException, 
AiravataConfigurationException {
+
+        //TODO - fix user passing
+        builder.setUserIdentifier(getCurrentUser());
                try {
                        runPreWorkflowExecutionTasks(topic, user, metadata, 
experimentName);
                } catch (RegistryException e) {

Modified: 
airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/AiravataManager.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/AiravataManager.java?rev=1415239&r1=1415238&r2=1415239&view=diff
==============================================================================
--- 
airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/AiravataManager.java
 (original)
+++ 
airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/AiravataManager.java
 Thu Nov 29 16:15:04 2012
@@ -127,6 +127,7 @@ public interface AiravataManager {
      * @return url or null if url is not defined
      * @throws AiravataAPIInvocationException
      */
+    @Deprecated
        public URI getRegistryURL() throws AiravataAPIInvocationException;
 
     /**

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=1415239&r1=1415238&r2=1415239&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
 Thu Nov 29 16:15:04 2012
@@ -183,6 +183,7 @@ public class AiravataManagerImpl impleme
        }
 
        @Override
+    @Deprecated
        public URI getRegistryURL(URI defaultURL)
                        throws AiravataAPIInvocationException {
                if (getRegistryURL()==null){

Modified: airavata/trunk/modules/distribution/src/main/assembly/bin-assembly.xml
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/distribution/src/main/assembly/bin-assembly.xml?rev=1415239&r1=1415238&r2=1415239&view=diff
==============================================================================
--- airavata/trunk/modules/distribution/src/main/assembly/bin-assembly.xml 
(original)
+++ airavata/trunk/modules/distribution/src/main/assembly/bin-assembly.xml Thu 
Nov 29 16:15:04 2012
@@ -245,6 +245,7 @@
                 <include>org.apache.airavata:airavata-rest-client:jar</include>
                                
<include>org.apache.openjpa:openjpa-all:jar</include>
                 <include>com.sun.jersey:jersey-client:jar</include>
+                <include>com.sun.jersey:jersey-core:jar</include>
                                <include>edu.berkeley:yfilter</include>
                                <include>edu.berkeley:yfilter</include>
                                <include>javax.servlet:servlet-api</include>

Modified: 
airavata/trunk/modules/distribution/src/main/resources/conf/airavata-server.properties
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/distribution/src/main/resources/conf/airavata-server.properties?rev=1415239&r1=1415238&r2=1415239&view=diff
==============================================================================
--- 
airavata/trunk/modules/distribution/src/main/resources/conf/airavata-server.properties
 (original)
+++ 
airavata/trunk/modules/distribution/src/main/resources/conf/airavata-server.properties
 Thu Nov 29 16:15:04 2012
@@ -51,6 +51,10 @@ port=8080
 #registry.jdbc.password=airavata
 #start.derby.server.mode=true
 
+system.gateway=default
+system.user=admin
+system.password=admin
+
 #for mysql
 #registry.jdbc.driver=com.mysql.jdbc.Driver
 #registry.jdbc.url=jdbc:mysql://localhost:3306/persistent_data

Modified: 
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java?rev=1415239&r1=1415238&r2=1415239&view=diff
==============================================================================
--- 
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java
 (original)
+++ 
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ConfigurationResource.java
 Thu Nov 29 16:15:04 2012
@@ -43,16 +43,13 @@ public class ConfigurationResource exten
     private String configVal;
     private Timestamp expireDate;
 
-    /**
-     *
-     */
     public ConfigurationResource() {
     }
 
     /**
      *
-     * @param configKey
-     * @param configVal
+     * @param configKey configuration key
+     * @param configVal configuration value
      */
     public ConfigurationResource(String configKey, String configVal) {
         this.configKey = configKey;
@@ -67,7 +64,8 @@ public class ConfigurationResource exten
      */
     public Resource create(ResourceType type) {
         logger.error("Unsupported operation for configuration resource " +
-                "since there are no child resources generated by configuration 
resource.. ", new UnsupportedOperationException());
+                "since there are no child resources generated by configuration 
resource.. ",
+                new UnsupportedOperationException());
         throw new UnsupportedOperationException();
     }
 
@@ -80,7 +78,8 @@ public class ConfigurationResource exten
      */
     public void remove(ResourceType type, Object name) {
         logger.error("Unsupported operation for configuration resource " +
-                "since there are no child resources generated by configuration 
resource.. ", new UnsupportedOperationException());
+                "since there are no child resources generated by configuration 
resource.. ",
+                new UnsupportedOperationException());
         throw new UnsupportedOperationException();
     }
 
@@ -94,7 +93,8 @@ public class ConfigurationResource exten
      */
     public Resource get(ResourceType type, Object name) {
         logger.error("Unsupported operation for configuration resource " +
-                "since there are no child resources generated by configuration 
resource.. ", new UnsupportedOperationException());
+                "since there are no child resources generated by configuration 
resource.. ",
+                new UnsupportedOperationException());
         throw new UnsupportedOperationException();
     }
 
@@ -134,7 +134,8 @@ public class ConfigurationResource exten
      */
     public List<Resource> get(ResourceType type) {
         logger.error("Unsupported operation for configuration resource " +
-                "since there are no child resources generated by configuration 
resource.. ", new UnsupportedOperationException());
+                "since there are no child resources generated by configuration 
resource.. ",
+                new UnsupportedOperationException());
         throw new UnsupportedOperationException();
     }
 
@@ -188,7 +189,8 @@ public class ConfigurationResource exten
      */
     public boolean isExists(ResourceType type, Object name) {
         logger.error("Unsupported operation for configuration resource " +
-                "since there are no child resources generated by configuration 
resource.. ", new UnsupportedOperationException());
+                "since there are no child resources generated by configuration 
resource.. ",
+                new UnsupportedOperationException());
         throw new UnsupportedOperationException();
     }
 

Modified: 
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java?rev=1415239&r1=1415238&r2=1415239&view=diff
==============================================================================
--- 
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
 (original)
+++ 
airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ProjectResource.java
 Thu Nov 29 16:15:04 2012
@@ -111,8 +111,6 @@ public class ProjectResource extends Abs
             EntityManager em = ResourceUtils.getEntityManager();
             em.getTransaction().begin();
                QueryGenerator generator = new QueryGenerator(EXPERIMENT);
-//             generator.setParameter(ExperimentConstants.PROJECT_NAME, name);
-//             generator.setParameter(ExperimentConstants.USERNAME, 
getWorker().getUser());
                generator.setParameter(ExperimentConstants.EXPERIMENT_ID, name);
                Query q = generator.selectQuery(em);
             Experiment experiment = (Experiment) q.getSingleResult();

Modified: airavata/trunk/modules/security/src/test/resources/testdb/test.h2.db
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/security/src/test/resources/testdb/test.h2.db?rev=1415239&r1=1415238&r2=1415239&view=diff
==============================================================================
Binary files - no diff available.

Modified: 
airavata/trunk/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java?rev=1415239&r1=1415238&r2=1415239&view=diff
==============================================================================
--- 
airavata/trunk/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java
 (original)
+++ 
airavata/trunk/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java
 Thu Nov 29 16:15:04 2012
@@ -36,6 +36,7 @@ import org.apache.airavata.client.api.Ai
 import org.apache.airavata.commons.gfac.type.ServiceDescription;
 import org.apache.airavata.registry.api.AiravataRegistryConnectionDataProvider;
 import org.apache.airavata.registry.api.AiravataRegistryFactory;
+import org.apache.airavata.registry.api.PasswordCallback;
 import org.apache.airavata.registry.api.exception.RegistryException;
 import org.apache.airavata.registry.api.util.RegistryConstants;
 import org.apache.airavata.registry.api.util.WebServiceUtil;
@@ -52,6 +53,10 @@ public class JCRComponentRegistry extend
 
     private AiravataAPI airavataAPI;
 
+    public JCRComponentRegistry(AiravataAPI airavataAPI) {
+        this.airavataAPI = airavataAPI;
+    }
+
     public JCRComponentRegistry(String username, String password) throws 
RegistryException {
         String gatewayName=null;
         String registryURL = null;
@@ -95,8 +100,8 @@ public class JCRComponentRegistry extend
         try {
             URI baseUri = new URI(registryURL);
             //TODO callback class
-            PasswordCallBackImpl passwordCallBack = new 
PasswordCallBackImpl(username, password);
-            this.airavataAPI = AiravataAPIFactory.getAPI(baseUri, gatewayName, 
username, passwordCallBack);
+//            PasswordCallBackImpl passwordCallBack = new 
PasswordCallBackImpl(username, password);
+            this.airavataAPI = AiravataAPIFactory.getAPI(baseUri, gatewayName, 
username, (PasswordCallback)null);
         }  catch (URISyntaxException e) {
             log.error("Error initializing Airavata Client");
         } catch (AiravataAPIInvocationException e) {

Modified: airavata/trunk/modules/xbaya-gui/pom.xml
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/pom.xml?rev=1415239&r1=1415238&r2=1415239&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/pom.xml (original)
+++ airavata/trunk/modules/xbaya-gui/pom.xml Thu Nov 29 16:15:04 2012
@@ -339,6 +339,16 @@
             <artifactId>airavata-jpa-registry</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-registry-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-rest-client</artifactId>
+            <version>${project.version}</version>
+        </dependency>
 
         <!-- JCR Support -->
         <!-- TODO need clean up -->

Modified: 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java?rev=1415239&r1=1415238&r2=1415239&view=diff
==============================================================================
--- 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java
 (original)
+++ 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java
 Thu Nov 29 16:15:04 2012
@@ -275,7 +275,7 @@ public class XBaya {
                     logger.error(message);
                     this.config.addError(new WorkflowException(message));
                 }
-                this.config.setJcrComponentRegistry(new 
JCRComponentRegistry(this.config.getRegistryUserName(),this.config.getRegistryPassphrase()));
+                this.config.setJcrComponentRegistry(new 
JCRComponentRegistry(this.config.getAiravataAPI()));
                 index++;
             }
         } catch (ArrayIndexOutOfBoundsException e) {

Modified: 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java?rev=1415239&r1=1415238&r2=1415239&view=diff
==============================================================================
--- 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java
 (original)
+++ 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java
 Thu Nov 29 16:15:04 2012
@@ -84,6 +84,8 @@ public class XBayaConfiguration extends 
 
     private String registryPassphrase = XBayaConstants.REGISTRY_PASSPHRASE;
 
+    private String defaultGateway = XBayaConstants.DEFAULT_GATEWAY;
+
     private URI dscURL = XBayaConstants.DEFAULT_DSC_URL;
 
     // Monitor related
@@ -900,7 +902,15 @@ public class XBayaConfiguration extends 
         this.airavataAPI = airavataAPI;
     }
 
-//    public AiravataAPI setAiravataAPI() {
+    public String getDefaultGateway() {
+        return defaultGateway;
+    }
+
+    public void setDefaultGateway(String defaultGateway) {
+        this.defaultGateway = defaultGateway;
+    }
+
+    //    public AiravataAPI setAiravataAPI() {
 //        try{
 //            URI baseUri = new URI(ResourcePathConstants.BASE_URL);
 //            PasswordCallbackImpl passwordCallback = new 
PasswordCallbackImpl(getRegistryUserName(), getRegistryPassphrase());

Modified: 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConstants.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConstants.java?rev=1415239&r1=1415238&r2=1415239&view=diff
==============================================================================
--- 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConstants.java
 (original)
+++ 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConstants.java
 Thu Nov 29 16:15:04 2012
@@ -181,7 +181,8 @@ public class XBayaConstants {
     public static final String STREAM_SERVER = 
"http://pagodatree.cs.indiana.edu:8081/axis2/services/StreamService?wsdl";;
 
     public static final String STATIC_LABEL = "STATIC";
-    public static final URI REGISTRY_URL = 
URI.create("http://localhost:8081/rmi";);
+    public static final URI REGISTRY_URL = 
URI.create("http://localhost:9080/airavata-services/api";);
+    public static final String DEFAULT_GATEWAY = "default";
     public static final String REGISTRY_USERNAME = "admin";
     public static final String REGISTRY_PASSPHRASE = "admin";
     public static final String REGISTRY_TYPE_HOST_DESC = "HostDesc";

Modified: 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java?rev=1415239&r1=1415238&r2=1415239&view=diff
==============================================================================
--- 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java
 (original)
+++ 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java
 Thu Nov 29 16:15:04 2012
@@ -67,6 +67,8 @@ public class XBayaEngine {
 
     private WorkflowInterpreter workflowInterpreter;
 
+    private AiravataAPI airavataAPI;
+
     /**
      * Constructs a ApplicationClient.
      *
@@ -271,4 +273,11 @@ public class XBayaEngine {
                }
        }
 
- }
\ No newline at end of file
+    public AiravataAPI getAiravataAPI() {
+        return airavataAPI;
+    }
+
+    public void setAiravataAPI(AiravataAPI airavataAPI) {
+        this.airavataAPI = airavataAPI;
+    }
+}
\ No newline at end of file

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=1415239&r1=1415238&r2=1415239&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 Nov 29 16:15:04 2012
@@ -25,6 +25,7 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.IOException;
+import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
@@ -35,11 +36,13 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
+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.AiravataAPIInvocationException;
 import org.apache.airavata.client.tools.PeriodicExecutorThread;
@@ -93,11 +96,16 @@ public class WorkflowInterpretorSkeleton
     public static final String TRUSTED_CERT_LOCATION = "trusted.cert.location";
     public static final String JCR_USER = "jcr.username";
     public static final String JCR_PASS = "jcr.password";
+    public static final String SYSTEM_USER = "system.user";
+    public static final String SYSTEM_PASS = "system.password";
+    public static final String SYSTEM_GATEWAY = "system.gateway";
+    public static final String DEFAULT_GATEWAY = "gateway.id";
+
     public static final String JCR_URL = "jcr.url";
     public static boolean provenance = false;
     public static final String PROVENANCE = "provenance";
-    public static  String jcrUserName = "";
-    public static  String jcrPassword = "";
+    public static  String systemUserName = "";
+    public static  String systemUserPW = "";
     public static  String jcrURL = "";
     public static boolean runInThread = false;
     public static final String RUN_IN_THREAD = "runInThread";
@@ -112,6 +120,7 @@ public class WorkflowInterpretorSkeleton
     public static final String OUTPUT_DATA_PATH = "outputDataPath";
     public static final String SERVICE_NAME="WorkflowInterpretor";
     public static boolean notInterrupted = true;
+    private String gateway;
 
        protected static final String SERVICE_URL = "interpreter_service_url";
 
@@ -122,12 +131,14 @@ public class WorkflowInterpretorSkeleton
     private AiravataAPI getRegistry(){
         Properties properties = new Properties();
         try {
+
             URL url = getXBayaPropertiesURL();
             properties.load(url.openStream());
-            jcrUserName = (String)properties.get(JCR_USER);
-            jcrPassword = (String) properties.get(JCR_PASS);
+            systemUserName = (String)properties.get(SYSTEM_USER);
+            systemUserPW = (String) properties.get(SYSTEM_PASS);
             jcrURL = (String) properties.get(JCR_URL);
-            jcrComponentRegistry = new 
JCRComponentRegistry(jcrUserName,jcrPassword);
+            gateway = properties.getProperty(DEFAULT_GATEWAY);
+            jcrComponentRegistry = new JCRComponentRegistry(systemUserName, 
systemUserPW);
             return jcrComponentRegistry.getAiravataAPI();
         } catch (RegistryException e) {
             e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
@@ -153,6 +164,7 @@ public class WorkflowInterpretorSkeleton
                        URL url = getXBayaPropertiesURL();
                        Properties properties = new Properties();
                        try {
+
                            properties.load(url.openStream());
                     // Airavata deployer have to configure these 
properties,but if user send them alone the incoming message
                     // We are overwriting those values only for that 
particular request
@@ -161,19 +173,19 @@ public class WorkflowInterpretorSkeleton
                            
configctx.setProperty(MYPROXY_LIFETIME,properties.getProperty(MYPROXY_LIFETIME));
                     
configctx.setProperty(TRUSTED_CERT_LOCATION,properties.getProperty(TRUSTED_CERT_LOCATION));
                     
configctx.setProperty(MYPROXY_SERVER,properties.getProperty(MYPROXY_SERVER));
-                           jcrUserName = (String)properties.get(JCR_USER);
-                           jcrPassword = (String) properties.get(JCR_PASS);
-                           jcrURL = (String) properties.get(JCR_URL);
+//                         systemUserName = (String)properties.get(JCR_USER);
+//                         systemUserPW = (String) properties.get(JCR_PASS);
+//                         jcrURL = (String) properties.get(JCR_URL);
                            provenanceWriterThreadPoolSize = 
Integer.parseInt((String) properties.get(PROVENANCE_WRITER_THREAD_POOL_SIZE));
                            if("true".equals(properties.get(PROVENANCE))){
                                provenance = true;
                                runner = new 
PredicatedTaskRunner(provenanceWriterThreadPoolSize);
                                try {
-                                   jcrComponentRegistry = new 
JCRComponentRegistry(jcrUserName,jcrPassword);
+//                                 jcrComponentRegistry = new 
JCRComponentRegistry(systemUserName,systemUserPW);
                             List<HostDescription> hostList = 
getDefinedHostDescriptions();
                             for(HostDescription host:hostList){
                                 // This will avoid the changes user is doing 
to one of the predefined Hosts during a restart of the system
-                                AiravataAPI registry = 
jcrComponentRegistry.getAiravataAPI();
+                                AiravataAPI registry = getRegistry();
                                                                
if(!registry.getApplicationManager().isHostDescriptorExists(host.getType().getHostName())){
                                     log.info("Saving the predefined Host: " + 
host.getType().getHostName());
                                     
registry.getApplicationManager().saveHostDescription(host);
@@ -181,9 +193,7 @@ public class WorkflowInterpretorSkeleton
                             }
                                } catch (AiravataAPIInvocationException e) {
                                    e.printStackTrace();
-                               } catch (RegistryException e) {
-                            e.printStackTrace();
-                        }
+                               }
                     }else{
                                provenance = false;
                            }
@@ -203,7 +213,7 @@ public class WorkflowInterpretorSkeleton
                     String localAddress = 
ServiceUtils.generateServiceURLFromConfigurationContext(configctx,SERVICE_NAME);
                                        log.info("INTERPRETER_SERVICE_ADDRESS:" 
+ localAddress);
                                        configctx.setProperty(SERVICE_URL,new 
URI(localAddress));
-                                       
configctx.setProperty(JCR_REG,jcrComponentRegistry.getAiravataAPI());
+                                       
configctx.setProperty(JCR_REG,getRegistry());
                                        /*
                                         * Heart beat message to registry
                                         */
@@ -250,12 +260,22 @@ public class WorkflowInterpretorSkeleton
         }
         Map<String, String> configuration = new HashMap<String, String>();
         WorkflowContextHeaderBuilder workflowContextHeaderBuilder = 
parseContextHeader(workflowContext, configuration);
+        String user = workflowContextHeaderBuilder.getUserIdentifier();
+
         String s = null;
         try {
              s = setupAndLaunch(workflowAsString, topic,
-                    (String) configurationContext.getProperty(MYPROXY_USER), 
(String) configurationContext.getProperty(MYPROXY_PASS), inputs, configuration, 
runInThread, workflowContextHeaderBuilder);
+                    user,inputs, configuration, runInThread, 
workflowContextHeaderBuilder);
         } catch (XMLStreamException e) {
             e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
+        } catch (RepositoryException e) {
+            e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
+        } catch (MalformedURLException e) {
+            e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
+        } catch (RegistryException e) {
+            e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
         }
         return s;
     }
@@ -298,8 +318,8 @@ public class WorkflowInterpretorSkeleton
         return new WorkflowContextHeaderBuilder(parse.getContextHeader());
     }
 
-    private String setupAndLaunch(String workflowAsString, String topic, 
String password, String username,
-                                  NameValue[] 
inputs,Map<String,String>configurations,boolean 
inNewThread,WorkflowContextHeaderBuilder builder) throws XMLStreamException {
+    private String setupAndLaunch(String workflowAsString, String topic, 
String username,
+                                  NameValue[] 
inputs,Map<String,String>configurations,boolean 
inNewThread,WorkflowContextHeaderBuilder builder) throws XMLStreamException, 
MalformedURLException, RepositoryException, RegistryException, 
AiravataAPIInvocationException {
         System.err.println("Launch is called for topi:");
 
         Workflow workflow = null;
@@ -337,8 +357,8 @@ public class WorkflowInterpretorSkeleton
         }
         WorkflowInterpretorEventListener listener = null;
         WorkflowInterpreter interpreter = null;
-        AiravataAPI registry = getRegistry();
-               WorkflowInterpreterConfiguration 
workflowInterpreterConfiguration = new 
WorkflowInterpreterConfiguration(workflow,topic,conf.getMessageBoxURL(), 
conf.getBrokerURL(), registry, conf, null, null);
+        AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(gateway, username);
+               WorkflowInterpreterConfiguration 
workflowInterpreterConfiguration = new 
WorkflowInterpreterConfiguration(workflow,topic,conf.getMessageBoxURL(), 
conf.getBrokerURL(), airavataAPI, conf, null, null);
         workflowInterpreterConfiguration.setGfacEmbeddedMode(gfacEmbeddedMode);
         workflowInterpreterConfiguration.setActOnProvenance(provenance);
         // WorkflowInterpreter object should create prior creation of 
Listener, because listener needs the threadlocal variable

Modified: 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/JCRRegistryWindow.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/JCRRegistryWindow.java?rev=1415239&r1=1415238&r2=1415239&view=diff
==============================================================================
--- 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/JCRRegistryWindow.java
 (original)
+++ 
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/JCRRegistryWindow.java
 Thu Nov 29 16:15:04 2012
@@ -26,17 +26,25 @@ import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.security.KeyStore;
 
+import javax.jcr.RepositoryException;
 import javax.swing.AbstractAction;
 import javax.swing.BorderFactory;
 import javax.swing.JButton;
 import javax.swing.JLabel;
 import javax.swing.JPasswordField;
 
+import org.apache.airavata.client.AiravataAPIFactory;
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.AiravataAPIInvocationException;
+import org.apache.airavata.registry.api.PasswordCallback;
+import org.apache.airavata.registry.api.exception.RegistryException;
 import 
org.apache.airavata.workflow.model.component.registry.JCRComponentRegistry;
 import org.apache.airavata.xbaya.XBayaConfiguration;
 import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.component.registry.ComponentRegistryLoader;
+import org.apache.airavata.xbaya.registry.PasswordCallbackImpl;
 import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
 import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
 import org.apache.airavata.xbaya.ui.widgets.GridPanel;
@@ -53,6 +61,8 @@ public class JCRRegistryWindow {
 
     private XBayaTextField urlTextField;
 
+    private XBayaTextField gatewayTextField;
+
     private XBayaTextField usernameTextField;
 
     private JPasswordField passwordTextField;
@@ -61,6 +71,14 @@ public class JCRRegistryWindow {
 
     private NewJCRRegistryUserDialog newUserWindow;
 
+    private String userName;
+
+    private String password;
+
+    private String regURL;
+
+    private String gateway;
+
     /**
      * @param engine
      */
@@ -82,36 +100,40 @@ public class JCRRegistryWindow {
     }
 
     private void ok() {
-        String urlString = this.urlTextField.getText();
-        String username = this.usernameTextField.getText();
-        String password = new String(this.passwordTextField.getPassword());
+        setRegURL(this.urlTextField.getText());
+        setUserName(this.usernameTextField.getText());
+        setPassword(new String(this.passwordTextField.getPassword()));
+        setGateway(this.gatewayTextField.getText());
 
-        if (urlString.length() == 0) {
+        if (getRegURL().length() == 0) {
             
this.engine.getGUI().getErrorWindow().error(ErrorMessages.URL_EMPTY);
             return;
         }
         URI url;
         try {
-            url = new URI(urlString);
+            url = new URI(regURL);
         } catch (URISyntaxException e) {
             
this.engine.getGUI().getErrorWindow().error(ErrorMessages.URL_WRONG, e);
             return;
         }
+
+        AiravataAPI airavataAPI = getAiravataAPI();
+
         JCRComponentRegistry registry = null;
         try {
-            registry = new JCRComponentRegistry(username, password);
+            registry = new JCRComponentRegistry(airavataAPI);
         } catch (Exception e) {
             this.engine.getGUI().getErrorWindow().error(e.getMessage());
             return;
         }
         XBayaConfiguration configuration = this.engine.getConfiguration();
-
-
+        this.engine.setAiravataAPI(airavataAPI);
         configuration.setJcrComponentRegistry(registry);
-        configuration.setRegigstryUserName(username);
+        configuration.setRegigstryUserName(userName);
         configuration.setRegistryPassphrase(password);
         configuration.setRegistryURL(url);
-        configuration.setAiravataAPI(registry.getAiravataAPI());
+        configuration.setAiravataAPI(airavataAPI);
+        configuration.setDefaultGateway(gateway);
         engine.updateXBayaConfigurationServiceURLs();
         hide();
 
@@ -144,12 +166,15 @@ public class JCRRegistryWindow {
      */
     private void initGUI() {
         this.urlTextField = new XBayaTextField();
+        this.gatewayTextField = new XBayaTextField();
         this.usernameTextField = new XBayaTextField();
         this.passwordTextField = new JPasswordField();
         
this.urlTextField.setText(engine.getConfiguration().getRegistryURL().toASCIIString());
+        
this.gatewayTextField.setText(engine.getConfiguration().getDefaultGateway());
         
this.usernameTextField.setText(engine.getConfiguration().getRegistryUserName());
         
this.passwordTextField.setText(engine.getConfiguration().getRegistryPassphrase());
         XBayaLabel urlLabel = new XBayaLabel("URL", this.urlTextField);
+        XBayaLabel gatewayLabel = new XBayaLabel("Gateway", 
this.gatewayTextField);
         XBayaLabel nameLabel = new XBayaLabel("Username", 
this.usernameTextField);
         XBayaLabel passLabel = new XBayaLabel("Password", 
this.usernameTextField);
         this.newUserButton = new XBayaLinkButton("Create new user...");
@@ -163,15 +188,17 @@ public class JCRRegistryWindow {
         });
 
         GridPanel infoPanel = new GridPanel();
-//        infoPanel.add(urlLabel);
-//        infoPanel.add(this.urlTextField);
+        infoPanel.add(urlLabel);
+        infoPanel.add(this.urlTextField);
+        infoPanel.add(gatewayLabel);
+        infoPanel.add(this.gatewayTextField);
         infoPanel.add(nameLabel);
         infoPanel.add(this.usernameTextField);
         infoPanel.add(passLabel);
         infoPanel.add(this.passwordTextField);
         infoPanel.add(emptyLabel);
         infoPanel.add(this.newUserButton);
-        infoPanel.layout(3, 2, GridPanel.WEIGHT_NONE, 1);
+        infoPanel.layout(5, 2, GridPanel.WEIGHT_NONE, 1);
 //        infoPanel.layout(2, 2, GridPanel.WEIGHT_NONE, 1);
 
         
infoPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
@@ -198,4 +225,51 @@ public class JCRRegistryWindow {
         this.dialog = new XBayaDialog(this.engine.getGUI(), "Airavata 
Registry", infoPanel, buttonPanel);
         this.dialog.setDefaultButton(okButton);
     }
+
+    public AiravataAPI getAiravataAPI(){
+        try {
+            URI regURI = new URI(getRegURL());
+            PasswordCallbackImpl passwordCallback = new 
PasswordCallbackImpl(userName, password);
+            AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(regURI, 
getGateway(), userName, passwordCallback);
+            return airavataAPI;
+        } catch (URISyntaxException e) {
+            e.printStackTrace();
+        }catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
+        }
+        return null;
+
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public String getRegURL() {
+        return regURL;
+    }
+
+    public void setRegURL(String regURL) {
+        this.regURL = regURL;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getGateway() {
+        return gateway;
+    }
+
+    public void setGateway(String gateway) {
+        this.gateway = gateway;
+    }
 }
\ No newline at end of file

Modified: 
airavata/trunk/modules/xbaya-gui/src/main/resources/registry.properties
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/resources/registry.properties?rev=1415239&r1=1415238&r2=1415239&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/resources/registry.properties 
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/resources/registry.properties Thu 
Nov 29 16:15:04 2012
@@ -29,7 +29,7 @@
 
 ###---------------------------REGISTRY API 
IMPLEMENTATION---------------------------###
 
-class.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+class.registry.accessor=org.apache.airavata.rest.client.RegistryClient
 #class.registry.accessor=org.apache.airavata.rest.client.RegistryClient
 
 ###---------------------REGISTRY API IMPLEMENTATION - CUSTOM 
SETTINGS----------------------###


Reply via email to