Author: heshan
Date: Tue Apr 2 00:26:37 2013
New Revision: 1463340
URL: http://svn.apache.org/r1463340
Log:
AIRAVATA-803 Extracted a method.
Modified:
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java
Modified:
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java
URL:
http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java?rev=1463340&r1=1463339&r2=1463340&view=diff
==============================================================================
---
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java
(original)
+++
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java
Tue Apr 2 00:26:37 2013
@@ -226,47 +226,36 @@ public class EC2Provider implements GFac
if(appDesc.getType() instanceof Ec2ApplicationDeploymentType) {
Ec2ApplicationDeploymentType type = (Ec2ApplicationDeploymentType)
appDesc.getType();
-
if(type.getExecutable() != null) {
command = type.getExecutableType() + " " +
type.getExecutable();
} else {
command = "sh" + " " + type.getExecutable();
}
-
- List<String> inputParams = null;
- try {
- inputParams =
ProviderUtils.getInputParameters(jobExecutionContext);
- } catch (GFacProviderException e) {
- throw new GFacProviderException("Error in extracting input
values from JobExecutionContext");
- }
-
- for(String param : inputParams){
- command = " " + command + " " + param;
- }
-
- log.info("Command to be executed on EC2 : " + command);
+ command = setCmdParams(jobExecutionContext, command);
} else {
ApplicationDeploymentDescriptionType type = appDesc.getType();
-
command = "sh" + " " + type.getExecutableLocation();
+ command = setCmdParams(jobExecutionContext, command);
+ }
- List<String> inputParams = null;
- try {
- inputParams =
ProviderUtils.getInputParameters(jobExecutionContext);
- } catch (GFacProviderException e) {
- throw new GFacProviderException("Error in extracting input
values from JobExecutionContext");
- }
-
- for(String param : inputParams){
- command = " " + command + " " + param;
- }
+ return command + '\n';
+ }
- log.info("Command to be executed on EC2 : " + command);
+ private String setCmdParams(JobExecutionContext jobExecutionContext,
String command) throws GFacProviderException {
+ List<String> inputParams = null;
+ try {
+ inputParams =
ProviderUtils.getInputParameters(jobExecutionContext);
+ } catch (GFacProviderException e) {
+ throw new GFacProviderException("Error in extracting input values
from JobExecutionContext");
+ }
+ for(String param : inputParams){
+ command = " " + command + " " + param;
}
- return command + '\n';
+ log.info("Command to be executed on EC2 : " + command);
+ return command;
}
public void dispose(JobExecutionContext jobExecutionContext) throws
GFacProviderException {