airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r1484824 - in /airavata/trunk/modules: commons/utils/src/main/java/org/apache/airavata/common/utils/ credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/ xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/
Date Tue, 21 May 2013 14:49:26 GMT
Author: amilaj
Date: Tue May 21 14:49:26 2013
New Revision: 1484824

URL: http://svn.apache.org/r1484824
Log:
Fixing some db transaction issues, Fixing an incorrect way of initializing credential management
service in gfac invoker

Modified:
    airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DBUtil.java
    airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DatabaseTestCases.java
    airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java

Modified: airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DBUtil.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DBUtil.java?rev=1484824&r1=1484823&r2=1484824&view=diff
==============================================================================
--- airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DBUtil.java
(original)
+++ airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DBUtil.java
Tue May 21 14:49:26 2013
@@ -206,7 +206,9 @@ public class DBUtil {
      *             If an error occurred while creating the connection.
      */
     public Connection getConnection() throws SQLException {
-        return DriverManager.getConnection(jdbcUrl, properties);
+        Connection connection = DriverManager.getConnection(jdbcUrl, properties);
+        connection.setAutoCommit(false);
+        return connection;
     }
 
     /**

Modified: airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DatabaseTestCases.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DatabaseTestCases.java?rev=1484824&r1=1484823&r2=1484824&view=diff
==============================================================================
--- airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DatabaseTestCases.java
(original)
+++ airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/DatabaseTestCases.java
Tue May 21 14:49:26 2013
@@ -114,7 +114,9 @@ public class DatabaseTestCases {
     public Connection getConnection() throws Exception {
 
         DBUtil dbUtil =  getDbUtil ();
-        return dbUtil.getConnection();
+        Connection connection = dbUtil.getConnection();
+        connection.setAutoCommit(true);
+        return connection;
 
     }
 

Modified: airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java?rev=1484824&r1=1484823&r2=1484824&view=diff
==============================================================================
--- airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
(original)
+++ airavata/trunk/modules/credential-store/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
Tue May 21 14:49:26 2013
@@ -86,7 +86,7 @@ public class CredentialsDAOTest extends 
         credentialsDAO = new CredentialsDAO();
 
         // Cleanup tables;
-        Connection connection = getDbUtil().getConnection();
+        Connection connection = getConnection();
 
         try {
             DBUtil.truncate("credentials", connection);

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java?rev=1484824&r1=1484823&r2=1484824&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
Tue May 21 14:49:26 2013
@@ -308,7 +308,8 @@ public class EmbeddedGFacInvoker impleme
             JobExecutionContext jobExecutionContext = new JobExecutionContext(gFacConfiguration,
serviceName);
             //Here we get only the contextheader information sent specific for this node
             //Add security context
-            addSecurityContext(registeredHost,configurationProperties,jobExecutionContext);
+            addSecurityContext(registeredHost,configurationProperties,jobExecutionContext,
+                    configuration.getContextHeader());
 
             jobExecutionContext.setContextHeader(WorkflowContextHeaderBuilder.removeOtherSchedulingConfig(nodeID,configuration.getContextHeader()));
 
@@ -378,36 +379,43 @@ public class EmbeddedGFacInvoker impleme
     }
 
     private SecurityContextDocument.SecurityContext.CredentialManagementService getCredentialManagementService(
-            JobExecutionContext jobExecutionContext) {
+            ContextHeaderDocument.ContextHeader contextHeader) {
 
-        if (jobExecutionContext.getContextHeader() != null) {
+        if (contextHeader != null) {
 
             SecurityContextDocument.SecurityContext.CredentialManagementService credentialManagementService
-                    = jobExecutionContext.getContextHeader().getSecurityContext().getCredentialManagementService();
+                    = contextHeader.getSecurityContext().getCredentialManagementService();
 
-           if (credentialManagementService != null) {
-               return credentialManagementService;
-           }
+            if (credentialManagementService != null) {
+                // Make sure token id and portal user id is properly populated
+                if (credentialManagementService.getTokenId() != null &&
+                        credentialManagementService.getPortalUser() != null) {
+
+                    return credentialManagementService;
+                } else {
+                    return null;
+                }
+            } else {
+                return null;
+            }
         }
 
         return null;
     }
 
 	private void addSecurityContext(HostDescription registeredHost, Properties configurationProperties,
-			JobExecutionContext jobExecutionContext) {
+			JobExecutionContext jobExecutionContext, ContextHeaderDocument.ContextHeader contextHeader)
{
 		if (registeredHost.getType() instanceof GlobusHostType || registeredHost.getType() instanceof
UnicoreHostType) {
 
             SecurityContextDocument.SecurityContext.CredentialManagementService credentialManagementService
-                    = getCredentialManagementService(jobExecutionContext);
+                    = getCredentialManagementService(contextHeader);
 
             GSISecurityContext context;
 
             if (credentialManagementService != null) {
                 String tokenId
-                        = jobExecutionContext.getContextHeader().getSecurityContext().
-                        getCredentialManagementService().getTokenId();
-                String gatewayUser = jobExecutionContext.getContextHeader().getSecurityContext().
-                        getCredentialManagementService().getPortalUser();
+                        = credentialManagementService.getTokenId();
+                String gatewayUser = credentialManagementService.getPortalUser();
 
                 String gatewayId = jobExecutionContext.getGFacConfiguration().getAiravataAPI().getGateway();
 



Mime
View raw message