airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject [24/50] [abbrv] airavata git commit: continuation of authentication mode implementation
Date Thu, 19 Mar 2015 19:11:42 GMT
continuation of authentication mode implementation

Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/7ef88004
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/7ef88004
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/7ef88004

Branch: refs/heads/new-workflow-design
Commit: 7ef880044a2916adabe4f33d47e6349367a3a84c
Parents: 7883eb9
Author: msmemon <shahbaz.memon@gmail.com>
Authored: Tue Mar 10 17:20:17 2015 +0100
Committer: msmemon <shahbaz.memon@gmail.com>
Committed: Tue Mar 10 17:20:17 2015 +0100

----------------------------------------------------------------------
 .../catalog/data/impl/ComputeResourceImpl.java  |  1 +
 .../data/model/UnicoreJobSubmission.java        | 16 +++++++-
 .../data/resources/AbstractResource.java        |  1 +
 .../resources/UnicoreJobSubmissionResource.java | 39 ++++++++++++++------
 .../catalog/data/util/AppCatalogJPAUtils.java   |  1 +
 .../data/util/AppCatalogThriftConversion.java   |  3 +-
 .../src/main/resources/appcatalog-derby.sql     |  1 +
 .../src/main/resources/appcatalog-mysql.sql     |  1 +
 8 files changed, 50 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/7ef88004/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
index 75b0987..4e6b7ae 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
@@ -209,6 +209,7 @@ public class ComputeResourceImpl implements ComputeResource {
              unicoreJobSubmission.setJobSubmissionInterfaceId(AppCatalogUtils.getID("UNICORE"));
              UnicoreJobSubmissionResource resource = AppCatalogThriftConversion.getUnicoreJobSubmission(unicoreJobSubmission);
              resource.setUnicoreEndpointUrl(unicoreJobSubmission.getUnicoreEndPointURL());
+             resource.setAuthenticationMode(unicoreJobSubmission.getAuthenticationMode().toString());
              if (unicoreJobSubmission.getSecurityProtocol() !=  null){
                  resource.setSecurityProtocol(unicoreJobSubmission.getSecurityProtocol().toString());
              }

http://git-wip-us.apache.org/repos/asf/airavata/blob/7ef88004/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/UnicoreJobSubmission.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/UnicoreJobSubmission.java
b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/UnicoreJobSubmission.java
index d37fda4..626fee4 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/UnicoreJobSubmission.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/UnicoreJobSubmission.java
@@ -37,7 +37,20 @@ public class UnicoreJobSubmission {
 
     @Column(name = "UNICORE_ENDPOINT_URL")
     private String unicoreEndpointUrl;
+    
+    @Column(name = "AUTHENTICATION_MODE")
+    private String authenticationMode;
 
+
+    public String getAuthenticationMode() {
+		return authenticationMode;
+	}
+
+    public void setAuthenticationMode(String authenticationMode) {
+		this.authenticationMode = authenticationMode;
+	}
+
+    
     public String getUnicoreEndpointUrl() {
 		return unicoreEndpointUrl;
 	}
@@ -45,7 +58,8 @@ public class UnicoreJobSubmission {
     public void setUnicoreEndpointUrl(String unicoreEndpointUrl) {
 		this.unicoreEndpointUrl = unicoreEndpointUrl;
 	}
-
+    
+    
 	public String getSubmissionID() {
         return submissionID;
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/7ef88004/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java
b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java
index 5f55069..5b8695a 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java
@@ -125,6 +125,7 @@ public abstract class AbstractResource implements Resource {
         public static final String SUBMISSION_ID = "submissionID";
         public static final String SECURITY_PROTOCAL = "securityProtocol";
         public static final String UNICORE_ENDPOINT_URL = "unicoreEndpointUrl";
+        public static final String AUTHENTICATION_MODE = "authenticationMode";
     }
 
     public final class UnicoreDataMovementConstants {

http://git-wip-us.apache.org/repos/asf/airavata/blob/7ef88004/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/UnicoreJobSubmissionResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/UnicoreJobSubmissionResource.java
b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/UnicoreJobSubmissionResource.java
index a43b300..df401ad 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/UnicoreJobSubmissionResource.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/UnicoreJobSubmissionResource.java
@@ -24,7 +24,6 @@ package org.apache.aiaravata.application.catalog.data.resources;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import javax.persistence.EntityManager;
 import javax.persistence.Query;
@@ -46,8 +45,9 @@ public class UnicoreJobSubmissionResource extends AbstractResource {
 	private String jobSubmissionInterfaceId;
 	private String securityProtocol;
 	private String unicoreEndpointUrl;
+	private String authenticationMode;
 
-	 public void remove(Object identifier) throws AppCatalogException {
+	public void remove(Object identifier) throws AppCatalogException {
 	        EntityManager em = null;
 	        try {
 	            em = AppCatalogJPAUtils.getEntityManager();
@@ -72,21 +72,13 @@ public class UnicoreJobSubmissionResource extends AbstractResource {
 	    }
 
 	 public Resource get(Object identifier) throws AppCatalogException {
-		 // TODO: what? there is no sense to pass string and expect hashmap.. :(
 		 HashMap<String, String> ids;
-//	        if (identifier instanceof Map) {
-//	            ids = (HashMap) identifier;
-//	        } else {
-//	            logger.error("Identifier should be a map with the field name and it's value");
-//	            throw new AppCatalogException("Identifier should be a map with the field name
and it's value");
-//	        }   
 		 EntityManager em = null;
 	        try {
 	            em = AppCatalogJPAUtils.getEntityManager();
 	            em.getTransaction().begin();
 	            AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(UNICORE_JOB_SUBMISSION);
 	            generator.setParameter(UnicoreJobSubmissionConstants.SUBMISSION_ID, identifier);
-//	            generator.setParameter(UnicoreJobSubmissionConstants.UNICORE_ENDPOINT_URL,
ids.get(UnicoreJobSubmissionConstants.UNICORE_ENDPOINT_URL));
 	            Query q = generator.selectQuery(em);
 	            UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission) q.getSingleResult();
 	            UnicoreJobSubmissionResource unicoreSubmissionResource =
@@ -145,7 +137,21 @@ public class UnicoreJobSubmissionResource extends AbstractResource {
 	                        unicoreSubmissionResourceList.add(unicoreJobSubmissionResource);
 	                    }
 	                }
-	            } else {
+	            } else if (fieldName.equals(UnicoreJobSubmissionConstants.AUTHENTICATION_MODE))
{
+	                generator.setParameter(UnicoreJobSubmissionConstants.AUTHENTICATION_MODE,
value);
+	                q = generator.selectQuery(em);
+	                results = q.getResultList();
+	                if (results.size() != 0) {
+	                    for (Object result : results) {
+	                        UnicoreJobSubmission unicoreJobSubmission = (UnicoreJobSubmission)
result;
+	                        UnicoreJobSubmissionResource unicoreJobSubmissionResource =
+	                                (UnicoreJobSubmissionResource) AppCatalogJPAUtils.getResource(
+	                                        AppCatalogResourceType.UNICORE_JOB_SUBMISSION, unicoreJobSubmission);
+	                        unicoreSubmissionResourceList.add(unicoreJobSubmissionResource);
+	                    }
+	                }
+	            }        
+	            else {
 	                em.getTransaction().commit();
 	                em.close();
 	                logger.error("Unsupported field name for Unicore submission resource.",
new IllegalArgumentException());
@@ -264,12 +270,14 @@ public class UnicoreJobSubmissionResource extends AbstractResource {
                 existingUnicoreSubmission.setSubmissionID(jobSubmissionInterfaceId);;
                 existingUnicoreSubmission.setUnicoreEndpointUrl(unicoreEndpointUrl);
                 existingUnicoreSubmission.setSecurityProtocol(securityProtocol);
+                existingUnicoreSubmission.setAuthenticationMode(authenticationMode);
                 em.merge(existingUnicoreSubmission);
             } else {
             	UnicoreJobSubmission unicoreJobSubmission = new UnicoreJobSubmission();
                 unicoreJobSubmission.setSubmissionID(jobSubmissionInterfaceId);
                 unicoreJobSubmission.setUnicoreEndpointUrl(unicoreEndpointUrl);
                 unicoreJobSubmission.setSecurityProtocol(securityProtocol);
+                unicoreJobSubmission.setAuthenticationMode(authenticationMode);
                 em.persist(unicoreJobSubmission);
             }
             em.getTransaction().commit();
@@ -331,6 +339,15 @@ public class UnicoreJobSubmissionResource extends AbstractResource {
 	public void setUnicoreEndpointUrl(String unicoreEndpointUrl) {
 		this.unicoreEndpointUrl = unicoreEndpointUrl;
 	}
+
 	
+     public String getAuthenticationMode() {
+		return authenticationMode;
+	}
+
+	public void setAuthenticationMode(String authenticationMode) {
+		this.authenticationMode = authenticationMode;
+	}
+
 	
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/7ef88004/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java
b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java
index 3a9b6ed..0ee1ad0 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java
@@ -533,6 +533,7 @@ public class AppCatalogJPAUtils {
             submissionResource.setjobSubmissionInterfaceId(o.getSubmissionID());
             submissionResource.setUnicoreEndpointUrl(o.getUnicoreEndpointUrl());
             submissionResource.setSecurityProtocol(o.getSecurityProtocol());
+            submissionResource.setAuthenticationMode(o.getAuthenticationMode());
         }
         return submissionResource;
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/7ef88004/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java
b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java
index 1df6c24..941b844 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java
@@ -237,6 +237,7 @@ public class AppCatalogThriftConversion {
             resource.setSecurityProtocol(submission.getSecurityProtocol().toString());
         }
         resource.setUnicoreEndpointUrl(submission.getUnicoreEndPointURL());
+        resource.setAuthenticationMode(submission.getAuthenticationMode().toString());
         return resource;
     }
 
@@ -337,10 +338,10 @@ public class AppCatalogThriftConversion {
     	UnicoreJobSubmission unicoreJobSubmission = new UnicoreJobSubmission();
     	unicoreJobSubmission.setUnicoreEndPointURL(submission.getUnicoreEndpointUrl());
     	unicoreJobSubmission.setJobSubmissionInterfaceId(submission.getjobSubmissionInterfaceId());
+    	unicoreJobSubmission.setAuthenticationMode(AuthenticationMode.valueOf(submission.getAuthenticationMode()));
         if (submission.getSecurityProtocol() != null){
             unicoreJobSubmission.setSecurityProtocol(SecurityProtocol.valueOf(submission.getSecurityProtocol()));
         }
-
         return unicoreJobSubmission;
     }
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/7ef88004/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql
b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql
index 4e28e04..5396541 100644
--- a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql
+++ b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql
@@ -79,6 +79,7 @@ CREATE TABLE UNICORE_SUBMISSION
          SUBMISSION_ID VARCHAR(255),
          SECURITY_PROTOCAL VARCHAR(255),
          UNICORE_ENDPOINT_URL VARCHAR(255),
+         AUTHENTICATION_MODE VARCHAR(255),
          PRIMARY KEY(SUBMISSION_ID)
 );
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/7ef88004/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql
b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql
index cfb8022..98f27db 100644
--- a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql
+++ b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql
@@ -91,6 +91,7 @@ CREATE TABLE UNICORE_SUBMISSION
          SUBMISSION_ID VARCHAR(255),
          SECURITY_PROTOCAL VARCHAR(255),
          UNICORE_ENDPOINT_URL VARCHAR(255),
+         AUTHENTICATION_MODE VARCHAR(255),
          PRIMARY KEY(SUBMISSION_ID)
 );
 


Mime
View raw message