airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject [14/16] airavata git commit: merging gfac app catalog integration branch with master - AIRAVATA-1511
Date Tue, 11 Nov 2014 19:11:01 GMT
merging gfac app catalog integration branch with master - AIRAVATA-1511


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

Branch: refs/heads/gfac_appcatalog_int
Commit: 36938926632e490d0a64e14e13277f74fd41c4df
Parents: 4286c8c 0b867da
Author: Chathuri Wimalasena <kamalasini@gmail.com>
Authored: Tue Nov 11 11:14:09 2014 -0500
Committer: Chathuri Wimalasena <kamalasini@gmail.com>
Committed: Tue Nov 11 11:14:09 2014 -0500

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   |   72 +-
 .../java/org/apache/airavata/api/Airavata.java  |   58 +-
 .../main/resources/lib/airavata/Airavata.cpp    |    6 +-
 .../src/main/resources/lib/airavata/Airavata.h  |   16 +-
 .../lib/airavata/Airavata_server.skeleton.cpp   |    2 +-
 .../applicationInterfaceModel_types.cpp         |   10 +-
 .../airavata/applicationInterfaceModel_types.h  |    4 +-
 .../lib/airavata/computeResourceModel_types.cpp |  218 ++--
 .../lib/airavata/computeResourceModel_types.h   |   28 +-
 .../lib/airavata/experimentModel_types.cpp      |  521 ++++-----
 .../lib/airavata/experimentModel_types.h        |  124 +-
 .../gatewayResourceProfileModel_types.cpp       |   48 +-
 .../gatewayResourceProfileModel_types.h         |   19 +-
 .../lib/airavata/messagingEvents_types.cpp      |    6 +-
 .../lib/airavata/messagingEvents_types.h        |    9 +-
 .../resources/lib/Airavata/API/Airavata.php     |    4 +-
 .../Model/AppCatalog/AppInterface/Types.php     |    4 +
 .../Model/AppCatalog/ComputeResource/Types.php  |   29 +
 .../Model/AppCatalog/GatewayProfile/Types.php   |   20 +-
 .../Airavata/Model/Messaging/Event/Types.php    |    4 +-
 .../Model/Workspace/Experiment/Types.php        |  171 +--
 .../client/samples/CreateLaunchExperiment.java  |  260 +++--
 .../samples/CreateLaunchExperimentUS3.java      |  139 +--
 .../tools/RegisterSampleApplications.java       |    8 +-
 .../tools/RegisterSampleApplicationsUtils.java  |    3 +-
 .../model/appcatalog/appinterface/DataType.java |    8 +-
 .../appcatalog/computeresource/MonitorMode.java |   73 ++
 .../computeresource/SSHJobSubmission.java       |  121 +-
 .../ComputeResourcePreference.java              |   68 +-
 .../messaging/event/TaskOutputChangeEvent.java  |   40 +-
 .../workspace/experiment/DataObjectType.java    |  719 ------------
 .../model/workspace/experiment/DataType.java    |   71 --
 .../model/workspace/experiment/Experiment.java  |   76 +-
 .../model/workspace/experiment/TaskDetails.java |   76 +-
 .../experiment/WorkflowNodeDetails.java         |   76 +-
 .../model/util/ExperimentModelUtil.java         |   15 +-
 .../airavataAPI.thrift                          |    2 +-
 .../applicationInterfaceModel.thrift            |    4 +-
 .../computeResourceModel.thrift                 |   19 +-
 .../experimentModel.thrift                      |   32 +-
 .../gatewayResourceProfileModel.thrift          |    5 +-
 .../messagingEvents.thrift                      |    3 +-
 .../client/tools/DocumentCreatorUtils.java      |    4 +-
 .../data/impl/GwyResourceProfileImpl.java       |   19 +-
 .../data/util/AppCatalogThriftConversion.java   |    4 +-
 .../app/catalog/test/GatewayProfileTest.java    |    8 +-
 .../server/src/main/resources/gfac-config.xml   |    6 +-
 .../gfac/bes/handlers/AbstractSMSHandler.java   |   74 +-
 .../gfac/bes/provider/impl/BESProvider.java     |  378 +++---
 .../bes/security/UNICORESecurityContext.java    |    4 +-
 .../gfac/bes/utils/ApplicationProcessor.java    |  212 ++--
 .../org/apache/airavata/gfac/Constants.java     |    3 +
 .../org/apache/airavata/gfac/Scheduler.java     |  103 +-
 .../gfac/core/context/ApplicationContext.java   |   44 +-
 .../gfac/core/context/JobExecutionContext.java  |  185 ++-
 .../airavata/gfac/core/cpi/BetterGfacImpl.java  |  405 +++----
 .../handler/AbstractRecoverableHandler.java     |    4 +-
 .../core/handler/AppDescriptorCheckHandler.java |   56 +-
 .../airavata/gfac/core/monitor/MonitorID.java   |   20 +-
 .../gfac/core/provider/utils/ProviderUtils.java |   18 +-
 .../airavata/gfac/core/utils/GFacUtils.java     | 1101 ++++++++++--------
 .../airavata/gfac/core/utils/OutputUtils.java   |   72 +-
 .../apache/airavata/job/GFacConfigXmlTest.java  |   78 +-
 .../apache/airavata/gfac/ec2/EC2Provider.java   |   61 +-
 .../airavata/gfac/ec2/EC2ProviderTest.java      |  366 +++---
 .../gfac/gram/handler/GridFTPOutputHandler.java |    5 +-
 .../handler/GSISSHDirectorySetupHandler.java    |   11 +-
 .../gfac/gsissh/handler/GSISSHInputHandler.java |   86 +-
 .../gsissh/handler/GSISSHOutputHandler.java     |  116 +-
 .../gsissh/provider/impl/GSISSHProvider.java    |   77 +-
 .../gfac/gsissh/util/GFACGSISSHUtils.java       |  203 ++--
 .../impl/GSISSHProviderTestWithMyProxyAuth.java |  465 ++++----
 .../handler/LocalDirectorySetupHandler.java     |   19 +-
 .../gfac/local/provider/impl/LocalProvider.java |   54 +-
 .../gfac/local/utils/LocalProviderUtil.java     |   15 +-
 .../gfac/services/impl/LocalProviderTest.java   |  368 +++---
 .../airavata/gfac/monitor/HPCMonitorID.java     |   13 +-
 .../airavata/gfac/monitor/HostMonitorData.java  |   40 +-
 .../handlers/GridPullMonitorHandler.java        |    2 +-
 .../monitor/impl/pull/qstat/HPCPullMonitor.java |   28 +-
 .../impl/pull/qstat/ResourceConnection.java     |    6 +-
 .../monitor/impl/push/amqp/AMQPMonitor.java     |   57 +-
 .../airavata/gfac/monitor/util/CommonUtils.java |   32 +-
 .../apache/airavata/job/AMQPMonitorTest.java    |   64 +-
 .../job/QstatMonitorTestWithMyProxyAuth.java    |  344 +++---
 .../ssh/handler/AdvancedSCPOutputHandler.java   |   34 +-
 .../ssh/handler/SSHDirectorySetupHandler.java   |   11 +-
 .../gfac/ssh/handler/SSHInputHandler.java       |    5 +-
 .../gfac/ssh/handler/SSHOutputHandler.java      |  185 ++-
 .../gfac/ssh/provider/impl/SSHProvider.java     |   79 +-
 .../airavata/gfac/ssh/util/GFACSSHUtils.java    |  300 +++--
 .../services/impl/BigRed2TestWithSSHAuth.java   |  504 ++++----
 .../impl/SSHProviderTestWithSSHAuth.java        |  342 +++---
 modules/gfac/pom.xml                            |    6 +-
 .../apache/airavata/integration/BaseCaseIT.java |   49 +-
 .../airavata/integration/DataRetrievalIT.java   |   15 +-
 .../airavata/integration/SimpleEchoIT.java      |   23 +-
 .../integration/tools/DocumentCreatorUtils.java |    4 +-
 .../sample/OrchestratorClientSample.java        |   22 +-
 .../registry/jpa/impl/ExperimentRegistry.java   |  126 +-
 .../registry/jpa/impl/RegistryImpl.java         |   13 +-
 .../jpa/utils/ThriftDataModelConversion.java    |  101 +-
 .../engine/interpretor/WorkflowInterpreter.java |   81 +-
 .../ui/experiment/LaunchApplicationWindow.java  |   58 +-
 .../WorkflowInterpreterLaunchWindow.java        |   17 +-
 .../airavata/gsi/ssh/api/job/JobDescriptor.java |    7 +
 106 files changed, 4861 insertions(+), 5542 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
----------------------------------------------------------------------
diff --cc airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
index f039988,63fe5ad..2d7768b
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
@@@ -53,9 -56,9 +56,9 @@@ public class CreateLaunchExperiment 
      private static final String DEFAULT_GATEWAY = "default.registry.gateway";
      private static Airavata.Client airavataClient;
  
-     private static String echoAppId = "Echo_636b4530-6fb2-4c9e-998a-b41e648aa70f";
-     private static String wrfAppId = "WRF_d41bdc86-e280-4eb6-a045-708f69a8c116";
-     private static String amberAppId = "Amber_b23ee051-90d6-4892-827e-622a2f6c95ee";
 -    private static String echoAppId = "Echo_647ba0c5-64ef-4efe-9786-2d28f4d5acc9";
++    private static String echoAppId = "Echo_1869465f-f002-43a9-b243-c091f63ab059";
+     private static String wrfAppId = "WRF_a458df70-6808-4d5d-ae32-c49082f2a6cc";
+     private static String amberAppId = "Amber_1b99f73b-a88d-44e3-b04e-4f56ba95ed6f";
  
      private static String localHost = "localhost";
      private static String trestlesHostName = "trestles.sdsc.xsede.org";

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Constants.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
----------------------------------------------------------------------
diff --cc modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
index 1f84490,b2790c9..b2c40a7
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
@@@ -47,8 -47,7 +47,8 @@@ public class GSISSHDirectorySetupHandle
  
  	public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
          try {
-             String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
 -            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT) == null) {
++            String hostAddress = jobExecutionContext.getHostName();
 +            if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
                  GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
              }
          } catch (Exception e) {
@@@ -65,26 -64,24 +65,25 @@@
          makeDirectory(jobExecutionContext);
  	}
  	private void makeDirectory(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
 -		 Cluster cluster = null;
 -		try {
 -         cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
 -        if (cluster == null) {
 -        	 try {
 -  				GFacUtils.saveErrorDetails(jobExecutionContext, "Security context is not set properly", CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
 -  			} catch (GFacException e1) {
 -  				 log.error(e1.getLocalizedMessage());
 -  			}
 -            throw new GFacHandlerException("Security context is not set properly");
 -        } else {
 -            log.info("Successfully retrieved the Security Context");
 -        }
 +        Cluster cluster = null;
 +        try {
-             String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
++            String hostAddress = jobExecutionContext.getHostName();
 +            cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
 +            if (cluster == null) {
 +                try {
 +                    GFacUtils.saveErrorDetails(jobExecutionContext, "Security context is not set properly", CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
 +                } catch (GFacException e1) {
 +                    log.error(e1.getLocalizedMessage());
 +                }
 +                throw new GFacHandlerException("Security context is not set properly");
 +            } else {
 +                log.info("Successfully retrieved the Security Context");
 +            }
-         ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
  
-             String workingDirectory = app.getScratchWorkingDirectory();
+             String workingDirectory = jobExecutionContext.getWorkingDir();
              cluster.makeDirectory(workingDirectory);
-             cluster.makeDirectory(app.getInputDataDirectory());
-             cluster.makeDirectory(app.getOutputDataDirectory());
+             cluster.makeDirectory(jobExecutionContext.getInputDir());
+             cluster.makeDirectory(jobExecutionContext.getOutputDir());
              DataTransferDetails detail = new DataTransferDetails();
              TransferStatus status = new TransferStatus();
              status.setTransferState(TransferState.DIRECTORY_SETUP);

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
----------------------------------------------------------------------
diff --cc modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
index 01dc712,39f8df1..c297b2a
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
@@@ -67,12 -69,11 +69,12 @@@ public class GSISSHInputHandler extend
          Cluster cluster = null;
          
          try {
-             String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
 -        	if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT) != null) {
 -                cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
 -            } else {
 -                cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
++            String hostAddress = jobExecutionContext.getHostName();
 +            if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
 +                GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
              }
 +
 +            cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
              if (cluster == null) {
                  throw new GFacException("Security context is not set properly");
              } else {

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
----------------------------------------------------------------------
diff --cc modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
index eff0164,a25e66a..68273b8
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
@@@ -67,39 -61,9 +61,9 @@@ public class GSISSHOutputHandler extend
          int oldIndex = 0;
          List<String> oldFiles = new ArrayList<String>();
          StringBuffer data = new StringBuffer("|");
-         String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
-         if (jobExecutionContext.getApplicationContext().getHostDescription().getType() instanceof GsisshHostType) { // this is because we don't have the right jobexecution context
-             // so attempting to get it from the registry
-             if (Constants.PUSH.equals(((GsisshHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType()).getMonitorMode())) {
-                 log.warn("During the out handler chain jobExecution context came null, so trying to handler");
-                 ApplicationDescription applicationDeploymentDescription = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription();
-                 TaskDetails taskData = null;
-                 try {
-                     taskData = (TaskDetails) jobExecutionContext.getRegistry().get(RegistryModelType.TASK_DETAIL, jobExecutionContext.getTaskData().getTaskID());
-                 } catch (RegistryException e) {
-                     log.error("Error retrieving job details from Registry");
-                     throw new GFacHandlerException("Error retrieving job details from Registry", e);
-                 }
-                 JobDetails jobDetails = taskData.getJobDetailsList().get(0);
-                 String jobDescription = jobDetails.getJobDescription();
-                 if (jobDescription != null) {
-                     JobDescriptor jobDescriptor = null;
-                     try {
-                         jobDescriptor = JobDescriptor.fromXML(jobDescription);
-                     } catch (XmlException e1) {
-                         e1.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-                     }
-                     applicationDeploymentDescription.getType().setScratchWorkingDirectory(
-                             jobDescriptor.getJobDescriptorDocument().getJobDescriptor().getWorkingDirectory());
-                     applicationDeploymentDescription.getType().setInputDataDirectory(jobDescriptor.getInputDirectory());
-                     applicationDeploymentDescription.getType().setOutputDataDirectory(jobDescriptor.getOutputDirectory());
-                     applicationDeploymentDescription.getType().setStandardError(jobDescriptor.getJobDescriptorDocument().getJobDescriptor().getStandardErrorFile());
-                     applicationDeploymentDescription.getType().setStandardOutput(jobDescriptor.getJobDescriptorDocument().getJobDescriptor().getStandardOutFile());
-                 }
-             }
-         }
++        String hostAddress = jobExecutionContext.getHostName();
          try {
 -            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT) == null) {
 -
 +            if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
                  GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
              }
          }  catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
----------------------------------------------------------------------
diff --cc modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
index 87e0fb4,92a50e4..d26d31b
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
@@@ -61,8 -70,7 +70,8 @@@ public class GSISSHProvider extends Abs
      public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException {
          super.initialize(jobExecutionContext);
          try {
-             String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
 -            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT) == null) {
++            String hostAddress = jobExecutionContext.getHostName();
 +            if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
                  GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
              }
          } catch (ApplicationSettingsException e) {
@@@ -77,16 -85,20 +86,19 @@@
          log.info("Invoking GSISSH Provider Invoke ...");
          StringBuffer data = new StringBuffer();
          jobExecutionContext.getNotifier().publish(new StartExecutionEvent());
-         HostDescriptionType host = jobExecutionContext.getApplicationContext().
-                 getHostDescription().getType();
-         HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) jobExecutionContext.getApplicationContext().
-                 getApplicationDeploymentDescription().getType();
+         ComputeResourceDescription computeResourceDescription = jobExecutionContext.getApplicationContext()
+                 .getComputeResourceDescription();
+         ApplicationDeploymentDescription appDeployDesc = jobExecutionContext.getApplicationContext()
+                 .getApplicationDeploymentDescription();
          JobDetails jobDetails = new JobDetails();
          Cluster cluster = null;
-         
+ 
          try {
-             if (jobExecutionContext.getSecurityContext(host.getHostAddress()) != null) {
-                 cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(host.getHostAddress())).getPbsCluster();
+             AppCatalog appCatalog = AppCatalogFactory.getAppCatalog();
+             SSHJobSubmission sshJobSubmission = appCatalog.getComputeResource().getSSHJobSubmission(
+                     jobExecutionContext.getPreferredJobSubmissionInterface().getJobSubmissionInterfaceId());
 -
 -            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT) != null) {
 -                cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
++            if (jobExecutionContext.getSecurityContext(jobExecutionContext.getHostName()) != null) {
++                cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(jobExecutionContext.getHostName())).getPbsCluster();
              }
              if (cluster == null) {
                  throw new GFacProviderException("Security context is not set properly");
@@@ -209,15 -221,13 +221,14 @@@
      public void cancelJob(JobExecutionContext jobExecutionContext) throws GFacProviderException,GFacException {
          //To change body of implemented methods use File | Settings | File Templates.
          log.info("canceling the job status in GSISSHProvider!!!!!");
-         HostDescriptionType host = jobExecutionContext.getApplicationContext().
-                 getHostDescription().getType();
          JobDetails jobDetails = jobExecutionContext.getJobDetails();
++        String hostName = jobExecutionContext.getHostName();
          try {
              Cluster cluster = null;
-             if (jobExecutionContext.getSecurityContext(host.getHostAddress()) == null) {
 -            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT) == null) {
++            if (jobExecutionContext.getSecurityContext(hostName) == null) {
                  GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
              }
-             cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(host.getHostAddress())).getPbsCluster();
 -            cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
++            cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(hostName)).getPbsCluster();
              if (cluster == null) {
                  throw new GFacProviderException("Security context is not set properly");
              } else {
@@@ -256,8 -266,8 +267,9 @@@
      public void recover(JobExecutionContext jobExecutionContext) throws GFacProviderException,GFacException {
          // have to implement the logic to recover a gfac failure
          log.info("Invoking Recovering for the Experiment: " + jobExecutionContext.getExperimentID());
-         HostDescriptionType host = jobExecutionContext.getApplicationContext().
-                 getHostDescription().getType();
+         ComputeResourceDescription computeResourceDescription = jobExecutionContext.getApplicationContext()
+                 .getComputeResourceDescription();
++        String hostName = jobExecutionContext.getHostName();
          String jobId = "";
          String jobDesc = "";
          try {
@@@ -299,7 -309,7 +311,7 @@@
              jobDetails.setJobDescription(jobDesc);
              jobDetails.setJobID(jobId);
              jobExecutionContext.setJobDetails(jobDetails);
-             if (jobExecutionContext.getSecurityContext(host.getHostAddress()) == null) {
 -            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT) == null) {
++            if (jobExecutionContext.getSecurityContext(hostName) == null) {
                  try {
                      GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
                  } catch (ApplicationSettingsException e) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
----------------------------------------------------------------------
diff --cc modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
index 58efb56,3c2e839..45ef1b8
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
@@@ -160,10 -159,11 +159,11 @@@ public class GFACGSISSHUtils 
                          clusters.put(key, pbsClusters);
                      }
                  }
-             } catch (Exception e) {
-                 throw new GFacException("An error occurred while creating GSI security context", e);
+ 
 -                jobExecutionContext.addSecurityContext(Constants.GSI_SECURITY_CONTEXT, context);
++                jobExecutionContext.addSecurityContext(jobExecutionContext.getHostName(), context);
              }
-             jobExecutionContext.addSecurityContext(registeredHost.getType().getHostAddress(), context);
+         } catch (Exception e) {
+             throw new GFacException("An error occurred while creating GSI security context", e);
          }
      }
  

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
----------------------------------------------------------------------
diff --cc modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
index 3a15d39,c788ace..12b7ad9
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
@@@ -62,8 -63,7 +63,8 @@@ public class HPCMonitorID extends Monit
          this.authenticationInfo = authenticationInfo;
          if (this.authenticationInfo != null) {
              try {
-                 String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
 -                SecurityContext securityContext = jobExecutionContext.getSecurityContext(Constants.GSI_SECURITY_CONTEXT);
++                String hostAddress = jobExecutionContext.getHostName();
 +                SecurityContext securityContext = jobExecutionContext.getSecurityContext(hostAddress);
                  ServerInfo serverInfo = null;
                  if (securityContext != null) {
                      serverInfo = (((GSISecurityContext) securityContext).getPbsCluster()).getServerInfo();

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
----------------------------------------------------------------------
diff --cc modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
index 9f93dc6,feaaa2d..25113fd
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
@@@ -25,6 -25,6 +25,7 @@@ import org.apache.airavata.common.logge
  import org.apache.airavata.common.logger.AiravataLoggerFactory;
  import org.apache.airavata.common.utils.MonitorPublisher;
  import org.apache.airavata.common.utils.ServerSettings;
++import org.apache.airavata.gfac.monitor.util.CommonUtils;
  import org.apache.airavata.commons.gfac.type.HostDescription;
  import org.apache.airavata.gfac.core.cpi.GFac;
  import org.apache.airavata.gfac.core.monitor.MonitorID;

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
----------------------------------------------------------------------
diff --cc modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
index 121cc59,73c05b7..e7a081b
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
@@@ -49,13 -49,11 +49,13 @@@ public class ResourceConnection 
      public ResourceConnection(HostMonitorData hostMonitorData,AuthenticationInfo authInfo) throws SSHApiException {
          MonitorID monitorID = hostMonitorData.getMonitorIDs().get(0);
          try {
 -            GSISecurityContext securityContext = (GSISecurityContext) monitorID.getJobExecutionContext().getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT);
 +            GSISecurityContext securityContext = (GSISecurityContext)
-                     monitorID.getJobExecutionContext().getSecurityContext(monitorID.getHost().getType().getHostAddress());
++                    monitorID.getJobExecutionContext().getSecurityContext(monitorID.getComputeResourceDescription().getHostName());
              if(securityContext != null) {
                  cluster = (PBSCluster) securityContext.getPbsCluster();
              }else {
 -                SSHSecurityContext sshSecurityContext = (SSHSecurityContext) monitorID.getJobExecutionContext().getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT);
 +                SSHSecurityContext sshSecurityContext = (SSHSecurityContext)
-                         monitorID.getJobExecutionContext().getSecurityContext(monitorID.getHost().getType().getHostAddress());
++                        monitorID.getJobExecutionContext().getSecurityContext(monitorID.getComputeResourceDescription().getHostName());
                  cluster = (PBSCluster)sshSecurityContext.getPbsCluster();
              }
  
@@@ -70,8 -68,7 +70,8 @@@
      public ResourceConnection(HostMonitorData hostMonitorData) throws SSHApiException {
          MonitorID monitorID = hostMonitorData.getMonitorIDs().get(0);
          try {
 -            GSISecurityContext securityContext = (GSISecurityContext) monitorID.getJobExecutionContext().getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT);
 +            GSISecurityContext securityContext = (GSISecurityContext)
-                     monitorID.getJobExecutionContext().getSecurityContext(monitorID.getHost().getType().getHostAddress());
++                    monitorID.getJobExecutionContext().getSecurityContext(monitorID.getComputeResourceDescription().getHostName());
              cluster = (PBSCluster) securityContext.getPbsCluster();
  
              // we just use cluster configuration from the incoming request and construct a new cluster because for monitoring

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
----------------------------------------------------------------------
diff --cc modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
index 6152505,a503154..219db22
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
@@@ -148,7 -156,7 +156,6 @@@ public class CommonUtils 
  
      /**
       * This method doesn't have to be synchronized because it will be invoked by HPCPullMonitor which already synchronized
--     * @param queue
       * @param monitorID
       * @throws AiravataMonitorException
       */
@@@ -169,11 -180,15 +176,10 @@@
                                      // could be different, thats why we check the jobID
                                      iterator2.remove();
                                      logger.infoId(monitorID.getJobID(), "Removed the jobId: {} JobName: {} from monitoring last " +
-                                             "status:{}", monitorID.getJobID(),monitorID.getJobName(), monitorID.getStatus().toString());
+                                             "status:{}", monitorID.getJobID(), monitorID.getJobName(), monitorID.getStatus().toString());
                                      if (iHostMonitorID.getMonitorIDs().size() == 0) {
                                          iterator1.remove();
-                                         logger.debug("Removed host {} from monitoring queue", iHostMonitorID.getHost()
-                                                 .getType().getHostAddress());
+                                         logger.debug("Removed host {} from monitoring queue", iHostMonitorID.getComputeResourceDescription().getHostName());
 -                                        if (hostMonitorData.size() == 0) {
 -                                            // no useful data so we have to remove the element from the queue
 -                                            queue.remove(next);
 -                                            logger.debug("Removed user {} from monitoring.", next.getUserName());
 -                                        }
                                      }
                                      return;
                                  }

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
----------------------------------------------------------------------
diff --cc modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
index c0416f5,e46dfa5..caefe7a
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
@@@ -110,10 -107,22 +107,23 @@@ public class AdvancedSCPOutputHandler e
                      this.passPhrase);
          }
          try {
-             ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext()
-                     .getApplicationDeploymentDescription().getType();
-             String standardError = app.getStandardError();
-             String standardOutput = app.getStandardOutput();
 -            if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT) == null) {
++            String hostName = jobExecutionContext.getHostName();
++            if (jobExecutionContext.getSecurityContext(hostName) == null) {
+                 try {
+                     GFACSSHUtils.addSecurityContext(jobExecutionContext);
+                 } catch (ApplicationSettingsException e) {
+                     log.error(e.getMessage());
+                     try {
+          				GFacUtils.saveErrorDetails(jobExecutionContext, e.getLocalizedMessage(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
+          			} catch (GFacException e1) {
+          				 log.error(e1.getLocalizedMessage());
+          			}
+                     throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage());
+                 }
+             }
 -            pbsCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
++            pbsCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(hostName)).getPbsCluster();
+             String standardError = jobExecutionContext.getStandardError();
+             String standardOutput = jobExecutionContext.getStandardOutput();
              super.invoke(jobExecutionContext);
              // Server info
              if(jobExecutionContext.getTaskData().getAdvancedOutputDataHandling() != null && jobExecutionContext.getTaskData().getAdvancedOutputDataHandling().getOutputDataDir() != null){

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
----------------------------------------------------------------------
diff --cc modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
index 9dcdefe,f7cbcc0..1baed57
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
@@@ -46,8 -46,7 +46,8 @@@ public class SSHDirectorySetupHandler e
  
  	public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
          try {
-             String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
 -            if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT) == null) {
++            String hostAddress = jobExecutionContext.getHostName();
 +            if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
                  GFACSSHUtils.addSecurityContext(jobExecutionContext);
              }
          } catch (Exception e) {
@@@ -68,8 -67,7 +68,8 @@@
  	private void makeDirectory(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
  		Cluster cluster = null;
  		try{
-             String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
 -        cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
++            String hostAddress = jobExecutionContext.getHostName();
 +            cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
          if (cluster == null) {
              throw new GFacHandlerException("Security context is not set properly");
          } else {

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
----------------------------------------------------------------------
diff --cc modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
index c279378,b0367f3..dd27d6b
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
@@@ -66,8 -66,13 +66,8 @@@ public class SSHInputHandler extends Ab
          Cluster cluster = null;
          
          try {
-             String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
 -        	cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
 -            if (cluster == null) {
 -                throw new GFacException("Security context is not set properly");
 -            } else {
 -                log.info("Successfully retrieved the Security Context");
 -            }
 -            if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT) == null) {
++            String hostAddress = jobExecutionContext.getHostName();
 +            if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
                  try {
                      GFACSSHUtils.addSecurityContext(jobExecutionContext);
                  } catch (ApplicationSettingsException e) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
----------------------------------------------------------------------
diff --cc modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
index 0780084,94f667e..bf01aff
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
@@@ -58,40 -53,9 +53,9 @@@ public class SSHOutputHandler extends A
      private static final Logger log = LoggerFactory.getLogger(SSHOutputHandler.class);
  
      public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
-         if (jobExecutionContext.getApplicationContext().getHostDescription().getType() instanceof GsisshHostType) { // this is because we don't have the right jobexecution context
-             // so attempting to get it from the registry
-             if (Constants.PUSH.equals(((GsisshHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType()).getMonitorMode())) { // this is because we don't have the right jobexecution context
-                 // so attempting to get it from the registry
-                 log.warn("During the out handler chain jobExecution context came null, so trying to handler");
-                 ApplicationDescription applicationDeploymentDescription = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription();
-                 TaskDetails taskData = null;
-                 try {
-                     taskData = (TaskDetails) registry.get(RegistryModelType.TASK_DETAIL, jobExecutionContext.getTaskData().getTaskID());
-                 } catch (RegistryException e) {
-                     log.error("Error retrieving job details from Registry");
-                     throw new GFacHandlerException("Error retrieving job details from Registry", e);
-                 }
-                 JobDetails jobDetails = taskData.getJobDetailsList().get(0);
-                 String jobDescription = jobDetails.getJobDescription();
-                 if (jobDescription != null) {
-                     JobDescriptor jobDescriptor = null;
-                     try {
-                         jobDescriptor = JobDescriptor.fromXML(jobDescription);
-                     } catch (XmlException e1) {
-                         e1.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-                     }
-                     applicationDeploymentDescription.getType().setScratchWorkingDirectory(
-                             jobDescriptor.getJobDescriptorDocument().getJobDescriptor().getWorkingDirectory());
-                     applicationDeploymentDescription.getType().setInputDataDirectory(jobDescriptor.getInputDirectory());
-                     applicationDeploymentDescription.getType().setOutputDataDirectory(jobDescriptor.getOutputDirectory());
-                     applicationDeploymentDescription.getType().setStandardError(jobDescriptor.getJobDescriptorDocument().getJobDescriptor().getStandardErrorFile());
-                     applicationDeploymentDescription.getType().setStandardOutput(jobDescriptor.getJobDescriptorDocument().getJobDescriptor().getStandardOutFile());
-                 }
-             }
-         }
-         String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
++        String hostAddress = jobExecutionContext.getHostName();
          try {
 -            if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT) == null) {
 -
 +            if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
                  GFACSSHUtils.addSecurityContext(jobExecutionContext);
              }
          } catch (Exception e) {
@@@ -108,11 -72,9 +72,9 @@@
          DataTransferDetails detail = new DataTransferDetails();
          TransferStatus status = new TransferStatus();
  
-         ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext()
-                 .getApplicationDeploymentDescription().getType();
          Cluster cluster = null;
          try {
 -            cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
 +             cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
              if (cluster == null) {
                  throw new GFacProviderException("Security context is not set properly");
              } else {

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
----------------------------------------------------------------------
diff --cc modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
index 8e46d1b,573ddf0..ff2267c
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
@@@ -76,8 -78,7 +78,8 @@@ public class SSHProvider extends Abstra
  
      public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException {
          super.initialize(jobExecutionContext);
-         String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
 -        if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT) == null) {
++        String hostAddress = jobExecutionContext.getHostName();
 +        if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
              try {
                  GFACSSHUtils.addSecurityContext(jobExecutionContext);
              } catch (ApplicationSettingsException e) {
@@@ -87,12 -88,12 +89,12 @@@
          }
          taskID = jobExecutionContext.getTaskData().getTaskID();
  
-         if (!((SSHHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType()).getHpcResource()) {
-             jobID = "SSH_" + jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress() + "_" + Calendar.getInstance().getTimeInMillis();
+         JobSubmissionProtocol preferredJobSubmissionProtocol = jobExecutionContext.getPreferredJobSubmissionProtocol();
+         if (preferredJobSubmissionProtocol == JobSubmissionProtocol.SSH) {
+             jobID = "SSH_" + jobExecutionContext.getHostName() + "_" + Calendar.getInstance().getTimeInMillis();
 -            cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
 +            cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
  
-             ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
-             String remoteFile = app.getStaticWorkingDirectory() + File.separatorChar + Constants.EXECUTABLE_NAME;
+             String remoteFile = jobExecutionContext.getWorkingDir() + File.separatorChar + Constants.EXECUTABLE_NAME;
              details.setJobID(taskID);
              details.setJobDescription(remoteFile);
              jobExecutionContext.setJobDetails(details);
@@@ -140,17 -140,12 +141,14 @@@
          } else {
              try {
                  jobExecutionContext.getNotifier().publish(new StartExecutionEvent());
-                 HostDescriptionType host = jobExecutionContext.getApplicationContext().
-                         getHostDescription().getType();
-                 HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) jobExecutionContext.getApplicationContext().
-                         getApplicationDeploymentDescription().getType();
                  JobDetails jobDetails = new JobDetails();
++                String hostAddress = jobExecutionContext.getHostName();
                  try {
                      Cluster cluster = null;
-                     if (jobExecutionContext.getSecurityContext(host.getHostAddress()) == null) {
 -                    if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT) != null) {
 -                        cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
++                    if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
 +                        GFACSSHUtils.addSecurityContext(jobExecutionContext);
                      }
-                     cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(host.getHostAddress())).getPbsCluster();
++                    cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
                      if (cluster == null) {
                          throw new GFacProviderException("Security context is not set properly");
                      } else {
@@@ -201,13 -196,11 +199,12 @@@
  
      public void cancelJob(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException {
          JobDetails jobDetails = jobExecutionContext.getJobDetails();
-         HostDescriptionType host = jobExecutionContext.getApplicationContext().
-                 getHostDescription().getType();
          StringBuffer data = new StringBuffer();
++        String hostAddress = jobExecutionContext.getHostName();
          if (!hpcType) {
              throw new NotImplementedException();
          } else {
-             Cluster cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(host.getHostAddress())).getPbsCluster();
 -            Cluster cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
++            Cluster cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
              if (cluster == null) {
                  throw new GFacProviderException("Security context is not set properly");
              } else {

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
----------------------------------------------------------------------
diff --cc modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
index c756026,f726024..05cdf31
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
@@@ -72,77 -73,84 +73,84 @@@ public class GFACSSHUtils 
       * @throws ApplicationSettingsException
       */
      public static void addSecurityContext(JobExecutionContext jobExecutionContext) throws GFacException, ApplicationSettingsException {
-         HostDescription registeredHost = jobExecutionContext.getApplicationContext().getHostDescription();
-         if (registeredHost.getType() instanceof GlobusHostType || registeredHost.getType() instanceof UnicoreHostType) {
+         JobSubmissionProtocol preferredJobSubmissionProtocol = jobExecutionContext.getPreferredJobSubmissionProtocol();
+         JobSubmissionInterface preferredJobSubmissionInterface = jobExecutionContext.getPreferredJobSubmissionInterface();
+         if (preferredJobSubmissionProtocol == JobSubmissionProtocol.GLOBUS || preferredJobSubmissionProtocol == JobSubmissionProtocol.UNICORE) {
              logger.error("This is a wrong method to invoke to non ssh host types,please check your gfac-config.xml");
-         } else if (registeredHost.getType() instanceof SSHHostType
-                 || registeredHost.getType() instanceof GsisshHostType) {
-             SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
-             String credentialStoreToken = jobExecutionContext.getCredentialStoreToken(); // this is set by the framework
-             RequestData requestData = new RequestData(ServerSettings.getDefaultUserGateway());
-             requestData.setTokenId(credentialStoreToken);
- 
-             ServerInfo serverInfo = new ServerInfo(null, registeredHost.getType().getHostAddress());
-             Cluster pbsCluster = null;
+         } else if (preferredJobSubmissionProtocol == JobSubmissionProtocol.SSH) {
              try {
-                 TokenizedSSHAuthInfo tokenizedSSHAuthInfo = new TokenizedSSHAuthInfo(requestData);
-                 String installedParentPath = ((HpcApplicationDeploymentType)
-                         jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType()).getInstalledParentPath();
-                 if (installedParentPath == null) {
-                     installedParentPath = "/";
-                 }
+                 AppCatalog appCatalog = AppCatalogFactory.getAppCatalog();
+                 SSHJobSubmission sshJobSubmission = appCatalog.getComputeResource().getSSHJobSubmission(preferredJobSubmissionInterface.getJobSubmissionInterfaceId());
+                 if (sshJobSubmission.getSecurityProtocol() == SecurityProtocol.GSI) {
+                     SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
+                     String credentialStoreToken = jobExecutionContext.getCredentialStoreToken(); // this is set by the framework
+                     RequestData requestData = new RequestData(ServerSettings.getDefaultUserGateway());
+                     requestData.setTokenId(credentialStoreToken);
  
-                 SSHCredential credentials = tokenizedSSHAuthInfo.getCredentials();// this is just a call to get and set credentials in to this object,data will be used
-                 serverInfo.setUserName(credentials.getPortalUserName());
-                 jobExecutionContext.getExperiment().setUserName(credentials.getPortalUserName());
-                 // inside the pbsCluser object
+                     ServerInfo serverInfo = new ServerInfo(null, jobExecutionContext.getHostName());
  
-                 String key = credentials.getPortalUserName() + registeredHost.getType().getHostAddress() +
-                         serverInfo.getPort();
-                 boolean recreate = false;
-                 synchronized (clusters) {
-                     if (clusters.containsKey(key) && clusters.get(key).size() < maxClusterCount) {
-                         recreate = true;
-                     } else if (clusters.containsKey(key)) {
-                         int i = new Random().nextInt(Integer.MAX_VALUE) % maxClusterCount;
-                         if (clusters.get(key).get(i).getSession().isConnected()) {
-                             pbsCluster = clusters.get(key).get(i);
-                         } else {
-                             clusters.get(key).remove(i);
-                             recreate = true;
+                     Cluster pbsCluster = null;
+                     try {
+                         TokenizedSSHAuthInfo tokenizedSSHAuthInfo = new TokenizedSSHAuthInfo(requestData);
+                         String installedParentPath = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getExecutablePath();
+                         if (installedParentPath == null) {
+                             installedParentPath = "/";
                          }
-                         if (!recreate) {
-                             try {
-                                 pbsCluster.listDirectory("~/"); // its hard to trust isConnected method, so we try to connect if it works we are good,else we recreate
-                             } catch (Exception e) {
-                                 clusters.get(key).remove(i);
-                                 logger.info("Connection found the connection map is expired, so we create from the scratch");
-                                 maxClusterCount++;
-                                 recreate = true; // we make the pbsCluster to create again if there is any exception druing connection
+ 
+                         SSHCredential credentials = tokenizedSSHAuthInfo.getCredentials();// this is just a call to get and set credentials in to this object,data will be used
+                         serverInfo.setUserName(credentials.getPortalUserName());
+                         jobExecutionContext.getExperiment().setUserName(credentials.getPortalUserName());
+                         // inside the pbsCluser object
+ 
+                         String key = credentials.getPortalUserName() + jobExecutionContext.getHostName() + serverInfo.getPort();
+                         boolean recreate = false;
+                         synchronized (clusters) {
+                             if (clusters.containsKey(key) && clusters.get(key).size() < maxClusterCount) {
+                                 recreate = true;
+                             } else if (clusters.containsKey(key)) {
+                                 int i = new Random().nextInt(Integer.MAX_VALUE) % maxClusterCount;
+                                 if (clusters.get(key).get(i).getSession().isConnected()) {
+                                     pbsCluster = clusters.get(key).get(i);
+                                 } else {
+                                     clusters.get(key).remove(i);
+                                     recreate = true;
+                                 }
+                                 if (!recreate) {
+                                     try {
+                                         pbsCluster.listDirectory("~/"); // its hard to trust isConnected method, so we try to connect if it works we are good,else we recreate
+                                     } catch (Exception e) {
+                                         clusters.get(key).remove(i);
+                                         logger.info("Connection found the connection map is expired, so we create from the scratch");
+                                         maxClusterCount++;
+                                         recreate = true; // we make the pbsCluster to create again if there is any exception druing connection
+                                     }
+                                 }
+                                 logger.info("Re-using the same connection used with the connection string:" + key);
+                             } else {
+                                 recreate = true;
+                             }
+                             if (recreate) {
+                                 pbsCluster = new PBSCluster(serverInfo, tokenizedSSHAuthInfo,
+                                         CommonUtils.getPBSJobManager(installedParentPath));
+                                 List<Cluster> pbsClusters = null;
+                                 if (!(clusters.containsKey(key))) {
+                                     pbsClusters = new ArrayList<Cluster>();
+                                 } else {
+                                     pbsClusters = clusters.get(key);
+                                 }
+                                 pbsClusters.add(pbsCluster);
+                                 clusters.put(key, pbsClusters);
                              }
                          }
-                         logger.info("Re-using the same connection used with the connection string:" + key);
-                     } else {
-                         recreate = true;
-                     }
-                     if (recreate) {
-                         pbsCluster = new PBSCluster(serverInfo, tokenizedSSHAuthInfo,
-                                     CommonUtils.getPBSJobManager(installedParentPath));
-                         List<Cluster> pbsClusters = null;
-                         if (!(clusters.containsKey(key))) {
-                             pbsClusters = new ArrayList<Cluster>();
-                         } else {
-                             pbsClusters = clusters.get(key);
-                         }
-                         pbsClusters.add(pbsCluster);
-                         clusters.put(key, pbsClusters);
+                     } catch (Exception e) {
+                         throw new GFacException("Error occurred...", e);
                      }
+                     sshSecurityContext.setPbsCluster(pbsCluster);
 -                    jobExecutionContext.addSecurityContext(Constants.SSH_SECURITY_CONTEXT, sshSecurityContext);
++                    jobExecutionContext.addSecurityContext(jobExecutionContext.getHostName(), sshSecurityContext);
                  }
-             } catch (Exception e) {
-                 e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+             } catch (AppCatalogException e) {
+                 throw new GFacException("Error while getting SSH Submission object from app catalog", e);
              }
-             sshSecurityContext.setPbsCluster(pbsCluster);
-             jobExecutionContext.addSecurityContext(registeredHost.getType().getHostAddress(), sshSecurityContext);
          }
      }
  
@@@ -154,61 -162,61 +162,61 @@@
       * @throws ApplicationSettingsException
       */
      public static void addSecurityContext(JobExecutionContext jobExecutionContext,SSHAuthWrapper sshAuth) throws GFacException, ApplicationSettingsException {
-             try {
-                 if(sshAuth== null) {
-                     throw new GFacException("Error adding security Context, because sshAuthWrapper is null");
-                 }
-                 SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
-                 Cluster pbsCluster = null;
-                 String key=sshAuth.getKey();
-                 boolean recreate = false;
-                 synchronized (clusters) {
-                     if (clusters.containsKey(key) && clusters.get(key).size() < maxClusterCount) {
-                         recreate = true;
-                     } else if (clusters.containsKey(key)) {
-                         int i = new Random().nextInt(Integer.MAX_VALUE) % maxClusterCount;
-                         if (clusters.get(key).get(i).getSession().isConnected()) {
-                             pbsCluster = clusters.get(key).get(i);
-                         } else {
-                             clusters.get(key).remove(i);
-                             recreate = true;
-                         }
-                         if (!recreate) {
-                             try {
-                                 pbsCluster.listDirectory("~/"); // its hard to trust isConnected method, so we try to connect if it works we are good,else we recreate
-                             } catch (Exception e) {
-                                 clusters.get(key).remove(i);
-                                 logger.info("Connection found the connection map is expired, so we create from the scratch");
-                                 maxClusterCount++;
-                                 recreate = true; // we make the pbsCluster to create again if there is any exception druing connection
-                             }
-                         }
-                         logger.info("Re-using the same connection used with the connection string:" + key);
+         try {
+             if(sshAuth== null) {
+                 throw new GFacException("Error adding security Context, because sshAuthWrapper is null");
+             }
+             SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
+             Cluster pbsCluster = null;
+             String key=sshAuth.getKey();
+             boolean recreate = false;
+             synchronized (clusters) {
+                 if (clusters.containsKey(key) && clusters.get(key).size() < maxClusterCount) {
+                     recreate = true;
+                 } else if (clusters.containsKey(key)) {
+                     int i = new Random().nextInt(Integer.MAX_VALUE) % maxClusterCount;
+                     if (clusters.get(key).get(i).getSession().isConnected()) {
+                         pbsCluster = clusters.get(key).get(i);
                      } else {
+                         clusters.get(key).remove(i);
                          recreate = true;
                      }
-                     if (recreate) {
-                         pbsCluster = new PBSCluster(sshAuth.getServerInfo(), sshAuth.getAuthenticationInfo(),null);
-                         key = sshAuth.getKey();
-                         List<Cluster> pbsClusters = null;
-                         if (!(clusters.containsKey(key))) {
-                             pbsClusters = new ArrayList<Cluster>();
-                         } else {
-                             pbsClusters = clusters.get(key);
+                     if (!recreate) {
+                         try {
+                             pbsCluster.listDirectory("~/"); // its hard to trust isConnected method, so we try to connect if it works we are good,else we recreate
+                         } catch (Exception e) {
+                             clusters.get(key).remove(i);
+                             logger.info("Connection found the connection map is expired, so we create from the scratch");
+                             maxClusterCount++;
+                             recreate = true; // we make the pbsCluster to create again if there is any exception druing connection
                          }
-                         pbsClusters.add(pbsCluster);
-                         clusters.put(key, pbsClusters);
                      }
+                     logger.info("Re-using the same connection used with the connection string:" + key);
+                 } else {
+                     recreate = true;
+                 }
+                 if (recreate) {
+                     pbsCluster = new PBSCluster(sshAuth.getServerInfo(), sshAuth.getAuthenticationInfo(),null);
+                     key = sshAuth.getKey();
+                     List<Cluster> pbsClusters = null;
+                     if (!(clusters.containsKey(key))) {
+                         pbsClusters = new ArrayList<Cluster>();
+                     } else {
+                         pbsClusters = clusters.get(key);
+                     }
+                     pbsClusters.add(pbsCluster);
+                     clusters.put(key, pbsClusters);
                  }
-                 sshSecurityContext.setPbsCluster(pbsCluster);
-                 jobExecutionContext.addSecurityContext(key, sshSecurityContext);
-             } catch (Exception e) {
-                 e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
              }
+             sshSecurityContext.setPbsCluster(pbsCluster);
 -            jobExecutionContext.addSecurityContext(Constants.SSH_SECURITY_CONTEXT+key, sshSecurityContext);
++            jobExecutionContext.addSecurityContext(key, sshSecurityContext);
+         } catch (Exception e) {
+             e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+         }
      }
  
-     public static JobDescriptor createJobDescriptor(JobExecutionContext jobExecutionContext,
-                                                     ApplicationDeploymentDescriptionType app, Cluster cluster) {
+ 
+     public static JobDescriptor createJobDescriptor(JobExecutionContext jobExecutionContext, Cluster cluster) {
          JobDescriptor jobDescriptor = new JobDescriptor();
          // this is common for any application descriptor
          jobDescriptor.setCallBackIp(ServerSettings.getIp());

http://git-wip-us.apache.org/repos/asf/airavata/blob/36938926/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/WorkflowInterpreterLaunchWindow.java
----------------------------------------------------------------------


Mime
View raw message