You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sh...@apache.org on 2014/09/26 17:19:49 UTC

[03/15] git commit: Implemented Orchestrator side improvements of AIRAVATA-1426

Implemented Orchestrator side improvements of AIRAVATA-1426


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

Branch: refs/heads/orchestratorJobThrottleFeature
Commit: 9a138b5414f57c323855f7d32b3d42c8ebd2130d
Parents: d7bb140
Author: shamrath <sh...@gmail.com>
Authored: Thu Sep 18 11:36:29 2014 -0400
Committer: shamrath <sh...@gmail.com>
Committed: Thu Sep 18 11:36:29 2014 -0400

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   |   6 +-
 .../java/org/apache/airavata/api/Airavata.java  | 125 +++++++-
 .../main/resources/lib/airavata/Airavata.cpp    |  28 +-
 .../src/main/resources/lib/airavata/Airavata.h  |  24 +-
 .../lib/airavata/Airavata_server.skeleton.cpp   |   2 +-
 .../resources/lib/Airavata/API/Airavata.php     |  29 +-
 .../airavataAPI.thrift                          |   2 +-
 .../airavata/common/utils/AiravataUtils.java    | 100 +++++-
 .../airavata/common/utils/AiravataZKUtils.java  |   2 -
 .../apache/airavata/common/utils/Constants.java |   9 +
 .../airavata/common/utils/RequestData.java      | 148 +++++++++
 .../airavata/common/utils/ServerSettings.java   |   6 +
 .../credential-store/pom.xml                    |  20 ++
 .../store/util/AuthenticationInfo.java          |  32 ++
 .../store/util/GSIAuthenticationInfo.java       |  43 +++
 .../store/util/TokenizedMyProxyAuthInfo.java    | 283 +++++++++++++++++
 .../airavata/credential/store/util/Utility.java |  17 ++
 .../gfac/bes/security/GSISecurityContext.java   |   4 +-
 .../airavata/gfac/AbstractSecurityContext.java  |   2 +-
 .../org/apache/airavata/gfac/Constants.java     |   8 +-
 .../org/apache/airavata/gfac/RequestData.java   | 148 ---------
 .../airavata/gfac/core/utils/GFacUtils.java     |  10 -
 .../gfac/gram/security/GSISecurityContext.java  |   8 +-
 .../impl/GFacBaseTestWithMyProxyAuth.java       |   2 +-
 .../gsissh/security/GSISecurityContext.java     |  21 +-
 .../security/TokenizedMyProxyAuthInfo.java      | 302 -------------------
 .../gfac/gsissh/util/GFACGSISSHUtils.java       |   4 +-
 .../impl/GSISSHProviderTestWithMyProxyAuth.java |   2 +-
 .../GSISecurityContextTestWithMyProxyAuth.java  |   5 +-
 .../airavata/gfac/monitor/HPCMonitorID.java     |   4 +-
 .../handlers/GridPullMonitorHandler.java        |   2 +-
 .../handlers/GridPushMonitorHandler.java        |   2 +-
 .../monitor/impl/pull/qstat/HPCPullMonitor.java |   2 +-
 .../impl/pull/qstat/ResourceConnection.java     |   2 +-
 .../apache/airavata/job/AMQPMonitorTest.java    |   2 +-
 .../job/QstatMonitorTestWithMyProxyAuth.java    |   2 +-
 .../ssh/handler/AdvancedSCPInputHandler.java    |   3 +-
 .../ssh/handler/AdvancedSCPOutputHandler.java   |   3 +-
 .../gfac/ssh/security/TokenizedSSHAuthInfo.java |   5 +-
 .../airavata/gfac/ssh/util/GFACSSHUtils.java    |   8 +-
 .../services/impl/BigRed2TestWithSSHAuth.java   |   2 +-
 .../gfac/services/impl/CredentialStoreTest.java |   2 +-
 .../orchestrator/cpi/OrchestratorService.java   | 125 +++++++-
 .../cpi/orchestrator_cpi_serviceConstants.java  |   2 +-
 .../server/OrchestratorServerHandler.java       |   4 +-
 .../core/validator/JobMetadataValidator.java    |   3 +-
 .../impl/ExperimentStatusValidator.java         |   3 +-
 .../core/validator/impl/JobCountValidator.java  | 158 ++++++++++
 .../validator/impl/SimpleAppDataValidator.java  |   3 +-
 .../airavata/orchestrator/cpi/Orchestrator.java |   3 +-
 .../cpi/impl/SimpleOrchestratorImpl.java        |  84 +++---
 .../orchestrator/core/util/SecondValidator.java |   3 +-
 .../orchestrator/core/util/TestValidator.java   |   3 +-
 .../orchestrator.cpi.service.thrift             |   2 +-
 .../xbaya/invoker/EmbeddedGFacInvoker.java      |   2 +-
 tools/gsissh/pom.xml                            |   7 +-
 .../java/com/jcraft/jsch/ExtendedSession.java   |   3 +-
 .../UserAuthGSSAPIWithMICGSSCredentials.java    |   2 +-
 .../airavata/gsi/ssh/api/CommandExecutor.java   |   2 +
 .../api/authentication/AuthenticationInfo.java  |  32 --
 .../authentication/GSIAuthenticationInfo.java   |  43 ---
 .../authentication/SSHKeyAuthentication.java    |   2 +
 .../SSHPasswordAuthentication.java              |   2 +
 .../gsi/ssh/impl/GSISSHAbstractCluster.java     |   2 +
 .../airavata/gsi/ssh/impl/PBSCluster.java       |   3 +-
 .../DefaultPasswordAuthenticationInfo.java      |   2 -
 .../MyProxyAuthenticationInfo.java              |   2 +-
 .../airavata/gsi/ssh/jsch/ExtendedJSch.java     |   2 +-
 .../apache/airavata/gsi/ssh/util/SSHUtils.java  |   2 +-
 .../impl/DefaultSSHApiTestWithMyProxyAuth.java  |  11 +-
 .../gsi/ssh/impl/VanilaTestWithSSHAuth.java     |   3 +-
 71 files changed, 1225 insertions(+), 721 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 1051654..707bf96 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -915,7 +915,7 @@ public class AiravataServerHandler implements Airavata.Iface, Watcher {
      * @param airavataExperimentId
      */
     @Override
-    public boolean validateExperiment(String airavataExperimentId) throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException, AiravataSystemException, TException {
+    public boolean validateExperiment(String airavataExperimentId, String airavataCredStoreToken) throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException, AiravataSystemException, TException {
      	try {
             registry = RegistryFactory.getDefaultRegistry();
  			if (!registry.isExist(RegistryModelType.EXPERIMENT, airavataExperimentId)){
@@ -929,7 +929,7 @@ public class AiravataServerHandler implements Airavata.Iface, Watcher {
  	            throw exception;
  		}
 
-        if (getOrchestratorClient().validateExperiment(airavataExperimentId)) {
+        if (getOrchestratorClient().validateExperiment(airavataExperimentId, airavataCredStoreToken)) {
             return true;
         } else {
             return false;
@@ -1164,7 +1164,7 @@ public class AiravataServerHandler implements Airavata.Iface, Watcher {
 			if (executionType==ExecutionType.SINGLE_APP){
 				//its an single application execution experiment
 		    	final OrchestratorService.Client orchestratorClient = getOrchestratorClient();
-				if (orchestratorClient.validateExperiment(expID)) {
+				if (orchestratorClient.validateExperiment(expID,airavataCredStoreToken)) {
 					thread = new Thread() {
 	                    public void run() {
 	                        try {

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java
index 26c48f6..377944f 100644
--- a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java
+++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java
@@ -305,8 +305,9 @@ import org.slf4j.LoggerFactory;
      * *
      * 
      * @param airavataExperimentId
+     * @param airavataCredStoreToken
      */
-    public boolean validateExperiment(String airavataExperimentId) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.ExperimentNotFoundException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.thrift.TException;
+    public boolean validateExperiment(String airavataExperimentId, String airavataCredStoreToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.ExperimentNotFoundException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.thrift.TException;
 
     /**
      * Launch a previously created and configured experiment. Airavata Server will then start processing the request and appropriate
@@ -1315,7 +1316,7 @@ import org.slf4j.LoggerFactory;
 
     public void updateResourceScheduleing(String airavataExperimentId, org.apache.airavata.model.workspace.experiment.ComputationalResourceScheduling resourceScheduling, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
 
-    public void validateExperiment(String airavataExperimentId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+    public void validateExperiment(String airavataExperimentId, String airavataCredStoreToken, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
 
     public void launchExperiment(String airavataExperimentId, String airavataCredStoreToken, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
 
@@ -2059,16 +2060,17 @@ import org.slf4j.LoggerFactory;
       return;
     }
 
-    public boolean validateExperiment(String airavataExperimentId) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.ExperimentNotFoundException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.thrift.TException
+    public boolean validateExperiment(String airavataExperimentId, String airavataCredStoreToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.ExperimentNotFoundException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.thrift.TException
     {
-      send_validateExperiment(airavataExperimentId);
+      send_validateExperiment(airavataExperimentId, airavataCredStoreToken);
       return recv_validateExperiment();
     }
 
-    public void send_validateExperiment(String airavataExperimentId) throws org.apache.thrift.TException
+    public void send_validateExperiment(String airavataExperimentId, String airavataCredStoreToken) throws org.apache.thrift.TException
     {
       validateExperiment_args args = new validateExperiment_args();
       args.setAiravataExperimentId(airavataExperimentId);
+      args.setAiravataCredStoreToken(airavataCredStoreToken);
       sendBase("validateExperiment", args);
     }
 
@@ -4660,24 +4662,27 @@ import org.slf4j.LoggerFactory;
       }
     }
 
-    public void validateExperiment(String airavataExperimentId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+    public void validateExperiment(String airavataExperimentId, String airavataCredStoreToken, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
       checkReady();
-      validateExperiment_call method_call = new validateExperiment_call(airavataExperimentId, resultHandler, this, ___protocolFactory, ___transport);
+      validateExperiment_call method_call = new validateExperiment_call(airavataExperimentId, airavataCredStoreToken, resultHandler, this, ___protocolFactory, ___transport);
       this.___currentMethod = method_call;
       ___manager.call(method_call);
     }
 
     public static class validateExperiment_call extends org.apache.thrift.async.TAsyncMethodCall {
       private String airavataExperimentId;
-      public validateExperiment_call(String airavataExperimentId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+      private String airavataCredStoreToken;
+      public validateExperiment_call(String airavataExperimentId, String airavataCredStoreToken, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
         super(client, protocolFactory, transport, resultHandler, false);
         this.airavataExperimentId = airavataExperimentId;
+        this.airavataCredStoreToken = airavataCredStoreToken;
       }
 
       public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
         prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("validateExperiment", org.apache.thrift.protocol.TMessageType.CALL, 0));
         validateExperiment_args args = new validateExperiment_args();
         args.setAiravataExperimentId(airavataExperimentId);
+        args.setAiravataCredStoreToken(airavataCredStoreToken);
         args.write(prot);
         prot.writeMessageEnd();
       }
@@ -7274,7 +7279,7 @@ import org.slf4j.LoggerFactory;
       public validateExperiment_result getResult(I iface, validateExperiment_args args) throws org.apache.thrift.TException {
         validateExperiment_result result = new validateExperiment_result();
         try {
-          result.success = iface.validateExperiment(args.airavataExperimentId);
+          result.success = iface.validateExperiment(args.airavataExperimentId, args.airavataCredStoreToken);
           result.setSuccessIsSet(true);
         } catch (org.apache.airavata.model.error.InvalidRequestException ire) {
           result.ire = ire;
@@ -10387,7 +10392,7 @@ import org.slf4j.LoggerFactory;
       }
 
       public void start(I iface, validateExperiment_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException {
-        iface.validateExperiment(args.airavataExperimentId,resultHandler);
+        iface.validateExperiment(args.airavataExperimentId, args.airavataCredStoreToken,resultHandler);
       }
     }
 
@@ -34613,6 +34618,7 @@ import org.slf4j.LoggerFactory;
     private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("validateExperiment_args");
 
     private static final org.apache.thrift.protocol.TField AIRAVATA_EXPERIMENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("airavataExperimentId", org.apache.thrift.protocol.TType.STRING, (short)1);
+    private static final org.apache.thrift.protocol.TField AIRAVATA_CRED_STORE_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("airavataCredStoreToken", org.apache.thrift.protocol.TType.STRING, (short)2);
 
     private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
     static {
@@ -34621,10 +34627,12 @@ import org.slf4j.LoggerFactory;
     }
 
     public String airavataExperimentId; // required
+    public String airavataCredStoreToken; // required
 
     /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
     @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-      AIRAVATA_EXPERIMENT_ID((short)1, "airavataExperimentId");
+      AIRAVATA_EXPERIMENT_ID((short)1, "airavataExperimentId"),
+      AIRAVATA_CRED_STORE_TOKEN((short)2, "airavataCredStoreToken");
 
       private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -34641,6 +34649,8 @@ import org.slf4j.LoggerFactory;
         switch(fieldId) {
           case 1: // AIRAVATA_EXPERIMENT_ID
             return AIRAVATA_EXPERIMENT_ID;
+          case 2: // AIRAVATA_CRED_STORE_TOKEN
+            return AIRAVATA_CRED_STORE_TOKEN;
           default:
             return null;
         }
@@ -34686,6 +34696,8 @@ import org.slf4j.LoggerFactory;
       Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
       tmpMap.put(_Fields.AIRAVATA_EXPERIMENT_ID, new org.apache.thrift.meta_data.FieldMetaData("airavataExperimentId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
           new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+      tmpMap.put(_Fields.AIRAVATA_CRED_STORE_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("airavataCredStoreToken", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
       metaDataMap = Collections.unmodifiableMap(tmpMap);
       org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(validateExperiment_args.class, metaDataMap);
     }
@@ -34694,10 +34706,12 @@ import org.slf4j.LoggerFactory;
     }
 
     public validateExperiment_args(
-      String airavataExperimentId)
+      String airavataExperimentId,
+      String airavataCredStoreToken)
     {
       this();
       this.airavataExperimentId = airavataExperimentId;
+      this.airavataCredStoreToken = airavataCredStoreToken;
     }
 
     /**
@@ -34707,6 +34721,9 @@ import org.slf4j.LoggerFactory;
       if (other.isSetAiravataExperimentId()) {
         this.airavataExperimentId = other.airavataExperimentId;
       }
+      if (other.isSetAiravataCredStoreToken()) {
+        this.airavataCredStoreToken = other.airavataCredStoreToken;
+      }
     }
 
     public validateExperiment_args deepCopy() {
@@ -34716,6 +34733,7 @@ import org.slf4j.LoggerFactory;
     @Override
     public void clear() {
       this.airavataExperimentId = null;
+      this.airavataCredStoreToken = null;
     }
 
     public String getAiravataExperimentId() {
@@ -34742,6 +34760,30 @@ import org.slf4j.LoggerFactory;
       }
     }
 
+    public String getAiravataCredStoreToken() {
+      return this.airavataCredStoreToken;
+    }
+
+    public validateExperiment_args setAiravataCredStoreToken(String airavataCredStoreToken) {
+      this.airavataCredStoreToken = airavataCredStoreToken;
+      return this;
+    }
+
+    public void unsetAiravataCredStoreToken() {
+      this.airavataCredStoreToken = null;
+    }
+
+    /** Returns true if field airavataCredStoreToken is set (has been assigned a value) and false otherwise */
+    public boolean isSetAiravataCredStoreToken() {
+      return this.airavataCredStoreToken != null;
+    }
+
+    public void setAiravataCredStoreTokenIsSet(boolean value) {
+      if (!value) {
+        this.airavataCredStoreToken = null;
+      }
+    }
+
     public void setFieldValue(_Fields field, Object value) {
       switch (field) {
       case AIRAVATA_EXPERIMENT_ID:
@@ -34752,6 +34794,14 @@ import org.slf4j.LoggerFactory;
         }
         break;
 
+      case AIRAVATA_CRED_STORE_TOKEN:
+        if (value == null) {
+          unsetAiravataCredStoreToken();
+        } else {
+          setAiravataCredStoreToken((String)value);
+        }
+        break;
+
       }
     }
 
@@ -34760,6 +34810,9 @@ import org.slf4j.LoggerFactory;
       case AIRAVATA_EXPERIMENT_ID:
         return getAiravataExperimentId();
 
+      case AIRAVATA_CRED_STORE_TOKEN:
+        return getAiravataCredStoreToken();
+
       }
       throw new IllegalStateException();
     }
@@ -34773,6 +34826,8 @@ import org.slf4j.LoggerFactory;
       switch (field) {
       case AIRAVATA_EXPERIMENT_ID:
         return isSetAiravataExperimentId();
+      case AIRAVATA_CRED_STORE_TOKEN:
+        return isSetAiravataCredStoreToken();
       }
       throw new IllegalStateException();
     }
@@ -34799,6 +34854,15 @@ import org.slf4j.LoggerFactory;
           return false;
       }
 
+      boolean this_present_airavataCredStoreToken = true && this.isSetAiravataCredStoreToken();
+      boolean that_present_airavataCredStoreToken = true && that.isSetAiravataCredStoreToken();
+      if (this_present_airavataCredStoreToken || that_present_airavataCredStoreToken) {
+        if (!(this_present_airavataCredStoreToken && that_present_airavataCredStoreToken))
+          return false;
+        if (!this.airavataCredStoreToken.equals(that.airavataCredStoreToken))
+          return false;
+      }
+
       return true;
     }
 
@@ -34825,6 +34889,16 @@ import org.slf4j.LoggerFactory;
           return lastComparison;
         }
       }
+      lastComparison = Boolean.valueOf(isSetAiravataCredStoreToken()).compareTo(other.isSetAiravataCredStoreToken());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAiravataCredStoreToken()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.airavataCredStoreToken, other.airavataCredStoreToken);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
       return 0;
     }
 
@@ -34852,6 +34926,14 @@ import org.slf4j.LoggerFactory;
         sb.append(this.airavataExperimentId);
       }
       first = false;
+      if (!first) sb.append(", ");
+      sb.append("airavataCredStoreToken:");
+      if (this.airavataCredStoreToken == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.airavataCredStoreToken);
+      }
+      first = false;
       sb.append(")");
       return sb.toString();
     }
@@ -34861,6 +34943,9 @@ import org.slf4j.LoggerFactory;
       if (airavataExperimentId == null) {
         throw new org.apache.thrift.protocol.TProtocolException("Required field 'airavataExperimentId' was not present! Struct: " + toString());
       }
+      if (airavataCredStoreToken == null) {
+        throw new org.apache.thrift.protocol.TProtocolException("Required field 'airavataCredStoreToken' was not present! Struct: " + toString());
+      }
       // check for sub-struct validity
     }
 
@@ -34906,6 +34991,14 @@ import org.slf4j.LoggerFactory;
                 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
               }
               break;
+            case 2: // AIRAVATA_CRED_STORE_TOKEN
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+                struct.airavataCredStoreToken = iprot.readString();
+                struct.setAiravataCredStoreTokenIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
             default:
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
           }
@@ -34926,6 +35019,11 @@ import org.slf4j.LoggerFactory;
           oprot.writeString(struct.airavataExperimentId);
           oprot.writeFieldEnd();
         }
+        if (struct.airavataCredStoreToken != null) {
+          oprot.writeFieldBegin(AIRAVATA_CRED_STORE_TOKEN_FIELD_DESC);
+          oprot.writeString(struct.airavataCredStoreToken);
+          oprot.writeFieldEnd();
+        }
         oprot.writeFieldStop();
         oprot.writeStructEnd();
       }
@@ -34944,6 +35042,7 @@ import org.slf4j.LoggerFactory;
       public void write(org.apache.thrift.protocol.TProtocol prot, validateExperiment_args struct) throws org.apache.thrift.TException {
         TTupleProtocol oprot = (TTupleProtocol) prot;
         oprot.writeString(struct.airavataExperimentId);
+        oprot.writeString(struct.airavataCredStoreToken);
       }
 
       @Override
@@ -34951,6 +35050,8 @@ import org.slf4j.LoggerFactory;
         TTupleProtocol iprot = (TTupleProtocol) prot;
         struct.airavataExperimentId = iprot.readString();
         struct.setAiravataExperimentIdIsSet(true);
+        struct.airavataCredStoreToken = iprot.readString();
+        struct.setAiravataCredStoreTokenIsSet(true);
       }
     }
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp
index 759b47e..8baa1ed 100644
--- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp
+++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp
@@ -4716,6 +4716,7 @@ uint32_t Airavata_validateExperiment_args::read(::apache::thrift::protocol::TPro
   using ::apache::thrift::protocol::TProtocolException;
 
   bool isset_airavataExperimentId = false;
+  bool isset_airavataCredStoreToken = false;
 
   while (true)
   {
@@ -4733,6 +4734,14 @@ uint32_t Airavata_validateExperiment_args::read(::apache::thrift::protocol::TPro
           xfer += iprot->skip(ftype);
         }
         break;
+      case 2:
+        if (ftype == ::apache::thrift::protocol::T_STRING) {
+          xfer += iprot->readString(this->airavataCredStoreToken);
+          isset_airavataCredStoreToken = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
       default:
         xfer += iprot->skip(ftype);
         break;
@@ -4744,6 +4753,8 @@ uint32_t Airavata_validateExperiment_args::read(::apache::thrift::protocol::TPro
 
   if (!isset_airavataExperimentId)
     throw TProtocolException(TProtocolException::INVALID_DATA);
+  if (!isset_airavataCredStoreToken)
+    throw TProtocolException(TProtocolException::INVALID_DATA);
   return xfer;
 }
 
@@ -4755,6 +4766,10 @@ uint32_t Airavata_validateExperiment_args::write(::apache::thrift::protocol::TPr
   xfer += oprot->writeString(this->airavataExperimentId);
   xfer += oprot->writeFieldEnd();
 
+  xfer += oprot->writeFieldBegin("airavataCredStoreToken", ::apache::thrift::protocol::T_STRING, 2);
+  xfer += oprot->writeString(this->airavataCredStoreToken);
+  xfer += oprot->writeFieldEnd();
+
   xfer += oprot->writeFieldStop();
   xfer += oprot->writeStructEnd();
   return xfer;
@@ -4768,6 +4783,10 @@ uint32_t Airavata_validateExperiment_pargs::write(::apache::thrift::protocol::TP
   xfer += oprot->writeString((*(this->airavataExperimentId)));
   xfer += oprot->writeFieldEnd();
 
+  xfer += oprot->writeFieldBegin("airavataCredStoreToken", ::apache::thrift::protocol::T_STRING, 2);
+  xfer += oprot->writeString((*(this->airavataCredStoreToken)));
+  xfer += oprot->writeFieldEnd();
+
   xfer += oprot->writeFieldStop();
   xfer += oprot->writeStructEnd();
   return xfer;
@@ -20424,19 +20443,20 @@ void AiravataClient::recv_updateResourceScheduleing()
   return;
 }
 
-bool AiravataClient::validateExperiment(const std::string& airavataExperimentId)
+bool AiravataClient::validateExperiment(const std::string& airavataExperimentId, const std::string& airavataCredStoreToken)
 {
-  send_validateExperiment(airavataExperimentId);
+  send_validateExperiment(airavataExperimentId, airavataCredStoreToken);
   return recv_validateExperiment();
 }
 
-void AiravataClient::send_validateExperiment(const std::string& airavataExperimentId)
+void AiravataClient::send_validateExperiment(const std::string& airavataExperimentId, const std::string& airavataCredStoreToken)
 {
   int32_t cseqid = 0;
   oprot_->writeMessageBegin("validateExperiment", ::apache::thrift::protocol::T_CALL, cseqid);
 
   Airavata_validateExperiment_pargs args;
   args.airavataExperimentId = &airavataExperimentId;
+  args.airavataCredStoreToken = &airavataCredStoreToken;
   args.write(oprot_);
 
   oprot_->writeMessageEnd();
@@ -25659,7 +25679,7 @@ void AiravataProcessor::process_validateExperiment(int32_t seqid, ::apache::thri
 
   Airavata_validateExperiment_result result;
   try {
-    result.success = iface_->validateExperiment(args.airavataExperimentId);
+    result.success = iface_->validateExperiment(args.airavataExperimentId, args.airavataCredStoreToken);
     result.__isset.success = true;
   } catch ( ::apache::airavata::api::error::InvalidRequestException &ire) {
     result.ire = ire;

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h
index 2028749..03b5fc2 100644
--- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h
+++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h
@@ -51,7 +51,7 @@ class AiravataIf {
   virtual void updateExperiment(const std::string& airavataExperimentId, const  ::apache::airavata::model::workspace::experiment::Experiment& experiment) = 0;
   virtual void updateExperimentConfiguration(const std::string& airavataExperimentId, const  ::apache::airavata::model::workspace::experiment::UserConfigurationData& userConfiguration) = 0;
   virtual void updateResourceScheduleing(const std::string& airavataExperimentId, const  ::apache::airavata::model::workspace::experiment::ComputationalResourceScheduling& resourceScheduling) = 0;
-  virtual bool validateExperiment(const std::string& airavataExperimentId) = 0;
+  virtual bool validateExperiment(const std::string& airavataExperimentId, const std::string& airavataCredStoreToken) = 0;
   virtual void launchExperiment(const std::string& airavataExperimentId, const std::string& airavataCredStoreToken) = 0;
   virtual void getExperimentStatus( ::apache::airavata::model::workspace::experiment::ExperimentStatus& _return, const std::string& airavataExperimentId) = 0;
   virtual void getExperimentOutputs(std::vector< ::apache::airavata::model::workspace::experiment::DataObjectType> & _return, const std::string& airavataExperimentId) = 0;
@@ -196,7 +196,7 @@ class AiravataNull : virtual public AiravataIf {
   void updateResourceScheduleing(const std::string& /* airavataExperimentId */, const  ::apache::airavata::model::workspace::experiment::ComputationalResourceScheduling& /* resourceScheduling */) {
     return;
   }
-  bool validateExperiment(const std::string& /* airavataExperimentId */) {
+  bool validateExperiment(const std::string& /* airavataExperimentId */, const std::string& /* airavataCredStoreToken */) {
     bool _return = false;
     return _return;
   }
@@ -2937,21 +2937,28 @@ class Airavata_updateResourceScheduleing_presult {
 class Airavata_validateExperiment_args {
  public:
 
-  Airavata_validateExperiment_args() : airavataExperimentId() {
+  Airavata_validateExperiment_args() : airavataExperimentId(), airavataCredStoreToken() {
   }
 
   virtual ~Airavata_validateExperiment_args() throw() {}
 
   std::string airavataExperimentId;
+  std::string airavataCredStoreToken;
 
   void __set_airavataExperimentId(const std::string& val) {
     airavataExperimentId = val;
   }
 
+  void __set_airavataCredStoreToken(const std::string& val) {
+    airavataCredStoreToken = val;
+  }
+
   bool operator == (const Airavata_validateExperiment_args & rhs) const
   {
     if (!(airavataExperimentId == rhs.airavataExperimentId))
       return false;
+    if (!(airavataCredStoreToken == rhs.airavataCredStoreToken))
+      return false;
     return true;
   }
   bool operator != (const Airavata_validateExperiment_args &rhs) const {
@@ -2973,6 +2980,7 @@ class Airavata_validateExperiment_pargs {
   virtual ~Airavata_validateExperiment_pargs() throw() {}
 
   const std::string* airavataExperimentId;
+  const std::string* airavataCredStoreToken;
 
   uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
 
@@ -11131,8 +11139,8 @@ class AiravataClient : virtual public AiravataIf {
   void updateResourceScheduleing(const std::string& airavataExperimentId, const  ::apache::airavata::model::workspace::experiment::ComputationalResourceScheduling& resourceScheduling);
   void send_updateResourceScheduleing(const std::string& airavataExperimentId, const  ::apache::airavata::model::workspace::experiment::ComputationalResourceScheduling& resourceScheduling);
   void recv_updateResourceScheduleing();
-  bool validateExperiment(const std::string& airavataExperimentId);
-  void send_validateExperiment(const std::string& airavataExperimentId);
+  bool validateExperiment(const std::string& airavataExperimentId, const std::string& airavataCredStoreToken);
+  void send_validateExperiment(const std::string& airavataExperimentId, const std::string& airavataCredStoreToken);
   bool recv_validateExperiment();
   void launchExperiment(const std::string& airavataExperimentId, const std::string& airavataCredStoreToken);
   void send_launchExperiment(const std::string& airavataExperimentId, const std::string& airavataCredStoreToken);
@@ -11696,13 +11704,13 @@ class AiravataMultiface : virtual public AiravataIf {
     ifaces_[i]->updateResourceScheduleing(airavataExperimentId, resourceScheduling);
   }
 
-  bool validateExperiment(const std::string& airavataExperimentId) {
+  bool validateExperiment(const std::string& airavataExperimentId, const std::string& airavataCredStoreToken) {
     size_t sz = ifaces_.size();
     size_t i = 0;
     for (; i < (sz - 1); ++i) {
-      ifaces_[i]->validateExperiment(airavataExperimentId);
+      ifaces_[i]->validateExperiment(airavataExperimentId, airavataCredStoreToken);
     }
-    return ifaces_[i]->validateExperiment(airavataExperimentId);
+    return ifaces_[i]->validateExperiment(airavataExperimentId, airavataCredStoreToken);
   }
 
   void launchExperiment(const std::string& airavataExperimentId, const std::string& airavataCredStoreToken) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp
index 4f92b09..7aab0f8 100644
--- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp
+++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp
@@ -134,7 +134,7 @@ class AiravataHandler : virtual public AiravataIf {
     printf("updateResourceScheduleing\n");
   }
 
-  bool validateExperiment(const std::string& airavataExperimentId) {
+  bool validateExperiment(const std::string& airavataExperimentId, const std::string& airavataCredStoreToken) {
     // Your implementation goes here
     printf("validateExperiment\n");
   }

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
index e7e9c75..4dd3b20 100644
--- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
+++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
@@ -36,7 +36,7 @@ interface AiravataIf {
   public function updateExperiment($airavataExperimentId, \Airavata\Model\Workspace\Experiment\Experiment $experiment);
   public function updateExperimentConfiguration($airavataExperimentId, \Airavata\Model\Workspace\Experiment\UserConfigurationData $userConfiguration);
   public function updateResourceScheduleing($airavataExperimentId, \Airavata\Model\Workspace\Experiment\ComputationalResourceScheduling $resourceScheduling);
-  public function validateExperiment($airavataExperimentId);
+  public function validateExperiment($airavataExperimentId, $airavataCredStoreToken);
   public function launchExperiment($airavataExperimentId, $airavataCredStoreToken);
   public function getExperimentStatus($airavataExperimentId);
   public function getExperimentOutputs($airavataExperimentId);
@@ -1244,16 +1244,17 @@ class AiravataClient implements \Airavata\API\AiravataIf {
     return;
   }
 
-  public function validateExperiment($airavataExperimentId)
+  public function validateExperiment($airavataExperimentId, $airavataCredStoreToken)
   {
-    $this->send_validateExperiment($airavataExperimentId);
+    $this->send_validateExperiment($airavataExperimentId, $airavataCredStoreToken);
     return $this->recv_validateExperiment();
   }
 
-  public function send_validateExperiment($airavataExperimentId)
+  public function send_validateExperiment($airavataExperimentId, $airavataCredStoreToken)
   {
     $args = new \Airavata\API\Airavata_validateExperiment_args();
     $args->airavataExperimentId = $airavataExperimentId;
+    $args->airavataCredStoreToken = $airavataCredStoreToken;
     $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
     if ($bin_accel)
     {
@@ -9268,6 +9269,7 @@ class Airavata_validateExperiment_args {
   static $_TSPEC;
 
   public $airavataExperimentId = null;
+  public $airavataCredStoreToken = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -9276,12 +9278,19 @@ class Airavata_validateExperiment_args {
           'var' => 'airavataExperimentId',
           'type' => TType::STRING,
           ),
+        2 => array(
+          'var' => 'airavataCredStoreToken',
+          'type' => TType::STRING,
+          ),
         );
     }
     if (is_array($vals)) {
       if (isset($vals['airavataExperimentId'])) {
         $this->airavataExperimentId = $vals['airavataExperimentId'];
       }
+      if (isset($vals['airavataCredStoreToken'])) {
+        $this->airavataCredStoreToken = $vals['airavataCredStoreToken'];
+      }
     }
   }
 
@@ -9311,6 +9320,13 @@ class Airavata_validateExperiment_args {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->airavataCredStoreToken);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -9329,6 +9345,11 @@ class Airavata_validateExperiment_args {
       $xfer += $output->writeString($this->airavataExperimentId);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->airavataCredStoreToken !== null) {
+      $xfer += $output->writeFieldBegin('airavataCredStoreToken', TType::STRING, 2);
+      $xfer += $output->writeString($this->airavataCredStoreToken);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/airavata-api/thrift-interface-descriptions/airavataAPI.thrift
----------------------------------------------------------------------
diff --git a/airavata-api/thrift-interface-descriptions/airavataAPI.thrift b/airavata-api/thrift-interface-descriptions/airavataAPI.thrift
index e712d16..6e2b2a5 100644
--- a/airavata-api/thrift-interface-descriptions/airavataAPI.thrift
+++ b/airavata-api/thrift-interface-descriptions/airavataAPI.thrift
@@ -332,7 +332,7 @@ service Airavata {
      * @return sucess/failure
      *
     **/
-  bool validateExperiment(1: required string airavataExperimentId)
+  bool validateExperiment(1: required string airavataExperimentId, 2: required string airavataCredStoreToken)
       throws (1: airavataErrors.InvalidRequestException ire,
               2: airavataErrors.ExperimentNotFoundException enf,
               3: airavataErrors.AiravataClientException ace,

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/AiravataUtils.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/AiravataUtils.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/AiravataUtils.java
index 6c29313..5d47d10 100644
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/AiravataUtils.java
+++ b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/AiravataUtils.java
@@ -21,11 +21,30 @@
 
 package org.apache.airavata.common.utils;
 
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.WatchedEvent;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.ZooKeeper;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
 import java.sql.Timestamp;
 import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
 
 public class AiravataUtils {
-	public static final String EXECUTION_MODE="application.execution.mode";
+    private static final org.slf4j.Logger log = LoggerFactory.getLogger(AiravataUtils.class);
+
+    private static Map<String, Integer> jobCountMap;
+
+    private static final String statPath = "/" + Constants.STAT;
+
+
+    public static final String EXECUTION_MODE="application.execution.mode";
 	public static void setExecutionMode(ExecutionMode mode){
 		System.setProperty(EXECUTION_MODE, mode.name());
 	}
@@ -66,4 +85,83 @@ public class AiravataUtils {
         }
         return new Timestamp(time);
     }
+
+    public static Map<String, Integer> getJobCountMap(ZooKeeper zk) {
+        if (jobCountMap == null) {
+            try {
+                if (zk.exists(statPath, false) == null) {
+                    zk.create(statPath, null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
+                }
+                byte[] byteData = zk.getData(statPath, new StatReader(zk), null);
+                jobCountMap = new HashMap<String, Integer>(); //initialize jobCountMap after register a watcher for stat znode
+                if (byteData != null) {
+                    String data = new String(byteData);
+                    populateJobCountMap(data, zk);
+                } else {
+                    // nothing to populate , so ignore it
+                }
+                log.info("Successfully populated job count map by reading zookeeper stat znode");
+            } catch (Exception e) {
+                log.error("Error while populating job count map by reading stat znode");
+            }
+        }
+        return jobCountMap;
+    }
+
+    /**
+     * This inner class is being used to populate the job count map.
+     */
+    private static class StatReader implements Watcher {
+        private ZooKeeper zk;
+
+        private StatReader(ZooKeeper zk) throws KeeperException, InterruptedException, ApplicationSettingsException, IOException {
+            this.zk = zk;
+        }
+
+        @Override
+        public void process(WatchedEvent event) {
+            try {
+                if (event.getType() == Event.EventType.NodeDataChanged) {
+                    byte[] statData = zk.getData(statPath, this, null);
+                    if (statData != null) {
+                        populateJobCountMap(new String(statData) , zk);
+                    } else {
+                        // all data has been cleaned in stat znode so nothing to do
+                    }
+                } else if (event.getType() == Event.EventType.NodeChildrenChanged
+                        || event.getType() == Event.EventType.None) {
+                    zk.getData(statPath, this, null);
+                } else {
+                    // we don't handle node delete or node create states
+                }
+            } catch (KeeperException e) {
+                log.error("Error while getting data from " + event.getPath(), e);
+            } catch (InterruptedException e) {
+                log.error("Error while getting data from " + event.getPath(), e);
+            } catch (ApplicationSettingsException e) {
+                log.error("Error while retrieving zookeeper connection string", e);
+            } catch (IOException e) {
+                log.error("Error while connecting to ZooKeeper server", e);
+            }
+        }
+
+
+    }
+
+    private static void populateJobCountMap(String dataString , ZooKeeper zk) throws KeeperException, InterruptedException, ApplicationSettingsException, IOException {
+        if (dataString != null) {
+            String[] paths = dataString.split(":");
+            String dataStr;
+            for (String path : paths) {
+                byte[] data = zk.getData(path, null, null);
+                if (data == null) {
+                    log.error("No job count set for path " + path + ", it returned null for the data");
+                } else {
+                    dataStr = new String(data);
+                    log.info("Update Path : " + path + " - " + dataStr);
+                    jobCountMap.put(path, Integer.parseInt(dataStr));
+                }
+            }
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/AiravataZKUtils.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/AiravataZKUtils.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/AiravataZKUtils.java
index f91fc3c..f0ec091 100644
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/AiravataZKUtils.java
+++ b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/AiravataZKUtils.java
@@ -21,9 +21,7 @@
 package org.apache.airavata.common.utils;
 
 import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.ZooDefs;
 import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.data.Stat;
 import org.apache.zookeeper.server.ServerCnxnFactory;

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/Constants.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/Constants.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/Constants.java
index 8335e0c..3636193 100644
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/Constants.java
+++ b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/Constants.java
@@ -48,4 +48,13 @@ public final class Constants {
     public static final String ZOOKEEPER_API_SERVER_NAME = "api-server-name";
     public static final String STAT = "stat";
     public static final String JOB = "job";
+
+    public static final String TRUSTED_CERT_LOCATION = "trusted.cert.location";
+    public static final String TRUSTED_CERTIFICATE_SYSTEM_PROPERTY = "X509_CERT_DIR";
+
+    public static final String MYPROXY_SERVER = "myproxy.server";
+    public static final String MYPROXY_SERVER_PORT = "myproxy.port";
+    public static final String MYPROXY_USER = "myproxy.username";
+    public static final String MYPROXY_PASS = "myproxy.password";
+    public static final String MYPROXY_LIFE = "myproxy.life";
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/RequestData.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/RequestData.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/RequestData.java
new file mode 100644
index 0000000..33acf8f
--- /dev/null
+++ b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/RequestData.java
@@ -0,0 +1,148 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.common.utils;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 6/28/13
+ * Time: 3:28 PM
+ */
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+
+/**
+ * Encapsulates GFac specific data that are coming in the request.
+ */
+public class RequestData {
+
+    private static final int DEFAULT_LIFE_TIME = 3600;
+    private static final int DEFAULT_MY_PROXY_PORT = 7512;
+
+    private String tokenId;
+    private String requestUser;
+    private String gatewayId;
+
+    private String myProxyServerUrl = null;
+    private int myProxyPort = 0;
+    private String myProxyUserName = null;
+    private String myProxyPassword = null;
+    private int myProxyLifeTime = DEFAULT_LIFE_TIME;
+
+
+    public RequestData() {
+    }
+
+    public RequestData(String gatewayId) {
+        this.gatewayId = gatewayId;
+    }
+
+    public RequestData(String tokenId, String requestUser, String gatewayId) {
+        this.tokenId = tokenId;
+        this.requestUser = requestUser;
+        this.gatewayId = gatewayId;
+    }
+
+    public String getTokenId() {
+        return tokenId;
+    }
+
+    public void setTokenId(String tokenId) {
+        this.tokenId = tokenId;
+    }
+
+    public String getRequestUser() {
+        return requestUser;
+    }
+
+    public void setRequestUser(String requestUser) {
+        this.requestUser = requestUser;
+    }
+
+    public String getGatewayId() {
+        return gatewayId;
+    }
+
+    public void setGatewayId(String gatewayId) {
+        this.gatewayId = gatewayId;
+    }
+
+    public String getMyProxyServerUrl() throws ApplicationSettingsException {
+        if (myProxyServerUrl == null) {
+            myProxyServerUrl = ServerSettings.getSetting(Constants.MYPROXY_SERVER);
+        }
+        return myProxyServerUrl;
+    }
+
+    public void setMyProxyServerUrl(String myProxyServerUrl) {
+        this.myProxyServerUrl = myProxyServerUrl;
+    }
+
+    public int getMyProxyPort() {
+
+        if (myProxyPort == 0) {
+            String sPort = ServerSettings.getSetting(Constants.MYPROXY_SERVER_PORT, Integer.toString(DEFAULT_MY_PROXY_PORT));
+            myProxyPort = Integer.parseInt(sPort);
+        }
+
+        return myProxyPort;
+    }
+
+    public void setMyProxyPort(int myProxyPort) {
+        this.myProxyPort = myProxyPort;
+    }
+
+    public String getMyProxyUserName() throws ApplicationSettingsException {
+        if (myProxyUserName == null) {
+            myProxyUserName = ServerSettings.getSetting(Constants.MYPROXY_USER);
+        }
+
+        return myProxyUserName;
+    }
+
+    public void setMyProxyUserName(String myProxyUserName) {
+        this.myProxyUserName = myProxyUserName;
+    }
+
+    public String getMyProxyPassword() throws ApplicationSettingsException {
+
+        if (myProxyPassword == null) {
+            myProxyPassword = ServerSettings.getSetting(Constants.MYPROXY_PASS);
+        }
+
+        return myProxyPassword;
+    }
+
+    public int getMyProxyLifeTime() {
+        String life = ServerSettings.getSetting(Constants.MYPROXY_LIFE,Integer.toString(myProxyLifeTime));
+        myProxyLifeTime = Integer.parseInt(life);
+        return myProxyLifeTime;
+    }
+
+    public void setMyProxyLifeTime(int myProxyLifeTime) {
+        this.myProxyLifeTime = myProxyLifeTime;
+    }
+
+    public void setMyProxyPassword(String myProxyPassword) {
+        this.myProxyPassword = myProxyPassword;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServerSettings.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
index a7fc02d..e607cdc 100644
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
+++ b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
@@ -71,6 +71,8 @@ public class ServerSettings extends ApplicationSettings {
     private static final String MY_PROXY_LIFETIME = "myproxy.life";
     private static final String ACTIVITY_LISTENERS = "activity.listeners";
 
+    private static final String GLOBAL_MAX_JOB_COUNT = "global.max.job.count";
+
     private static boolean stopAllThreads = false;
 
     public static String getDefaultUser() throws ApplicationSettingsException {
@@ -101,6 +103,10 @@ public class ServerSettings extends ApplicationSettings {
         return getSetting(SERVER_CONTEXT_ROOT, "axis2");
     }
 
+    public static String getGlobalMaxJobCount() throws ApplicationSettingsException {
+        return getSetting(GLOBAL_MAX_JOB_COUNT);
+    }
+
     public static String getCredentialStoreDBUser() throws ApplicationSettingsException {
         try {
             return getSetting(CREDENTIAL_STORE_DB_USER);

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/credential-store-service/credential-store/pom.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/pom.xml b/modules/credential-store-service/credential-store/pom.xml
index e3c8a4a..bd03b8d 100644
--- a/modules/credential-store-service/credential-store/pom.xml
+++ b/modules/credential-store-service/credential-store/pom.xml
@@ -115,6 +115,26 @@
             <artifactId>commons-email</artifactId>
             <version>1.3.2</version>
         </dependency>
+        <dependency>
+            <groupId>org.jglobus</groupId>
+            <artifactId>ssl-proxies</artifactId>
+            <version>2.0.6</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jglobus</groupId>
+            <artifactId>ssl-proxies</artifactId>
+            <version>2.0.6</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jglobus</groupId>
+            <artifactId>gss</artifactId>
+            <version>2.0.6</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jglobus</groupId>
+            <artifactId>myproxy</artifactId>
+            <version>2.0.6</version>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/AuthenticationInfo.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/AuthenticationInfo.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/AuthenticationInfo.java
new file mode 100644
index 0000000..fcf5b89
--- /dev/null
+++ b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/AuthenticationInfo.java
@@ -0,0 +1,32 @@
+package org.apache.airavata.credential.store.util;/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 10/4/13
+ * Time: 11:25 AM
+ */
+
+/**
+ * An empty interface that represents authentication data to the API.
+ */
+public interface AuthenticationInfo {
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/GSIAuthenticationInfo.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/GSIAuthenticationInfo.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/GSIAuthenticationInfo.java
new file mode 100644
index 0000000..47d7bde
--- /dev/null
+++ b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/GSIAuthenticationInfo.java
@@ -0,0 +1,43 @@
+package org.apache.airavata.credential.store.util;/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+import org.ietf.jgss.GSSCredential;
+
+import java.util.Properties;
+
+/**
+ * Authentication data. Could be MyProxy user name, password, could be GSSCredentials
+ * or could be SSH keys.
+ */
+public abstract class GSIAuthenticationInfo implements AuthenticationInfo {
+
+    public Properties properties = new Properties();
+
+    public abstract GSSCredential getCredentials() throws SecurityException;
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Properties properties) {
+        this.properties = properties;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/TokenizedMyProxyAuthInfo.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/TokenizedMyProxyAuthInfo.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/TokenizedMyProxyAuthInfo.java
new file mode 100644
index 0000000..02d8511
--- /dev/null
+++ b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/TokenizedMyProxyAuthInfo.java
@@ -0,0 +1,283 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.credential.store.util;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.credential.store.credential.Credential;
+import org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential;
+import org.apache.airavata.credential.store.store.CredentialReader;
+import org.apache.airavata.common.utils.Constants;
+import org.apache.airavata.common.utils.RequestData;
+import org.globus.gsi.X509Credential;
+import org.globus.gsi.gssapi.GlobusGSSCredentialImpl;
+import org.globus.gsi.provider.GlobusProvider;
+import org.globus.myproxy.GetParams;
+import org.globus.myproxy.MyProxy;
+import org.globus.myproxy.MyProxyException;
+import org.gridforum.jgss.ExtendedGSSCredential;
+import org.ietf.jgss.GSSCredential;
+import org.ietf.jgss.GSSException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.security.Security;
+import java.security.cert.X509Certificate;
+
+public class TokenizedMyProxyAuthInfo extends GSIAuthenticationInfo {
+    protected static final Logger log = LoggerFactory.getLogger(TokenizedMyProxyAuthInfo.class);
+
+    public static int CREDENTIAL_RENEWING_THRESH_HOLD = 10 * 90;
+
+    private GSSCredential gssCredentials = null;
+
+
+    private CredentialReader credentialReader;
+
+    private RequestData requestData;
+
+    public static final String X509_CERT_DIR = "X509_CERT_DIR";
+
+
+    static {
+        Security.addProvider(new GlobusProvider());
+        try {
+            setUpTrustedCertificatePath();
+        } catch (ApplicationSettingsException e) {
+            log.error(e.getLocalizedMessage(), e);
+        }
+    }
+
+    public static void setUpTrustedCertificatePath(String trustedCertificatePath) {
+
+        File file = new File(trustedCertificatePath);
+
+        if (!file.exists() || !file.canRead()) {
+            File f = new File(".");
+            log.info("Current directory " + f.getAbsolutePath());
+            throw new RuntimeException("Cannot read trusted certificate path " + trustedCertificatePath);
+        } else {
+            System.setProperty(Constants.TRUSTED_CERTIFICATE_SYSTEM_PROPERTY, file.getAbsolutePath());
+        }
+    }
+
+    private static void setUpTrustedCertificatePath() throws ApplicationSettingsException {
+
+        String trustedCertificatePath = ServerSettings.getSetting(Constants.TRUSTED_CERT_LOCATION);
+
+        setUpTrustedCertificatePath(trustedCertificatePath);
+    }
+
+    public TokenizedMyProxyAuthInfo(CredentialReader credentialReader, RequestData requestData) {
+        this.credentialReader = credentialReader;
+        this.requestData = requestData;
+        try {
+            properties.setProperty(X509_CERT_DIR, ServerSettings.getSetting(Constants.TRUSTED_CERT_LOCATION));
+        } catch (ApplicationSettingsException e) {
+            e.printStackTrace();
+        };
+    }
+
+    public TokenizedMyProxyAuthInfo(RequestData requestData) {
+           this.requestData = requestData;
+           try {
+               properties.setProperty(X509_CERT_DIR, ServerSettings.getSetting(Constants.TRUSTED_CERT_LOCATION));
+           } catch (ApplicationSettingsException e) {
+               e.printStackTrace();
+           };
+       }
+
+    public GSSCredential getCredentials() throws SecurityException {
+
+        if (gssCredentials == null) {
+
+            try {
+                gssCredentials = getCredentialsFromStore();
+            } catch (Exception e) {
+                log.error("An exception occurred while retrieving credentials from the credential store. " +
+                        "Will continue with my proxy user name and password. Provided TokenId:" + requestData.getTokenId(), e);
+            }
+
+            if (gssCredentials == null) {
+                System.out.println("Authenticating with provided token failed, so falling back to authenticate with defaultCredentials");
+                try {
+                    gssCredentials = getDefaultCredentials();
+                } catch (Exception e) {
+                    throw new SecurityException("Error retrieving my proxy using username password");
+                }
+            }
+            // if still null, throw an exception
+            if (gssCredentials == null) {
+                throw new SecurityException("Unable to retrieve my proxy credentials to continue operation.");
+            }
+        } else {
+            try {
+                if (gssCredentials.getRemainingLifetime() < CREDENTIAL_RENEWING_THRESH_HOLD) {
+                    try {
+                        return renewCredentials();
+                    } catch (Exception e) {
+                        throw new SecurityException("Error renewing credentials", e);
+                    }
+                }
+            } catch (GSSException e) {
+                throw new SecurityException("Unable to retrieve remaining life time from credentials.", e);
+            }
+        }
+
+        return gssCredentials;
+    }
+
+
+    /**
+     * Reads the credentials from credential store.
+     *
+     * @return If token is found in the credential store, will return a valid credential. Else returns null.
+     * @throws Exception If an error occurred while retrieving credentials.
+     */
+    public GSSCredential getCredentialsFromStore() throws Exception {
+
+        if (getCredentialReader() == null) {
+            setCredentialReader(Utility.getCredentialReader());
+        }
+
+        Credential credential = getCredentialReader().getCredential(getRequestData().getGatewayId(),
+                getRequestData().getTokenId());
+
+        if (credential != null) {
+            if (credential instanceof CertificateCredential) {
+
+                log.info("Successfully found credentials for token id - " + getRequestData().getTokenId() +
+                        " gateway id - " + getRequestData().getGatewayId());
+
+                CertificateCredential certificateCredential = (CertificateCredential) credential;
+
+                X509Certificate[] certificates = certificateCredential.getCertificates();
+                X509Credential newCredential = new X509Credential(certificateCredential.getPrivateKey(), certificates);
+
+                GlobusGSSCredentialImpl cred = new GlobusGSSCredentialImpl(newCredential, GSSCredential.INITIATE_AND_ACCEPT);
+                System.out.print(cred.export(ExtendedGSSCredential.IMPEXP_OPAQUE));
+                return cred;
+                //return new GlobusGSSCredentialImpl(newCredential,
+                //        GSSCredential.INITIATE_AND_ACCEPT);
+            } else {
+                log.info("Credential type is not CertificateCredential. Cannot create mapping globus credentials. " +
+                        "Credential type - " + credential.getClass().getName());
+            }
+        } else {
+            log.info("Could not find credentials for token - " + getRequestData().getTokenId() + " and "
+                    + "gateway id - " + getRequestData().getGatewayId());
+        }
+
+        return null;
+    }
+
+    /**
+     * Renew GSSCredentials.
+     * Before executing we need to add current host as a trusted renewer. Note to renew credentials
+     * we dont need user name and password.
+     * To do that execute following command
+     * > myproxy-logon -t <LIFETIME></LIFETIME> -s <MY PROXY SERVER> -l <USER NAME>
+     * E.g :- > myproxy-logon -t 264 -s myproxy.teragrid.org -l us3
+     * Enter MyProxy pass phrase:
+     * A credential has been received for user us3 in /tmp/x509up_u501.
+     * > myproxy-init -A --cert /tmp/x509up_u501 --key /tmp/x509up_u501 -l ogce -s myproxy.teragrid.org
+     *
+     * @return Renewed credentials.
+     * @throws org.apache.airavata.common.exception.ApplicationSettingsException
+     */
+    public GSSCredential renewCredentialsAsATrustedHost() throws ApplicationSettingsException, MyProxyException {
+        MyProxy myproxy = new MyProxy(getRequestData().getMyProxyServerUrl(), getRequestData().getMyProxyPort());
+        GetParams getParams = new GetParams();
+        getParams.setAuthzCreds(gssCredentials);
+        getParams.setUserName(getRequestData().getMyProxyUserName());
+        getParams.setLifetime(getRequestData().getMyProxyLifeTime());
+        return myproxy.get(gssCredentials, getParams);
+    }
+
+
+    /**
+     * Gets the default proxy certificate.
+     *
+     * @return Default my proxy credentials.
+     * @throws org.apache.airavata.common.exception.ApplicationSettingsException
+     */
+    public GSSCredential getDefaultCredentials() throws ApplicationSettingsException, MyProxyException {
+        MyProxy myproxy = new MyProxy(getRequestData().getMyProxyServerUrl(), getRequestData().getMyProxyPort());
+            return myproxy.get(getRequestData().getMyProxyUserName(), getRequestData().getMyProxyPassword(),
+                    getRequestData().getMyProxyLifeTime());
+
+    }
+
+
+    /**
+     * Renews credentials. First try to renew credentials as a trusted renewer. If that failed
+     * use user name and password to renew credentials.
+     *
+     * @return Renewed credentials.
+     * @throws org.apache.airavata.common.exception.ApplicationSettingsException
+     */
+    public GSSCredential renewCredentials() throws ApplicationSettingsException, MyProxyException {
+
+        // First try to renew credentials as a trusted renewer
+        try {
+            gssCredentials = renewCredentialsAsATrustedHost();
+        } catch (Exception e) {
+            log.warn("Renewing credentials as a trusted renewer failed", e);
+            gssCredentials = getProxyCredentials();
+        }
+
+        return gssCredentials;
+    }
+
+    /**
+     * Gets a new proxy certificate given current credentials.
+     *
+     * @return The short lived GSSCredentials
+     * @throws org.apache.airavata.common.exception.ApplicationSettingsException
+     */
+    public GSSCredential getProxyCredentials() throws ApplicationSettingsException, MyProxyException {
+
+        MyProxy myproxy = new MyProxy(getRequestData().getMyProxyServerUrl(), getRequestData().getMyProxyPort());
+        return myproxy.get(gssCredentials, getRequestData().getMyProxyUserName(), getRequestData().getMyProxyPassword(),
+                getRequestData().getMyProxyLifeTime());
+    }
+
+    public void setGssCredentials(GSSCredential gssCredentials) {
+        this.gssCredentials = gssCredentials;
+    }
+
+    public CredentialReader getCredentialReader() {
+        return credentialReader;
+    }
+
+    public void setCredentialReader(CredentialReader credentialReader) {
+        this.credentialReader = credentialReader;
+    }
+
+    public RequestData getRequestData() {
+        return requestData;
+    }
+
+    public void setRequestData(RequestData requestData) {
+        this.requestData = requestData;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/Utility.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/Utility.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/Utility.java
index b4f7455..83be9df 100644
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/Utility.java
+++ b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/util/Utility.java
@@ -21,6 +21,12 @@
 
 package org.apache.airavata.credential.store.util;
 
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.credential.store.store.CredentialReader;
+import org.apache.airavata.credential.store.store.impl.CredentialReaderImpl;
+
 import java.io.FileInputStream;
 import java.security.KeyStore;
 import java.security.KeyStoreException;
@@ -75,4 +81,15 @@ public class Utility {
         return new char[0];
     }
 
+
+    public static CredentialReader getCredentialReader()
+            throws ApplicationSettingsException, IllegalAccessException,
+            ClassNotFoundException, InstantiationException {
+        String jdbcUrl = ServerSettings.getCredentialStoreDBURL();
+        String jdbcUsr = ServerSettings.getCredentialStoreDBUser();
+        String jdbcPass = ServerSettings.getCredentialStoreDBPassword();
+        String driver = ServerSettings.getCredentialStoreDBDriver();
+        return new CredentialReaderImpl(new DBUtil(jdbcUrl, jdbcUsr, jdbcPass,
+                driver));
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/security/GSISecurityContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/security/GSISecurityContext.java b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/security/GSISecurityContext.java
index 22d2e13..94c0549 100644
--- a/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/security/GSISecurityContext.java
+++ b/modules/gfac/gfac-bes/src/main/java/org/apache/airavata/gfac/bes/security/GSISecurityContext.java
@@ -21,14 +21,14 @@
 package org.apache.airavata.gfac.bes.security;
 
 import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.Constants;
 import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.credential.store.credential.Credential;
 import org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential;
 import org.apache.airavata.credential.store.store.CredentialReader;
 import org.apache.airavata.gfac.AbstractSecurityContext;
-import org.apache.airavata.gfac.Constants;
 import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.RequestData;
+import org.apache.airavata.common.utils.RequestData;
 import org.apache.airavata.gsi.ssh.api.Cluster;
 import org.globus.gsi.X509Credential;
 import org.globus.gsi.gssapi.GlobusGSSCredentialImpl;

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/AbstractSecurityContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/AbstractSecurityContext.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/AbstractSecurityContext.java
index 33b7846..ccd932f 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/AbstractSecurityContext.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/AbstractSecurityContext.java
@@ -27,8 +27,8 @@ package org.apache.airavata.gfac;
  * Time: 4:33 PM
  */
 
+import org.apache.airavata.common.utils.RequestData;
 import org.apache.airavata.credential.store.store.CredentialReader;
-import org.apache.airavata.gfac.SecurityContext;
 
 /**
  * Abstract implementation of the security context.

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Constants.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Constants.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Constants.java
index b9ecdbe..da99517 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Constants.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Constants.java
@@ -55,13 +55,7 @@ public class Constants {
 	public static final int COMMAND_EXECUTION_TIMEOUT = 5;
 	public static final String EXECUTABLE_NAME = "run.sh";
 
-	public static final String TRUSTED_CERT_LOCATION = "trusted.cert.location";
-    public static final String TRUSTED_CERTIFICATE_SYSTEM_PROPERTY = "X509_CERT_DIR";
-    public static final String MYPROXY_SERVER = "myproxy.server";
-    public static final String MYPROXY_SERVER_PORT = "myproxy.port";
-    public static final String MYPROXY_USER = "myproxy.username";
-    public static final String MYPROXY_PASS = "myproxy.password";
-    public static final String MYPROXY_LIFE = "myproxy.life";
+
     /*
      * SSH properties
      */

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/RequestData.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/RequestData.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/RequestData.java
deleted file mode 100644
index 9f45ce6..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/RequestData.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.gfac;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 6/28/13
- * Time: 3:28 PM
- */
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-
-/**
- * Encapsulates GFac specific data that are coming in the request.
- */
-public class RequestData {
-
-    private static final int DEFAULT_LIFE_TIME = 3600;
-    private static final int DEFAULT_MY_PROXY_PORT = 7512;
-
-    private String tokenId;
-    private String requestUser;
-    private String gatewayId;
-
-    private String myProxyServerUrl = null;
-    private int myProxyPort = 0;
-    private String myProxyUserName = null;
-    private String myProxyPassword = null;
-    private int myProxyLifeTime = DEFAULT_LIFE_TIME;
-
-
-    public RequestData() {
-    }
-
-    public RequestData(String gatewayId) {
-        this.gatewayId = gatewayId;
-    }
-
-    public RequestData(String tokenId, String requestUser, String gatewayId) {
-        this.tokenId = tokenId;
-        this.requestUser = requestUser;
-        this.gatewayId = gatewayId;
-    }
-
-    public String getTokenId() {
-        return tokenId;
-    }
-
-    public void setTokenId(String tokenId) {
-        this.tokenId = tokenId;
-    }
-
-    public String getRequestUser() {
-        return requestUser;
-    }
-
-    public void setRequestUser(String requestUser) {
-        this.requestUser = requestUser;
-    }
-
-    public String getGatewayId() {
-        return gatewayId;
-    }
-
-    public void setGatewayId(String gatewayId) {
-        this.gatewayId = gatewayId;
-    }
-
-    public String getMyProxyServerUrl() throws ApplicationSettingsException {
-        if (myProxyServerUrl == null) {
-            myProxyServerUrl = ServerSettings.getSetting(Constants.MYPROXY_SERVER);
-        }
-        return myProxyServerUrl;
-    }
-
-    public void setMyProxyServerUrl(String myProxyServerUrl) {
-        this.myProxyServerUrl = myProxyServerUrl;
-    }
-
-    public int getMyProxyPort() {
-
-        if (myProxyPort == 0) {
-            String sPort = ServerSettings.getSetting(Constants.MYPROXY_SERVER_PORT, Integer.toString(DEFAULT_MY_PROXY_PORT));
-            myProxyPort = Integer.parseInt(sPort);
-        }
-
-        return myProxyPort;
-    }
-
-    public void setMyProxyPort(int myProxyPort) {
-        this.myProxyPort = myProxyPort;
-    }
-
-    public String getMyProxyUserName() throws ApplicationSettingsException {
-        if (myProxyUserName == null) {
-            myProxyUserName = ServerSettings.getSetting(Constants.MYPROXY_USER);
-        }
-
-        return myProxyUserName;
-    }
-
-    public void setMyProxyUserName(String myProxyUserName) {
-        this.myProxyUserName = myProxyUserName;
-    }
-
-    public String getMyProxyPassword() throws ApplicationSettingsException {
-
-        if (myProxyPassword == null) {
-            myProxyPassword = ServerSettings.getSetting(Constants.MYPROXY_PASS);
-        }
-
-        return myProxyPassword;
-    }
-
-    public int getMyProxyLifeTime() {
-        String life = ServerSettings.getSetting(Constants.MYPROXY_LIFE,Integer.toString(myProxyLifeTime));
-        myProxyLifeTime = Integer.parseInt(life);
-        return myProxyLifeTime;
-    }
-
-    public void setMyProxyLifeTime(int myProxyLifeTime) {
-        this.myProxyLifeTime = myProxyLifeTime;
-    }
-
-    public void setMyProxyPassword(String myProxyPassword) {
-        this.myProxyPassword = myProxyPassword;
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
index 1582f62..52e6c49 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
@@ -1204,15 +1204,5 @@ public class GFacUtils {
 		return null;
 	}
 
-	public static CredentialReader getCredentialReader()
-			throws ApplicationSettingsException, IllegalAccessException,
-			ClassNotFoundException, InstantiationException {
-		String jdbcUrl = ServerSettings.getCredentialStoreDBURL();
-		String jdbcUsr = ServerSettings.getCredentialStoreDBUser();
-		String jdbcPass = ServerSettings.getCredentialStoreDBPassword();
-		String driver = ServerSettings.getCredentialStoreDBDriver();
-		return new CredentialReaderImpl(new DBUtil(jdbcUrl, jdbcUsr, jdbcPass,
-				driver));
-	}
 
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/security/GSISecurityContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/security/GSISecurityContext.java b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/security/GSISecurityContext.java
index 395b797..72287d3 100644
--- a/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/security/GSISecurityContext.java
+++ b/modules/gfac/gfac-gram/src/main/java/org/apache/airavata/gfac/gram/security/GSISecurityContext.java
@@ -28,7 +28,7 @@ import org.apache.airavata.credential.store.store.CredentialReader;
 import org.apache.airavata.gfac.AbstractSecurityContext;
 import org.apache.airavata.gfac.Constants;
 import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.RequestData;
+import org.apache.airavata.common.utils.RequestData;
 import org.globus.gsi.X509Credential;
 import org.globus.gsi.gssapi.GlobusGSSCredentialImpl;
 import org.globus.gsi.provider.GlobusProvider;
@@ -79,13 +79,13 @@ public class GSISecurityContext extends AbstractSecurityContext {
             log.info("Current directory " + f.getAbsolutePath());
             throw new RuntimeException("Cannot read trusted certificate path " + trustedCertificatePath);
         } else {
-            System.setProperty(Constants.TRUSTED_CERTIFICATE_SYSTEM_PROPERTY, file.getAbsolutePath());
+            System.setProperty(org.apache.airavata.common.utils.Constants.TRUSTED_CERTIFICATE_SYSTEM_PROPERTY, file.getAbsolutePath());
         }
     }
 
     private static void setUpTrustedCertificatePath() throws ApplicationSettingsException {
 
-        String trustedCertificatePath  = ServerSettings.getSetting(Constants.TRUSTED_CERT_LOCATION);
+        String trustedCertificatePath  = ServerSettings.getSetting(org.apache.airavata.common.utils.Constants.TRUSTED_CERT_LOCATION);
 
         setUpTrustedCertificatePath(trustedCertificatePath);
     }
@@ -96,7 +96,7 @@ public class GSISecurityContext extends AbstractSecurityContext {
      * @return The trusted certificate path as a string.
      */
     public static String getTrustedCertificatePath() {
-        return System.getProperty(Constants.TRUSTED_CERTIFICATE_SYSTEM_PROPERTY);
+        return System.getProperty(org.apache.airavata.common.utils.Constants.TRUSTED_CERTIFICATE_SYSTEM_PROPERTY);
     }
 
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/9a138b54/modules/gfac/gfac-gram/src/test/java/org/apache/airavata/core/gfac/services/impl/GFacBaseTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gram/src/test/java/org/apache/airavata/core/gfac/services/impl/GFacBaseTestWithMyProxyAuth.java b/modules/gfac/gfac-gram/src/test/java/org/apache/airavata/core/gfac/services/impl/GFacBaseTestWithMyProxyAuth.java
index a5960d4..0741684 100644
--- a/modules/gfac/gfac-gram/src/test/java/org/apache/airavata/core/gfac/services/impl/GFacBaseTestWithMyProxyAuth.java
+++ b/modules/gfac/gfac-gram/src/test/java/org/apache/airavata/core/gfac/services/impl/GFacBaseTestWithMyProxyAuth.java
@@ -27,7 +27,7 @@ import org.apache.airavata.common.utils.DatabaseTestCases;
 import org.apache.airavata.common.utils.DerbyUtil;
 import org.apache.airavata.credential.store.store.CredentialReader;
 import org.apache.airavata.credential.store.store.impl.CredentialReaderImpl;
-import org.apache.airavata.gfac.RequestData;
+import org.apache.airavata.common.utils.RequestData;
 import org.apache.airavata.gfac.gram.security.GSISecurityContext;
 import org.apache.log4j.Logger;
 import org.junit.BeforeClass;