You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ra...@apache.org on 2014/03/12 18:59:04 UTC

git commit: updated the descriptors and created client. AIRAVATA-1059

Repository: airavata
Updated Branches:
  refs/heads/master ef3e2e4c2 -> 576729b3e


updated the descriptors and created client. AIRAVATA-1059


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

Branch: refs/heads/master
Commit: 576729b3ec3216a810e77b760cdaae5a21196558
Parents: ef3e2e4
Author: raminder <ra...@apache.org>
Authored: Wed Mar 12 13:58:31 2014 -0400
Committer: raminder <ra...@apache.org>
Committed: Wed Mar 12 13:58:31 2014 -0400

----------------------------------------------------------------------
 .../java-client-samples/pom.xml                 |   7 +-
 .../client/samples/CreateLaunchExperiment.java  | 131 +-----
 .../samples/CreateLaunchExperimentUS3.java      | 348 +++++++++++++++
 .../airavata/client/tools/DocumentCreator.java  | 377 +---------------
 .../client/tools/UltrascanDocumentCreator.java  | 428 +++++++++++++++++++
 5 files changed, 805 insertions(+), 486 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/576729b3/airavata-api/airavata-client-sdks/java-client-samples/pom.xml
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/pom.xml b/airavata-api/airavata-client-sdks/java-client-samples/pom.xml
index e9350f1..72050fd 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/pom.xml
+++ b/airavata-api/airavata-client-sdks/java-client-samples/pom.xml
@@ -26,7 +26,12 @@
     <url>http://airavata.apache.org/</url>
 
     <dependencies>
-
+    
+		<dependency>
+			<groupId>mysql</groupId>
+			<artifactId>mysql-connector-java</artifactId>
+			<version>5.1.12</version>
+		</dependency>
         <dependency>
             <groupId>org.apache.airavata</groupId>
             <artifactId>airavata-data-models</artifactId>

http://git-wip-us.apache.org/repos/asf/airavata/blob/576729b3/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
----------------------------------------------------------------------
diff --git 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
index aca7b59..7d4b129 100644
--- 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
@@ -61,10 +61,9 @@ public class CreateLaunchExperiment {
             final Airavata.Client airavata = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT);
             System.out.println("API version is " + airavata.GetAPIVersion());
             addDescriptors();
-//            final String expId = createExperimentForTrestles(airavata);
+            final String expId = createExperimentForTrestles(airavata);
 //            final String expId = createUS3ExperimentForTrestles(airavata);
-            final String expId = createExperimentForStampede(airavata);
-//            final String expId = createUS3ExperimentForStampede(airavata);
+//            final String expId = createExperimentForStampede(airavata);
             System.out.println("Experiment ID : " + expId);
             launchExperiment(airavata, expId);
             System.out.println("Launched successfully");
@@ -119,25 +118,15 @@ public class CreateLaunchExperiment {
             logger.error("Error while connecting with server", e.getMessage());
             e.printStackTrace();
         }
-//        } catch (ApplicationSettingsException e) {
-//            logger.error("Error while creating airavata API object", e.getMessage());
-//            e.printStackTrace();
-//        } catch (AiravataAPIInvocationException e) {
-//            logger.error("Error while creating airavata API object", e.getMessage());
-//            e.printStackTrace();
-//        }
     }
 
     public static void addDescriptors() throws AiravataAPIInvocationException,ApplicationSettingsException  {
         try {
             DocumentCreator documentCreator = new DocumentCreator(getAiravataAPI());
-//            documentCreator.createLocalHostDocs();
-//            documentCreator.createGramDocs();
-//            documentCreator.createPBSDocs();
-//            documentCreator.createPBSDocsForOGCE();
-//            documentCreator.createMPIPBSDocsTrestles();
+            documentCreator.createLocalHostDocs();
+            documentCreator.createGramDocs();
+            documentCreator.createPBSDocsForOGCE();
             documentCreator.createSlurmDocs();
-//              documentCreator.createMPIPBSDocsStampede();
         } catch (AiravataAPIInvocationException e) {
             logger.error("Unable to create airavata API", e.getMessage());
             throw new AiravataAPIInvocationException(e);
@@ -205,115 +194,7 @@ public class CreateLaunchExperiment {
             throw new TException(e);
         }
     }
-    
-    public static String createUS3ExperimentForTrestles (Airavata.Client client) throws AiravataSystemException, InvalidRequestException, AiravataClientException, TException  {
-        try{
-            List<DataObjectType> exInputs = new ArrayList<DataObjectType>();
-            DataObjectType input = new DataObjectType();
-            input.setKey("input");
-            input.setType(DataType.URI.toString());
-            input.setValue("file:///home/airavata/input/hpcinput.tar");
-            exInputs.add(input);
-
-            List<DataObjectType> exOut = new ArrayList<DataObjectType>();
-            DataObjectType output = new DataObjectType();
-            output.setKey("output");
-            output.setType(DataType.URI.toString());
-            output.setValue("");
-            DataObjectType output1 = new DataObjectType();
-            output1.setKey("stdout");
-            output1.setType(DataType.STD_OUT.toString());
-            output1.setValue("");
-            DataObjectType output2 = new DataObjectType();
-            output2.setKey("stderr");
-            output2.setType(DataType.STD_ERR.toString());
-            output2.setValue("");
-            exOut.add(output);
-            exOut.add(output1);
-            exOut.add(output2);
-            
-
-            Experiment simpleExperiment = ExperimentModelUtil.createSimpleExperiment("project1", "admin", "US3Experiment", "UltrascanAppTrestles", "UltrascanAppTrestles", exInputs);
-            simpleExperiment.setExperimentOutputs(exOut);
-
-            ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.edu", 2, 32, 0, "normal", 0, 0, 0, "uot111");
-
-
-            scheduling.setResourceHostId("gsissh-trestles");
-            UserConfigurationData userConfigurationData = new UserConfigurationData();
-            userConfigurationData.setAiravataAutoSchedule(false);
-            userConfigurationData.setOverrideManualScheduledParams(false);
-            userConfigurationData.setComputationalResourceScheduling(scheduling);
-            simpleExperiment.setUserConfigurationData(userConfigurationData);
-            return client.createExperiment(simpleExperiment);
-        } catch (AiravataSystemException e) {
-            logger.error("Error occured while creating the experiment...", e.getMessage());
-            throw new AiravataSystemException(e);
-        } catch (InvalidRequestException e) {
-            logger.error("Error occured while creating the experiment...", e.getMessage());
-            throw new InvalidRequestException(e);
-        } catch (AiravataClientException e) {
-            logger.error("Error occured while creating the experiment...", e.getMessage());
-            throw new AiravataClientException(e);
-        }catch (TException e) {
-            logger.error("Error occured while creating the experiment...", e.getMessage());
-            throw new TException(e);
-        }
-    }
-    public static String createUS3ExperimentForStampede (Airavata.Client client) throws AiravataSystemException, InvalidRequestException, AiravataClientException, TException  {
-        try{
-            List<DataObjectType> exInputs = new ArrayList<DataObjectType>();
-            DataObjectType input = new DataObjectType();
-            input.setKey("input");
-            input.setType(DataType.URI.toString());
-            input.setValue("file:///home/airavata/input/hpcinput.tar");
-            exInputs.add(input);
-
-            List<DataObjectType> exOut = new ArrayList<DataObjectType>();
-            DataObjectType output = new DataObjectType();
-            output.setKey("output");
-            output.setType(DataType.URI.toString());
-            output.setValue("");
-            DataObjectType output1 = new DataObjectType();
-            output1.setKey("stdout");
-            output1.setType(DataType.STD_OUT.toString());
-            output1.setValue("");
-            DataObjectType output2 = new DataObjectType();
-            output2.setKey("stderr");
-            output2.setType(DataType.STD_ERR.toString());
-            output2.setValue("");
-            exOut.add(output);
-            exOut.add(output1);
-            exOut.add(output2);
-            
-
-            Experiment simpleExperiment = ExperimentModelUtil.createSimpleExperiment("project1", "admin", "US3Experiment", "UltrascanAppStampede", "UltrascanAppStampede", exInputs);
-            simpleExperiment.setExperimentOutputs(exOut);
-
-            ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling("stampede.tacc.xsede.org", 2, 32, 0, "normal", 0, 0, 0, "TG-MCB070039N");
-
-
-            scheduling.setResourceHostId("gsissh-stampede");
-            UserConfigurationData userConfigurationData = new UserConfigurationData();
-            userConfigurationData.setAiravataAutoSchedule(false);
-            userConfigurationData.setOverrideManualScheduledParams(false);
-            userConfigurationData.setComputationalResourceScheduling(scheduling);
-            simpleExperiment.setUserConfigurationData(userConfigurationData);
-            return client.createExperiment(simpleExperiment);
-        } catch (AiravataSystemException e) {
-            logger.error("Error occured while creating the experiment...", e.getMessage());
-            throw new AiravataSystemException(e);
-        } catch (InvalidRequestException e) {
-            logger.error("Error occured while creating the experiment...", e.getMessage());
-            throw new InvalidRequestException(e);
-        } catch (AiravataClientException e) {
-            logger.error("Error occured while creating the experiment...", e.getMessage());
-            throw new AiravataClientException(e);
-        }catch (TException e) {
-            logger.error("Error occured while creating the experiment...", e.getMessage());
-            throw new TException(e);
-        }
-    }
+   
     public static String createExperimentForStampede(Airavata.Client client) throws TException  {
         try{
             List<DataObjectType> exInputs = new ArrayList<DataObjectType>();

http://git-wip-us.apache.org/repos/asf/airavata/blob/576729b3/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperimentUS3.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperimentUS3.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperimentUS3.java
new file mode 100644
index 0000000..8834f5a
--- /dev/null
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperimentUS3.java
@@ -0,0 +1,348 @@
+package org.apache.airavata.client.samples;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.airavata.api.Airavata;
+import org.apache.airavata.api.client.AiravataClientFactory;
+import org.apache.airavata.api.error.AiravataClientException;
+import org.apache.airavata.api.error.AiravataSystemException;
+import org.apache.airavata.api.error.ExperimentNotFoundException;
+import org.apache.airavata.api.error.InvalidRequestException;
+import org.apache.airavata.client.AiravataAPIFactory;
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.client.tools.UltrascanDocumentCreator;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.ClientSettings;
+import org.apache.airavata.model.util.ExperimentModelUtil;
+import org.apache.airavata.model.workspace.experiment.ComputationalResourceScheduling;
+import org.apache.airavata.model.workspace.experiment.DataObjectType;
+import org.apache.airavata.model.workspace.experiment.Experiment;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.apache.airavata.model.workspace.experiment.JobStatus;
+import org.apache.airavata.model.workspace.experiment.UserConfigurationData;
+import org.apache.airavata.schemas.gfac.DataType;
+import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CreateLaunchExperimentUS3 {
+	
+	 //FIXME: Read from a config file
+    public static final String THRIFT_SERVER_HOST = "gw111.iu.xsede.org";
+    public static final int THRIFT_SERVER_PORT = 8930;
+    private final static Logger logger = LoggerFactory.getLogger(CreateLaunchExperiment.class);
+    private static final String DEFAULT_USER = "defauly.registry.user";
+    private static final String DEFAULT_GATEWAY = "default.registry.gateway";
+    public static void main(String[] args) {
+        try {
+            AiravataUtils.setExecutionAsClient();
+            final Airavata.Client airavata = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT);
+            System.out.println("API version is " + airavata.GetAPIVersion());
+//            addDescriptors();
+//            final String expId = createExperimentForTrestles(airavata);
+//            final String expId = createUS3ExperimentForTrestles(airavata);
+//            final String expId = createExperimentForStampede(airavata);
+            final String expId = createUS3ExperimentForStampede(airavata);
+            System.out.println("Experiment ID : " + expId);
+            launchExperiment(airavata, expId);
+            System.out.println("Launched successfully");
+//            try {
+//                Thread.sleep(20000);
+//            } catch (InterruptedException e) {
+//                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+//            }
+            Thread monitor = (new Thread(){
+                 public void run() {
+                     Map<String, JobStatus> jobStatuses = null;
+                     while (true) {
+                         try {
+                             jobStatuses = airavata.getJobStatuses(expId);
+                             Set<String> strings = jobStatuses.keySet();
+                             for (String key : strings) {
+                                 JobStatus jobStatus = jobStatuses.get(key);
+                                 if(jobStatus == null){
+                                     return;
+                                 }else {
+                                     if (JobState.COMPLETE.equals(jobStatus.getJobState())) {
+                                         System.out.println("Job completed Job ID: " + key);
+                                         return;
+                                     }else{
+                                        System.out.println("Job ID:" + key + jobStatuses.get(key).getJobState().toString());
+                                     }
+                                 }
+                             }
+                             Thread.sleep(5000);
+                         } catch (Exception e) {
+                             e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+                         }
+                     }
+                 }
+            });
+            monitor.start();
+            try {
+                monitor.join();
+            } catch (InterruptedException e) {
+                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            }
+
+//            Experiment experiment = airavata.getExperiment(expId);
+//            System.out.println("retrieved exp id : " + experiment.getExperimentID());
+        } catch (Exception e) {
+            logger.error("Error while connecting with server", e.getMessage());
+            e.printStackTrace();
+        }
+    }
+    public static void addDescriptors() throws AiravataAPIInvocationException,ApplicationSettingsException  {
+        try {
+            UltrascanDocumentCreator documentCreator = new UltrascanDocumentCreator(getAiravataAPI());
+//            documentCreator.createMPIPBSDocsTrestles();
+//            documentCreator.createEchoPBSDocsforTestles();
+//            documentCreator.createEchoSlurmDocsofStampede();
+            documentCreator.createMPISLURMDocsStampede();
+        } catch (AiravataAPIInvocationException e) {
+            logger.error("Unable to create airavata API", e.getMessage());
+            throw new AiravataAPIInvocationException(e);
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to create airavata API", e.getMessage());
+            throw new ApplicationSettingsException(e.getMessage());
+        }
+    }
+
+    private static AiravataAPI getAiravataAPI() throws AiravataAPIInvocationException, ApplicationSettingsException {
+        AiravataAPI airavataAPI;
+        try {
+            String sysUser = ClientSettings.getSetting(DEFAULT_USER);
+            String gateway = ClientSettings.getSetting(DEFAULT_GATEWAY);
+            airavataAPI = AiravataAPIFactory.getAPI(gateway, sysUser);
+        } catch (AiravataAPIInvocationException e) {
+            logger.error("Unable to create airavata API", e.getMessage());
+            throw new AiravataAPIInvocationException(e);
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to create airavata API", e.getMessage());
+            throw new ApplicationSettingsException(e.getMessage());
+        }
+        return airavataAPI;
+    }
+
+    public static String createExperimentForTrestles(Airavata.Client client) throws TException  {
+        try{
+            List<DataObjectType> exInputs = new ArrayList<DataObjectType>();
+            DataObjectType input = new DataObjectType();
+            input.setKey("echo_input");
+            input.setType(DataType.STRING.toString());
+            input.setValue("echo_output=Hello World");
+            exInputs.add(input);
+
+            List<DataObjectType> exOut = new ArrayList<DataObjectType>();
+            DataObjectType output = new DataObjectType();
+            output.setKey("echo_output");
+            output.setType(DataType.STRING.toString());
+            output.setValue("");
+            exOut.add(output);
+
+            Experiment simpleExperiment =
+                    ExperimentModelUtil.createSimpleExperiment("project1", "admin", "echoExperiment", "SimpleEcho2", "SimpleEcho2", exInputs);
+            simpleExperiment.setExperimentOutputs(exOut);
+
+            ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.edu", 1, 1, 1, "normal", 0, 0, 1, "sds128");
+            scheduling.setResourceHostId("gsissh-trestles");
+            UserConfigurationData userConfigurationData = new UserConfigurationData();
+            userConfigurationData.setAiravataAutoSchedule(false);
+            userConfigurationData.setOverrideManualScheduledParams(false);
+            userConfigurationData.setComputationalResourceScheduling(scheduling);
+            simpleExperiment.setUserConfigurationData(userConfigurationData);
+            return client.createExperiment(simpleExperiment);
+        } catch (AiravataSystemException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new AiravataSystemException(e);
+        } catch (InvalidRequestException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new InvalidRequestException(e);
+        } catch (AiravataClientException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new AiravataClientException(e);
+        }catch (TException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new TException(e);
+        }
+    }
+    
+    public static String createUS3ExperimentForTrestles (Airavata.Client client) throws AiravataSystemException, InvalidRequestException, AiravataClientException, TException  {
+        try{
+            List<DataObjectType> exInputs = new ArrayList<DataObjectType>();
+            DataObjectType input = new DataObjectType();
+            input.setKey("input");
+            input.setType(DataType.URI.toString());
+            input.setValue("file:///home/airavata/input/hpcinput.tar");
+            exInputs.add(input);
+
+            List<DataObjectType> exOut = new ArrayList<DataObjectType>();
+            DataObjectType output = new DataObjectType();
+            output.setKey("output");
+            output.setType(DataType.URI.toString());
+            output.setValue("");
+            DataObjectType output1 = new DataObjectType();
+            output1.setKey("stdout");
+            output1.setType(DataType.STD_OUT.toString());
+            output1.setValue("");
+            DataObjectType output2 = new DataObjectType();
+            output2.setKey("stderr");
+            output2.setType(DataType.STD_ERR.toString());
+            output2.setValue("");
+            exOut.add(output);
+            exOut.add(output1);
+            exOut.add(output2);
+            
+
+            Experiment simpleExperiment = ExperimentModelUtil.createSimpleExperiment("project1", "admin", "US3Experiment", "UltrascanAppTrestles", "UltrascanAppTrestles", exInputs);
+            simpleExperiment.setExperimentOutputs(exOut);
+
+            ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.edu", 2, 32, 0, "normal", 0, 0, 0, "uot111");
+
+
+            scheduling.setResourceHostId("gsissh-trestles");
+            UserConfigurationData userConfigurationData = new UserConfigurationData();
+            userConfigurationData.setAiravataAutoSchedule(false);
+            userConfigurationData.setOverrideManualScheduledParams(false);
+            userConfigurationData.setComputationalResourceScheduling(scheduling);
+            simpleExperiment.setUserConfigurationData(userConfigurationData);
+            return client.createExperiment(simpleExperiment);
+        } catch (AiravataSystemException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new AiravataSystemException(e);
+        } catch (InvalidRequestException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new InvalidRequestException(e);
+        } catch (AiravataClientException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new AiravataClientException(e);
+        }catch (TException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new TException(e);
+        }
+    }
+    public static String createUS3ExperimentForStampede (Airavata.Client client) throws AiravataSystemException, InvalidRequestException, AiravataClientException, TException  {
+        try{
+            List<DataObjectType> exInputs = new ArrayList<DataObjectType>();
+            DataObjectType input = new DataObjectType();
+            input.setKey("input");
+            input.setType(DataType.URI.toString());
+            input.setValue("file:///home/airavata/input/hpcinput.tar");
+            exInputs.add(input);
+
+            List<DataObjectType> exOut = new ArrayList<DataObjectType>();
+            DataObjectType output = new DataObjectType();
+            output.setKey("output");
+            output.setType(DataType.URI.toString());
+            output.setValue("");
+            DataObjectType output1 = new DataObjectType();
+            output1.setKey("stdout");
+            output1.setType(DataType.STD_OUT.toString());
+            output1.setValue("");
+            DataObjectType output2 = new DataObjectType();
+            output2.setKey("stderr");
+            output2.setType(DataType.STD_ERR.toString());
+            output2.setValue("");
+            exOut.add(output);
+            exOut.add(output1);
+            exOut.add(output2);
+            
+
+            Experiment simpleExperiment = ExperimentModelUtil.createSimpleExperiment("project1", "admin", "US3ExperimentStampede", "US3AppStampede", "US3AppStampede", exInputs);
+            simpleExperiment.setExperimentOutputs(exOut);
+
+            ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling("stampede.tacc.xsede.org", 2, 32, 0, "normal", 0, 0, 0, "TG-MCB070039N");
+
+
+            scheduling.setResourceHostId("gsissh-stampede");
+            UserConfigurationData userConfigurationData = new UserConfigurationData();
+            userConfigurationData.setAiravataAutoSchedule(false);
+            userConfigurationData.setOverrideManualScheduledParams(false);
+            userConfigurationData.setComputationalResourceScheduling(scheduling);
+            simpleExperiment.setUserConfigurationData(userConfigurationData);
+            return client.createExperiment(simpleExperiment);
+        } catch (AiravataSystemException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new AiravataSystemException(e);
+        } catch (InvalidRequestException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new InvalidRequestException(e);
+        } catch (AiravataClientException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new AiravataClientException(e);
+        }catch (TException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new TException(e);
+        }
+    }
+    public static String createExperimentForStampede(Airavata.Client client) throws TException  {
+        try{
+            List<DataObjectType> exInputs = new ArrayList<DataObjectType>();
+            DataObjectType input = new DataObjectType();
+            input.setKey("echo_input");
+            input.setType(DataType.STRING.toString());
+            input.setValue("echo_output=Hello World");
+            exInputs.add(input);
+
+            List<DataObjectType> exOut = new ArrayList<DataObjectType>();
+            DataObjectType output = new DataObjectType();
+            output.setKey("echo_output");
+            output.setType(DataType.STRING.toString());
+            output.setValue("");
+            exOut.add(output);
+
+            Experiment simpleExperiment =
+                    ExperimentModelUtil.createSimpleExperiment("project1", "admin", "echoExperiment", "SimpleEcho3", "SimpleEcho3", exInputs);
+            simpleExperiment.setExperimentOutputs(exOut);
+
+            ComputationalResourceScheduling scheduling =
+                    ExperimentModelUtil.createComputationResourceScheduling("stampede.tacc.xsede.org", 1, 1, 1, "normal", 0, 0, 1, "TG-STA110014S");
+            scheduling.setResourceHostId("stampede-host");
+            UserConfigurationData userConfigurationData = new UserConfigurationData();
+            userConfigurationData.setAiravataAutoSchedule(false);
+            userConfigurationData.setOverrideManualScheduledParams(false);
+            userConfigurationData.setComputationalResourceScheduling(scheduling);
+            simpleExperiment.setUserConfigurationData(userConfigurationData);
+            return client.createExperiment(simpleExperiment);
+        } catch (AiravataSystemException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new AiravataSystemException(e);
+        } catch (InvalidRequestException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new InvalidRequestException(e);
+        } catch (AiravataClientException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new AiravataClientException(e);
+        }catch (TException e) {
+            logger.error("Error occured while creating the experiment...", e.getMessage());
+            throw new TException(e);
+        }
+    }
+
+    public static void launchExperiment (Airavata.Client client, String expId)
+            throws TException{
+        try {
+            client.launchExperiment(expId, "testToken");
+        } catch (ExperimentNotFoundException e) {
+            logger.error("Error occured while launching the experiment...", e.getMessage());
+            throw new ExperimentNotFoundException(e);
+        } catch (AiravataSystemException e) {
+            logger.error("Error occured while launching the experiment...", e.getMessage());
+            throw new AiravataSystemException(e);
+        } catch (InvalidRequestException e) {
+            logger.error("Error occured while launching the experiment...", e.getMessage());
+            throw new InvalidRequestException(e);
+        } catch (AiravataClientException e) {
+            logger.error("Error occured while launching the experiment...", e.getMessage());
+            throw new AiravataClientException(e);
+        }catch (TException e) {
+            logger.error("Error occured while launching the experiment...", e.getMessage());
+            throw new TException(e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/576729b3/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java
----------------------------------------------------------------------
diff --git a/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java
index 7504cb5..7964291 100644
--- a/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java
+++ b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreator.java
@@ -20,18 +20,25 @@
 */
 package org.apache.airavata.client.tools;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.airavata.client.api.AiravataAPI;
 import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
 import org.apache.airavata.commons.gfac.type.ApplicationDescription;
 import org.apache.airavata.commons.gfac.type.HostDescription;
 import org.apache.airavata.commons.gfac.type.ServiceDescription;
-import org.apache.airavata.schemas.gfac.*;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
+import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
+import org.apache.airavata.schemas.gfac.DataType;
+import org.apache.airavata.schemas.gfac.GlobusHostType;
+import org.apache.airavata.schemas.gfac.GsisshHostType;
+import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
+import org.apache.airavata.schemas.gfac.InputParameterType;
+import org.apache.airavata.schemas.gfac.JobTypeType;
+import org.apache.airavata.schemas.gfac.OutputParameterType;
+import org.apache.airavata.schemas.gfac.ParameterType;
+import org.apache.airavata.schemas.gfac.ProjectAccountType;
+import org.apache.airavata.schemas.gfac.QueueType;
 
 public class DocumentCreator {
 
@@ -185,18 +192,7 @@ public class DocumentCreator {
            * Default tmp location
            */
         String tempDir = "/home/ogce/scratch";
-        String date = (new Date()).toString();
-        date = date.replaceAll(" ", "_");
-        date = date.replaceAll(":", "_");
-
-        tempDir = tempDir + File.separator
-                + "SimpleEcho" + "_" + date + "_" + UUID.randomUUID();
-
         app.setScratchWorkingDirectory(tempDir);
-        app.setInputDataDirectory(tempDir + File.separator + "inputData");
-        app.setOutputDataDirectory(tempDir + File.separator + "outputData");
-        app.setStandardOutput(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stdout");
-        app.setStandardError(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stderr");
         app.setMaxMemory(10);
 
 
@@ -207,104 +203,6 @@ public class DocumentCreator {
         }
     }
 
-    public void createPBSDocs() {
-        HostDescription host = new HostDescription(GsisshHostType.type);
-        host.getType().setHostAddress(hpcHostAddress);
-        host.getType().setHostName(gsiSshHostName);
-        ((GsisshHostType) host.getType()).setPort(22);
-        ((GsisshHostType) host.getType()).setInstalledPath("/opt/torque/bin/");
-
-        try {
-            airavataAPI.getApplicationManager().saveHostDescription(host);
-        } catch (AiravataAPIInvocationException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-        }
-        /*
-        * Service Description creation and saving
-        */
-        String serviceName = "SimpleEcho2";
-        ServiceDescription serv = new ServiceDescription();
-        serv.getType().setName(serviceName);
-
-        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
-        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
-
-
-        InputParameterType input = InputParameterType.Factory.newInstance();
-        input.setParameterName("echo_input");
-        ParameterType parameterType = input.addNewParameterType();
-        parameterType.setType(DataType.STRING);
-        parameterType.setName("String");
-
-        OutputParameterType output = OutputParameterType.Factory.newInstance();
-        output.setParameterName("echo_output");
-        ParameterType parameterType1 = output.addNewParameterType();
-        parameterType1.setType(DataType.STRING);
-        parameterType1.setName("String");
-
-        inputList.add(input);
-        outputList.add(output);
-
-        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);
-        OutputParameterType[] outputParamList = outputList.toArray(new OutputParameterType[outputList.size()]);
-
-        serv.getType().setInputParametersArray(inputParamList);
-        serv.getType().setOutputParametersArray(outputParamList);
-        try {
-            airavataAPI.getApplicationManager().saveServiceDescription(serv);
-        } catch (AiravataAPIInvocationException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-        }
-
-        /*
-            Application descriptor creation and saving
-         */
-        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
-        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
-        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
-        name.setStringValue("EchoLocal");
-        app.setApplicationName(name);
-        ProjectAccountType projectAccountType = app.addNewProjectAccount();
-        projectAccountType.setProjectAccountNumber("uot111");
-
-        QueueType queueType = app.addNewQueue();
-        queueType.setQueueName("normal");
-
-        app.setCpuCount(1);
-        app.setJobType(JobTypeType.SERIAL);
-        app.setNodeCount(1);
-        app.setProcessorsPerNode(1);
-        app.setMaxWallTime(10);
-        /*
-           * Use bat file if it is compiled on Windows
-           */
-        app.setExecutableLocation("/bin/echo");
-
-        /*
-           * Default tmp location
-           */
-        String tempDir = "/oasis/projects/nsf/uot111/us3/airavata-workdirs/";
-        String date = (new Date()).toString();
-        date = date.replaceAll(" ", "_");
-        date = date.replaceAll(":", "_");
-
-        tempDir = tempDir + File.separator
-                + "SimpleEcho" + "_" + date + "_" + UUID.randomUUID();
-
-        app.setScratchWorkingDirectory(tempDir);
-        app.setInputDataDirectory(tempDir + File.separator + "inputData");
-        app.setOutputDataDirectory(tempDir + File.separator + "outputData");
-        app.setStandardOutput(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stdout");
-        app.setStandardError(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stderr");
-        app.setInstalledParentPath("/opt/torque/bin/");
-
-        try {
-            airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, gsiSshHostName, appDesc);
-        } catch (AiravataAPIInvocationException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-        }
-    }
-
     public void createPBSDocsForOGCE() {
         HostDescription host = new HostDescription(GsisshHostType.type);
         host.getType().setHostAddress(hpcHostAddress);
@@ -382,18 +280,8 @@ public class DocumentCreator {
            * Default tmp location
            */
         String tempDir = "/home/ogce/scratch";
-        String date = (new Date()).toString();
-        date = date.replaceAll(" ", "_");
-        date = date.replaceAll(":", "_");
-
-        tempDir = tempDir + File.separator
-                + "SimpleEcho" + "_" + date + "_" + UUID.randomUUID();
-
+     
         app.setScratchWorkingDirectory(tempDir);
-        app.setInputDataDirectory(tempDir + File.separator + "inputData");
-        app.setOutputDataDirectory(tempDir + File.separator + "outputData");
-        app.setStandardOutput(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stdout");
-        app.setStandardError(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stderr");
         app.setInstalledParentPath("/opt/torque/bin/");
 
         try {
@@ -403,229 +291,7 @@ public class DocumentCreator {
         }
     }
 
-    public void createMPIPBSDocsTrestles() {
-        HostDescription host = new HostDescription(GsisshHostType.type);
-        host.getType().setHostAddress(hpcHostAddress);
-        host.getType().setHostName(gsiSshHostName);
-        ((GsisshHostType) host.getType()).setPort(22);
-        ((GsisshHostType) host.getType()).setInstalledPath("/opt/torque/bin/");
-
-        try {
-            airavataAPI.getApplicationManager().saveHostDescription(host);
-        } catch (AiravataAPIInvocationException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-        }
-        /*
-        * Service Description creation and saving
-        */
-        String serviceName = "UltrascanAppTrestles";
-        ServiceDescription serv = new ServiceDescription();
-        serv.getType().setName(serviceName);
-
-        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
-        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
-
-
-        InputParameterType input = InputParameterType.Factory.newInstance();
-        input.setParameterName("input");
-        ParameterType parameterType = input.addNewParameterType();
-        parameterType.setType(DataType.URI);
-        parameterType.setName("URI");
-
-        OutputParameterType output = OutputParameterType.Factory.newInstance();
-        output.setParameterName("output");
-        ParameterType parameterType1 = output.addNewParameterType();
-        parameterType1.setType(DataType.URI);
-        parameterType1.setName("URI");
-        
-        OutputParameterType output1 = OutputParameterType.Factory.newInstance();
-        output1.setParameterName("stdout");
-        ParameterType parameterType2 = output1.addNewParameterType();
-        parameterType2.setType(DataType.STD_OUT);
-        parameterType2.setName("StdOut");
-        
-        OutputParameterType output2 = OutputParameterType.Factory.newInstance();
-        output2.setParameterName("stderr");
-        ParameterType parameterType3 = output2.addNewParameterType();
-        parameterType3.setType(DataType.STD_ERR);
-        parameterType3.setName("StdErr");
-
-        inputList.add(input);
-        outputList.add(output);
-        outputList.add(output1);
-        outputList.add(output2);
-        
-        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);
-        OutputParameterType[] outputParamList = outputList.toArray(new OutputParameterType[outputList.size()]);
-
-        serv.getType().setInputParametersArray(inputParamList);
-        serv.getType().setOutputParametersArray(outputParamList);
-        try {
-            airavataAPI.getApplicationManager().saveServiceDescription(serv);
-        } catch (AiravataAPIInvocationException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-        }
-
-        /*
-            Application descriptor creation and saving
-         */
-        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
-        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
-        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
-        name.setStringValue("UltrascanAppTrestles");
-        app.setApplicationName(name);
-        ProjectAccountType projectAccountType = app.addNewProjectAccount();
-        projectAccountType.setProjectAccountNumber("uot111");
-
-        QueueType queueType = app.addNewQueue();
-        queueType.setQueueName("normal");
-
-        app.setCpuCount(1);
-        app.setJobType(JobTypeType.MPI);
-        app.setNodeCount(32);
-        app.setProcessorsPerNode(2);
-        app.setMaxWallTime(10);
-        /*
-           * Use bat file if it is compiled on Windows
-           */
-        app.setExecutableLocation("/home/us3/trestles/bin/us_mpi_analysis");
-
-        /*
-           * Default tmp location
-           */
-        String tempDir = "/oasis/projects/nsf/uot111/us3/airavata-workdirs/";
-        String date = (new Date()).toString();
-        date = date.replaceAll(" ", "_");
-        date = date.replaceAll(":", "_");
-
-        tempDir = tempDir + File.separator
-                + "Ultrascan" + "_" + date + "_" + UUID.randomUUID();
-
-        app.setScratchWorkingDirectory(tempDir);
-        app.setInputDataDirectory(tempDir + File.separator + "inputData");
-        app.setOutputDataDirectory(tempDir + File.separator + "outputData");
-        app.setStandardOutput(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stdout");
-        app.setStandardError(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stderr");
-        app.setInstalledParentPath("/opt/torque/bin/");
-        app.setJobSubmitterCommand("/opt/mvapich2/pgi/ib/bin/mpiexec");
-        try {
-            airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, gsiSshHostName, appDesc);
-        } catch (AiravataAPIInvocationException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-        }
-    }
-    public void createMPIPBSDocsStampede() {
-        HostDescription host = new HostDescription(GsisshHostType.type);
-        host.getType().setHostAddress("stampede.tacc.xsede.org");
-        host.getType().setHostName("gsissh-stampede");
-        ((GsisshHostType) host.getType()).setJobManager("slurm");
-        ((GsisshHostType) host.getType()).setInstalledPath("/usr/bin/");
-        ((GsisshHostType) host.getType()).setPort(2222);
-      
-        try {
-            airavataAPI.getApplicationManager().saveHostDescription(host);
-        } catch (AiravataAPIInvocationException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-        }
-        /*
-        * Service Description creation and saving
-        */
-        String serviceName = "UltrascanAppStampede";
-        ServiceDescription serv = new ServiceDescription();
-        serv.getType().setName(serviceName);
-
-        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
-        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
-
-
-        InputParameterType input = InputParameterType.Factory.newInstance();
-        input.setParameterName("input");
-        ParameterType parameterType = input.addNewParameterType();
-        parameterType.setType(DataType.URI);
-        parameterType.setName("URI");
-
-        OutputParameterType output = OutputParameterType.Factory.newInstance();
-        output.setParameterName("output");
-        ParameterType parameterType1 = output.addNewParameterType();
-        parameterType1.setType(DataType.URI);
-        parameterType1.setName("URI");
-        
-        OutputParameterType output1 = OutputParameterType.Factory.newInstance();
-        output1.setParameterName("stdout");
-        ParameterType parameterType2 = output1.addNewParameterType();
-        parameterType2.setType(DataType.STD_OUT);
-        parameterType2.setName("StdOut");
-        
-        OutputParameterType output2 = OutputParameterType.Factory.newInstance();
-        output2.setParameterName("stderr");
-        ParameterType parameterType3 = output2.addNewParameterType();
-        parameterType3.setType(DataType.STD_ERR);
-        parameterType3.setName("StdErr");
-
-        inputList.add(input);
-        outputList.add(output);
-        outputList.add(output1);
-        outputList.add(output2);
-        
-        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);
-        OutputParameterType[] outputParamList = outputList.toArray(new OutputParameterType[outputList.size()]);
-
-        serv.getType().setInputParametersArray(inputParamList);
-        serv.getType().setOutputParametersArray(outputParamList);
-        try {
-            airavataAPI.getApplicationManager().saveServiceDescription(serv);
-        } catch (AiravataAPIInvocationException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-        }
-
-        /*
-            Application descriptor creation and saving
-         */
-        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
-        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
-        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
-        name.setStringValue("UltrascanAppStampede");
-        app.setApplicationName(name);
-        ProjectAccountType projectAccountType = app.addNewProjectAccount();
-        projectAccountType.setProjectAccountNumber("TG-MCB070039N");
-
-        QueueType queueType = app.addNewQueue();
-        queueType.setQueueName("normal");
-
-        app.setCpuCount(1);
-        app.setJobType(JobTypeType.MPI);
-        app.setNodeCount(32);
-        app.setProcessorsPerNode(2);
-        app.setMaxWallTime(10);
-        /*
-           * Use bat file if it is compiled on Windows
-           */
-        app.setExecutableLocation("/home1/01623/us3/bin/us_mpi_analysis");
-
-        /*
-           * Default tmp location
-           */
-        String tempDir = "/home1/01623/us3";
-        String date = (new Date()).toString();
-        date = date.replaceAll(" ", "_");
-        date = date.replaceAll(":", "_");
-
-        tempDir = tempDir + File.separator
-                + "Ultrascan" + "_" + date + "_" + UUID.randomUUID();
-
-        app.setScratchWorkingDirectory(tempDir);
-        app.setInputDataDirectory(tempDir + File.separator + "inputData");
-        app.setOutputDataDirectory(tempDir + File.separator + "outputData");
-        app.setStandardOutput(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stdout");
-        app.setStandardError(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stderr");
-        app.setInstalledParentPath("/usr/bin/");
-        app.setJobSubmitterCommand("/usr/local/bin/ibrun");
-        try {
-            airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, "gsissh-stampede", appDesc);
-        } catch (AiravataAPIInvocationException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-        }
-    }
+   
     public void createSlurmDocs() {
         HostDescription host = new HostDescription(GsisshHostType.type);
         host.getType().setHostAddress("stampede.tacc.xsede.org");
@@ -633,7 +299,7 @@ public class DocumentCreator {
         ((GsisshHostType) host.getType()).setJobManager("slurm");
         ((GsisshHostType) host.getType()).setInstalledPath("/usr/bin/");
         ((GsisshHostType) host.getType()).setPort(2222);
-//        ((GsisshHostType) host.getType()).setMonitorMode("push");
+        ((GsisshHostType) host.getType()).setMonitorMode("push");
 //        ((GsisshHostType) host.getType()).setMo(2222);
 
 
@@ -707,18 +373,9 @@ public class DocumentCreator {
         * Default tmp location
         */
         String tempDir = "/home1/01437/ogce";
-        String date = (new Date()).toString();
-        date = date.replaceAll(" ", "_");
-        date = date.replaceAll(":", "_");
 
-        tempDir = tempDir + File.separator
-                + "SimpleEcho" + "_" + date + "_" + UUID.randomUUID();
 
         app.setScratchWorkingDirectory(tempDir);
-        app.setInputDataDirectory(tempDir + File.separator + "inputData");
-        app.setOutputDataDirectory(tempDir + File.separator + "outputData");
-        app.setStandardOutput(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stdout");
-        app.setStandardError(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stderr");
         app.setInstalledParentPath("/usr/bin/");
 
         try {

http://git-wip-us.apache.org/repos/asf/airavata/blob/576729b3/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/UltrascanDocumentCreator.java
----------------------------------------------------------------------
diff --git a/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/UltrascanDocumentCreator.java b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/UltrascanDocumentCreator.java
new file mode 100644
index 0000000..e1152aa
--- /dev/null
+++ b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/UltrascanDocumentCreator.java
@@ -0,0 +1,428 @@
+package org.apache.airavata.client.tools;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
+import org.apache.airavata.schemas.gfac.DataType;
+import org.apache.airavata.schemas.gfac.GsisshHostType;
+import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
+import org.apache.airavata.schemas.gfac.InputParameterType;
+import org.apache.airavata.schemas.gfac.JobTypeType;
+import org.apache.airavata.schemas.gfac.OutputParameterType;
+import org.apache.airavata.schemas.gfac.ParameterType;
+import org.apache.airavata.schemas.gfac.ProjectAccountType;
+import org.apache.airavata.schemas.gfac.QueueType;
+
+public class UltrascanDocumentCreator {
+
+	private AiravataAPI airavataAPI = null;
+    private String hpcHostAddress = "trestles.sdsc.edu";
+    private String gramHostName = "gram-trestles";
+    private String gsiSshHostNameTrestles = "gsissh-trestles";
+    private String gsiSshHostNameStampede = "gsissh-stampede";
+    private String gridftpAddress = "gsiftp://trestles-dm1.sdsc.edu:2811";
+    private String gramAddress = "trestles-login1.sdsc.edu:2119/jobmanager-pbstest2";
+
+
+    public UltrascanDocumentCreator(AiravataAPI airavataAPI) {
+        this.airavataAPI = airavataAPI;
+    }
+    
+    public void createEchoPBSDocsforTestles() {
+        HostDescription host = new HostDescription(GsisshHostType.type);
+        host.getType().setHostAddress(hpcHostAddress);
+        host.getType().setHostName(gsiSshHostNameTrestles);
+        ((GsisshHostType) host.getType()).setPort(22);
+        ((GsisshHostType) host.getType()).setInstalledPath("/opt/torque/bin/");
+
+        try {
+            airavataAPI.getApplicationManager().saveHostDescription(host);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+        /*
+        * Service Description creation and saving
+        */
+        String serviceName = "US3EchoTrestles";
+        ServiceDescription serv = new ServiceDescription();
+        serv.getType().setName(serviceName);
+
+        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
+        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
+
+
+        InputParameterType input = InputParameterType.Factory.newInstance();
+        input.setParameterName("echo_input");
+        ParameterType parameterType = input.addNewParameterType();
+        parameterType.setType(DataType.STRING);
+        parameterType.setName("String");
+
+        OutputParameterType output = OutputParameterType.Factory.newInstance();
+        output.setParameterName("echo_output");
+        ParameterType parameterType1 = output.addNewParameterType();
+        parameterType1.setType(DataType.STRING);
+        parameterType1.setName("String");
+
+        inputList.add(input);
+        outputList.add(output);
+
+        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);
+        OutputParameterType[] outputParamList = outputList.toArray(new OutputParameterType[outputList.size()]);
+
+        serv.getType().setInputParametersArray(inputParamList);
+        serv.getType().setOutputParametersArray(outputParamList);
+        try {
+            airavataAPI.getApplicationManager().saveServiceDescription(serv);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+
+        /*
+            Application descriptor creation and saving
+         */
+        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
+        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
+        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+        name.setStringValue(serviceName);
+        app.setApplicationName(name);
+        ProjectAccountType projectAccountType = app.addNewProjectAccount();
+        projectAccountType.setProjectAccountNumber("uot111");
+
+        QueueType queueType = app.addNewQueue();
+        queueType.setQueueName("normal");
+
+        app.setCpuCount(1);
+        app.setJobType(JobTypeType.SERIAL);
+        app.setNodeCount(1);
+        app.setProcessorsPerNode(1);
+        app.setMaxWallTime(10);
+        /*
+           * Use bat file if it is compiled on Windows
+           */
+        app.setExecutableLocation("/bin/echo");
+
+        /*
+           * Default tmp location
+           */
+        String tempDir = "/oasis/projects/nsf/uot111/us3/airavata-workdirs/";
+
+        app.setScratchWorkingDirectory(tempDir);
+        app.setInstalledParentPath("/opt/torque/bin/");
+
+        try {
+            airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, gsiSshHostNameTrestles, appDesc);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+    }
+
+    public void createMPIPBSDocsTrestles() {
+        HostDescription host = new HostDescription(GsisshHostType.type);
+        host.getType().setHostAddress(hpcHostAddress);
+        host.getType().setHostName(gsiSshHostNameTrestles);
+        ((GsisshHostType) host.getType()).setPort(22);
+        ((GsisshHostType) host.getType()).setInstalledPath("/opt/torque/bin/");
+
+        try {
+            airavataAPI.getApplicationManager().saveHostDescription(host);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+        /*
+        * Service Description creation and saving
+        */
+        String serviceName = "US3AppTrestles";
+        ServiceDescription serv = new ServiceDescription();
+        serv.getType().setName(serviceName);
+
+        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
+        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
+
+
+        InputParameterType input = InputParameterType.Factory.newInstance();
+        input.setParameterName("input");
+        ParameterType parameterType = input.addNewParameterType();
+        parameterType.setType(DataType.URI);
+        parameterType.setName("URI");
+
+        OutputParameterType output = OutputParameterType.Factory.newInstance();
+        output.setParameterName("output");
+        ParameterType parameterType1 = output.addNewParameterType();
+        parameterType1.setType(DataType.URI);
+        parameterType1.setName("URI");
+        
+        OutputParameterType output1 = OutputParameterType.Factory.newInstance();
+        output1.setParameterName("stdout");
+        ParameterType parameterType2 = output1.addNewParameterType();
+        parameterType2.setType(DataType.STD_OUT);
+        parameterType2.setName("StdOut");
+        
+        OutputParameterType output2 = OutputParameterType.Factory.newInstance();
+        output2.setParameterName("stderr");
+        ParameterType parameterType3 = output2.addNewParameterType();
+        parameterType3.setType(DataType.STD_ERR);
+        parameterType3.setName("StdErr");
+
+        inputList.add(input);
+        outputList.add(output);
+        outputList.add(output1);
+        outputList.add(output2);
+        
+        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);
+        OutputParameterType[] outputParamList = outputList.toArray(new OutputParameterType[outputList.size()]);
+
+        serv.getType().setInputParametersArray(inputParamList);
+        serv.getType().setOutputParametersArray(outputParamList);
+        try {
+            airavataAPI.getApplicationManager().saveServiceDescription(serv);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+
+        /*
+            Application descriptor creation and saving
+         */
+        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
+        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
+        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+        name.setStringValue(serviceName);
+        app.setApplicationName(name);
+        ProjectAccountType projectAccountType = app.addNewProjectAccount();
+        projectAccountType.setProjectAccountNumber("uot111");
+
+        QueueType queueType = app.addNewQueue();
+        queueType.setQueueName("normal");
+
+        app.setCpuCount(1);
+        app.setJobType(JobTypeType.MPI);
+        app.setNodeCount(32);
+        app.setProcessorsPerNode(2);
+        app.setMaxWallTime(10);
+        /*
+           * Use bat file if it is compiled on Windows
+           */
+        app.setExecutableLocation("/home/us3/trestles/bin/us_mpi_analysis");
+
+        /*
+           * Default tmp location
+           */
+        String tempDir = "/oasis/projects/nsf/uot111/us3/airavata-workdirs/";
+        app.setScratchWorkingDirectory(tempDir);
+        app.setInstalledParentPath("/opt/torque/bin/");
+        app.setJobSubmitterCommand("/opt/mvapich2/pgi/ib/bin/mpiexec");
+        try {
+            airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, gsiSshHostNameTrestles, appDesc);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+    }
+    public void createMPISLURMDocsStampede() {
+        HostDescription host = new HostDescription(GsisshHostType.type);
+        host.getType().setHostAddress("stampede.tacc.xsede.org");
+        host.getType().setHostName("gsissh-stampede");
+        ((GsisshHostType) host.getType()).setJobManager("slurm");
+        ((GsisshHostType) host.getType()).setInstalledPath("/usr/bin/");
+        ((GsisshHostType) host.getType()).setPort(2222);
+      
+        try {
+            airavataAPI.getApplicationManager().saveHostDescription(host);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+        /*
+        * Service Description creation and saving
+        */
+        String serviceName = "US3AppStampede";
+        ServiceDescription serv = new ServiceDescription();
+        serv.getType().setName(serviceName);
+
+        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
+        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
+
+
+        InputParameterType input = InputParameterType.Factory.newInstance();
+        input.setParameterName("input");
+        ParameterType parameterType = input.addNewParameterType();
+        parameterType.setType(DataType.URI);
+        parameterType.setName("URI");
+
+        OutputParameterType output = OutputParameterType.Factory.newInstance();
+        output.setParameterName("output");
+        ParameterType parameterType1 = output.addNewParameterType();
+        parameterType1.setType(DataType.URI);
+        parameterType1.setName("URI");
+        
+        OutputParameterType output1 = OutputParameterType.Factory.newInstance();
+        output1.setParameterName("stdout");
+        ParameterType parameterType2 = output1.addNewParameterType();
+        parameterType2.setType(DataType.STD_OUT);
+        parameterType2.setName("StdOut");
+        
+        OutputParameterType output2 = OutputParameterType.Factory.newInstance();
+        output2.setParameterName("stderr");
+        ParameterType parameterType3 = output2.addNewParameterType();
+        parameterType3.setType(DataType.STD_ERR);
+        parameterType3.setName("StdErr");
+
+        inputList.add(input);
+        outputList.add(output);
+        outputList.add(output1);
+        outputList.add(output2);
+        
+        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);
+        OutputParameterType[] outputParamList = outputList.toArray(new OutputParameterType[outputList.size()]);
+
+        serv.getType().setInputParametersArray(inputParamList);
+        serv.getType().setOutputParametersArray(outputParamList);
+        try {
+            airavataAPI.getApplicationManager().saveServiceDescription(serv);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+
+        /*
+            Application descriptor creation and saving
+         */
+        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
+        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
+        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+        name.setStringValue(serviceName);
+        app.setApplicationName(name);
+        ProjectAccountType projectAccountType = app.addNewProjectAccount();
+        projectAccountType.setProjectAccountNumber("TG-MCB070039N");
+
+        QueueType queueType = app.addNewQueue();
+        queueType.setQueueName("normal");
+
+        app.setCpuCount(1);
+        app.setJobType(JobTypeType.MPI);
+        app.setNodeCount(32);
+        app.setProcessorsPerNode(2);
+        app.setMaxWallTime(10);
+        /*
+           * Use bat file if it is compiled on Windows
+           */
+        app.setExecutableLocation("/home1/01623/us3/bin/us_mpi_analysis");
+
+        /*
+           * Default tmp location
+           */
+        String tempDir = "/home1/01623/us3";
+        app.setScratchWorkingDirectory(tempDir);
+        app.setInstalledParentPath("/usr/bin/");
+        app.setJobSubmitterCommand("/usr/local/bin/ibrun");
+        try {
+            airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, gsiSshHostNameStampede, appDesc);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+    }
+    public void createEchoSlurmDocsofStampede() {
+        HostDescription host = new HostDescription(GsisshHostType.type);
+        host.getType().setHostAddress("stampede.tacc.xsede.org");
+        host.getType().setHostName("stampede-host");
+        ((GsisshHostType) host.getType()).setJobManager("slurm");
+        ((GsisshHostType) host.getType()).setInstalledPath("/usr/bin/");
+        ((GsisshHostType) host.getType()).setPort(2222);
+        ((GsisshHostType) host.getType()).setMonitorMode("push");
+//        ((GsisshHostType) host.getType()).setMo(2222);
+
+
+        try {
+            airavataAPI.getApplicationManager().saveHostDescription(host);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+        /*
+        * Service Description creation and saving
+        */
+        String serviceName = "US3EchoStampede";
+        ServiceDescription serv = new ServiceDescription();
+        serv.getType().setName(serviceName);
+
+        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
+        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
+
+
+        InputParameterType input = InputParameterType.Factory.newInstance();
+        input.setParameterName("echo_input");
+        ParameterType parameterType = input.addNewParameterType();
+        parameterType.setType(DataType.STRING);
+        parameterType.setName("String");
+
+        OutputParameterType output = OutputParameterType.Factory.newInstance();
+        output.setParameterName("echo_output");
+        ParameterType parameterType1 = output.addNewParameterType();
+        parameterType1.setType(DataType.STRING);
+        parameterType1.setName("String");
+
+        inputList.add(input);
+        outputList.add(output);
+
+        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);
+        OutputParameterType[] outputParamList = outputList.toArray(new OutputParameterType[outputList.size()]);
+
+        serv.getType().setInputParametersArray(inputParamList);
+        serv.getType().setOutputParametersArray(outputParamList);
+        try {
+            airavataAPI.getApplicationManager().saveServiceDescription(serv);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+
+        /*
+           Application descriptor creation and saving
+        */
+        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
+        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
+        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+        name.setStringValue(serviceName);
+        app.setApplicationName(name);
+        ProjectAccountType projectAccountType = app.addNewProjectAccount();
+        projectAccountType.setProjectAccountNumber("TG-MCB070039N");
+
+        QueueType queueType = app.addNewQueue();
+        queueType.setQueueName("normal");
+
+        app.setCpuCount(1);
+        app.setJobType(JobTypeType.SERIAL);
+        app.setNodeCount(1);
+        app.setProcessorsPerNode(1);
+        app.setMaxWallTime(10);
+        /*
+        * Use bat file if it is compiled on Windows
+        */
+        app.setExecutableLocation("/bin/echo");
+
+        /*
+        * Default tmp location
+        */
+        String tempDir = "/home1/01623/us3";
+       
+        app.setScratchWorkingDirectory(tempDir);
+        app.setInstalledParentPath("/usr/bin/");
+
+        try {
+            airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, gsiSshHostNameStampede, appDesc);
+        } catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+    }
+
+    public AiravataAPI getAiravataAPI() {
+        return airavataAPI;
+    }
+
+    public void setAiravataAPI(AiravataAPI airavataAPI) {
+        this.airavataAPI = airavataAPI;
+    }
+}