airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hes...@apache.org
Subject svn commit: r1397560 - in /airavata/sandbox/client-api-demo: ./ src/main/java/org/sample/airavata/api/ src/main/webapp/
Date Fri, 12 Oct 2012 13:34:17 GMT
Author: heshan
Date: Fri Oct 12 13:34:16 2012
New Revision: 1397560

URL: http://svn.apache.org/viewvc?rev=1397560&view=rev
Log:
Updating the use of the Airavata API.

Added:
    airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/WebAppConstants.java
Modified:
    airavata/sandbox/client-api-demo/deploy.sh
    airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/DescriptorRegistrationSample.java
    airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/SampleUtil.java
    airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/WorkflowExecutionSample.java
    airavata/sandbox/client-api-demo/src/main/webapp/deployment.properties
    airavata/sandbox/client-api-demo/src/main/webapp/execute_workflow_result.jsp
    airavata/sandbox/client-api-demo/src/main/webapp/monitor_experiment_result.jsp
    airavata/sandbox/client-api-demo/src/main/webapp/register_app_result.jsp

Modified: airavata/sandbox/client-api-demo/deploy.sh
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/deploy.sh?rev=1397560&r1=1397559&r2=1397560&view=diff
==============================================================================
--- airavata/sandbox/client-api-demo/deploy.sh (original)
+++ airavata/sandbox/client-api-demo/deploy.sh Fri Oct 12 13:34:16 2012
@@ -1,22 +1,17 @@
 #!/bin/bash 
 echo "Building the source."
-mvn clean install 
-
-echo "Copying generated classes directory to Tomcat"
-cp -rf target/classes/ /home/heshan/Dev/xsede12/tools/apache-tomcat-7.0.28/webapps/demo/
-echo "Copying generated jar to Tomcat"
-cp target/client-api-sample-1.0-SNAPSHOT.jar /home/heshan/Dev/xsede12/tools/apache-tomcat-7.0.28/webapps/demo/WEB-INF/lib/
-v
-
-echo "Copying JSPs to tomcat"
-cp /home/heshan/Dev/xsede12/simplegrid-airavata-sample/client-api-sample/src/main/java/*.jsp
/home/heshan/Dev/xsede12/tools/apache-tomcat-7.0.28/webapps/demo 
-echo "Copying deployment.properties to tomcat"
-cp /home/heshan/Dev/xsede12/simplegrid-airavata-sample/client-api-sample/src/main/java/deployment.properties
/home/heshan/Dev/xsede12/tools/apache-tomcat-7.0.28/webapps/demo 
-
-echo "Copying all the jars to the WEB-INF/lib for now. TODO: should clean this up"
-cp /home/heshan/Dev/incubator/airavata/trunk/modules/distribution/target/apache-airavata-0.4-incubating-SNAPSHOT/standalone-server/lib/*.jar
/home/heshan/Dev/xsede12/tools/apache-tomcat-7.0.28/webapps/demo/WEB-INF/lib/ 
-
-cp /home/heshan/Dev/incubator/airavata/trunk/modules/airavata-client/target/airavata-client-api-0.4-incubating-SNAPSHOT.jar
/home/heshan/Dev/xsede12/tools/apache-tomcat-7.0.28/webapps/demo/WEB-INF/lib/ 
-
-cp /home/heshan/Dev/incubator/airavata/trunk/modules/distribution/target/apache-airavata-0.4-incubating-SNAPSHOT/standalone-server/repository/services/*.jar
/home/heshan/Dev/xsede12/tools/apache-tomcat-7.0.28/webapps/demo/WEB-INF/lib/ 
+mvn clean install -Dmaven.test.skip=true -o
 
+echo "Removing the old war ..."
+rm -r -f /home/heshan/Dev/sc12/demo1/apache-tomcat-7.0.28/webapps/client-api-demo*
+echo "Copying the client-api-demo war to webapps"
+cp target/client-api-demo.war /home/heshan/Dev/sc12/demo1/apache-tomcat-7.0.28/webapps
+
+sleep 10
+echo "Copying the repository.properties to webapp ..."
+cp /home/heshan/Dev/sc12/demo1/repository.properties /home/heshan/Dev/sc12/demo1/apache-tomcat-7.0.28/webapps/client-api-demo/WEB-INF/classes/
+echo "Copying the deployment.properties to webapp ..."
+cp /home/heshan/Dev/sc12/demo1/deployment.properties /home/heshan/Dev/sc12/demo1/apache-tomcat-7.0.28/webapps/client-api-demo/
+echo "Copying the deployment.properties to webapp ... again to classes TODO : Fix this"
+cp /home/heshan/Dev/sc12/demo1/deployment.properties /home/heshan/Dev/sc12/demo1/apache-tomcat-7.0.28/webapps/client-api-demo/WEB-INF/classes/
 

Modified: airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/DescriptorRegistrationSample.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/DescriptorRegistrationSample.java?rev=1397560&r1=1397559&r2=1397560&view=diff
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/DescriptorRegistrationSample.java
(original)
+++ airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/DescriptorRegistrationSample.java
Fri Oct 12 13:34:16 2012
@@ -27,7 +27,7 @@ public class DescriptorRegistrationSampl
 
     // TODO
     public static void registerApplication(AppDescriptorBean appDescriptorBean) throws Exception
{
-        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI(appDescriptorBean.getUsername(),
appDescriptorBean.getPassword(), appDescriptorBean.getRegistryRMIURI());
+        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI();
 
         // Create Host Description
         HostDescription host = new HostDescription();
@@ -114,7 +114,7 @@ public class DescriptorRegistrationSampl
         try {
 
             DefaultInvocationContext ct = new DefaultInvocationContext();
-            AiravataAPI airavataAPI = SampleUtil.getAiravataAPI(username, password, registryRMIURI);
+            AiravataAPI airavataAPI = SampleUtil.getAiravataAPI();
             DefaultExecutionContext ec = airavataAPI.getExecutionManager().createDefaultExecutionContext();
             ct.setExecutionContext(ec);
 

Modified: airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/SampleUtil.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/SampleUtil.java?rev=1397560&r1=1397559&r2=1397560&view=diff
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/SampleUtil.java
(original)
+++ airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/SampleUtil.java
Fri Oct 12 13:34:16 2012
@@ -1,35 +1,56 @@
 package org.sample.airavata.api;
 
+import org.apache.airavata.client.AiravataClient;
 import org.apache.airavata.client.AiravataClientUtils;
 import org.apache.airavata.client.api.AiravataAPI;
 import org.apache.airavata.common.registry.api.exception.RegistryException;
 
 import javax.jcr.RepositoryException;
+import java.io.IOException;
+import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
 
 public class SampleUtil {
 
-    public static AiravataAPI getAiravataAPI(String username, String password, String registryRMIURI)
{
-        URI registryURI = null;
+    public static AiravataAPI getAiravataAPI() {
+        AiravataAPI airavataAPI = null;
         try {
-            registryURI = new URI(registryRMIURI);
-        } catch (URISyntaxException e) {
+            airavataAPI = AiravataClientUtils.getAPI(createConfigMap());
+        } catch (MalformedURLException e) {
             e.printStackTrace();
         }
+        return airavataAPI;
+    }
 
-        AiravataAPI airavataAPI = null;
+
+    private static Map<String, String> createConfigMap() {
+        Properties prop = new Properties();
+        InputStream resourceAsStream = SampleUtil.class.getClassLoader().getResourceAsStream("/deployment.properties");
         try {
-            airavataAPI = AiravataClientUtils.getAPI(registryURI, username, password);
-        } catch (MalformedURLException e) {
-            e.printStackTrace();
-        } catch (RepositoryException e) {
-            e.printStackTrace();
-        } catch (RegistryException e) {
+            prop.load(resourceAsStream);
+        } catch (IOException e) {
             e.printStackTrace();
         }
-        return airavataAPI;
+        String hostName = prop.getProperty(WebAppConstants.HOST_NAME);
+        String certLocation = prop.getProperty(WebAppConstants.CA_CERT_PATH);
+
+        Map<String, String> config = new HashMap<String, String>();
+        config.put(AiravataClient.MSGBOX, hostName + "/axis2/services/MsgBoxService");
+        config.put(AiravataClient.BROKER, hostName + "/axis2/services/EventingService");
+        config.put(AiravataClient.WORKFLOWSERVICEURL, hostName + "/axis2/services/WorkflowInterpretor?wsdl");
+        config.put(AiravataClient.JCR, hostName + "/jackrabbit-webapp-2.4.0/rmi");
+        config.put(AiravataClient.JCR_USERNAME, "admin");
+        config.put(AiravataClient.JCR_PASSWORD, "admin");
+        config.put(AiravataClient.GFAC, hostName + "/axis2/services/GFacService");
+        config.put(AiravataClient.WITHLISTENER, "false");
+        config.put(AiravataClient.TRUSTED_CERT_LOCATION, certLocation);
+
+        return config;
     }
 
 }

Added: airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/WebAppConstants.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/WebAppConstants.java?rev=1397560&view=auto
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/WebAppConstants.java
(added)
+++ airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/WebAppConstants.java
Fri Oct 12 13:34:16 2012
@@ -0,0 +1,6 @@
+package org.sample.airavata.api;
+
+public class WebAppConstants {
+    public static final String CA_CERT_PATH = "ca.certificates.directory";
+    public static final String HOST_NAME = "host.name";
+}

Modified: airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/WorkflowExecutionSample.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/WorkflowExecutionSample.java?rev=1397560&r1=1397559&r2=1397560&view=diff
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/WorkflowExecutionSample.java
(original)
+++ airavata/sandbox/client-api-demo/src/main/java/org/sample/airavata/api/WorkflowExecutionSample.java
Fri Oct 12 13:34:16 2012
@@ -25,33 +25,33 @@ public class WorkflowExecutionSample {
     }
 
     public static URI getWorkflowInterpreterServiceURL(String username, String password,
String registryRMIURI) throws AiravataAPIInvocationException {
-        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI(username, password, registryRMIURI);
+        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI();
         return airavataAPI.getAiravataManager().getWorkflowInterpreterServiceURL();
     }
 
     public static URI getGFaCURL(String username, String password, String registryRMIURI)
throws AiravataAPIInvocationException {
-        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI(username, password, registryRMIURI);
+        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI();
         return airavataAPI.getAiravataManager().getGFaCURL();
     }
 
     public static URI getRegistryURL(String username, String password, String registryRMIURI)
throws AiravataAPIInvocationException {
-        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI(username, password, registryRMIURI);
+        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI();
         return airavataAPI.getAiravataManager().getRegistryURL();
     }
 
     public static URI getMessageBoxServiceURL(String username, String password, String registryRMIURI)
throws AiravataAPIInvocationException {
-        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI(username, password, registryRMIURI);
+        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI();
         return airavataAPI.getAiravataManager().getMessageBoxServiceURL();
     }
 
     public static URI getEventingServiceURL(String username, String password, String registryRMIURI)
throws AiravataAPIInvocationException {
-        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI(username, password, registryRMIURI);
+        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI();
         return airavataAPI.getAiravataManager().getEventingServiceURL();
     }
 
     public static String runWorkflow(String username, String password, String registryRMIURI,
String workflowTemplateId) {
 
-        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI(username, password, registryRMIURI);
+        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI();
         List<WorkflowInput> workflowInputs = null;
         try {
             workflowInputs = airavataAPI.getWorkflowManager().getWorkflow(workflowTemplateId).getWorkflowInputs();
@@ -92,7 +92,7 @@ public class WorkflowExecutionSample {
 /*    public static List<WorkflowInstance> getWorkflowInstanceList(String username,
                                                                  String password,
                                                                  String registryRMIURI) {
-        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI(username, password, registryRMIURI);
+        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI();
         try {
             List<WorkflowInstance> workflowInstances = airavataAPI.getProvenanceManager().getWorkflowInstances(airavataAPI.getCurrentUser());
             return workflowInstances;
@@ -106,7 +106,7 @@ public class WorkflowExecutionSample {
                                                            String password,
                                                            String registryRMIURI,
                                                            WorkflowInstance workflowInstance)
{
-        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI(username, password, registryRMIURI);
+        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI();
         try {
             WorkflowInstanceData workflowInstanceData = airavataAPI.getProvenanceManager().getWorkflowInstanceData(workflowInstance);
             return workflowInstance;
@@ -119,7 +119,7 @@ public class WorkflowExecutionSample {
     public static List<String> getUserExperimentsList(String username,
                                                       String password,
                                                       String registryRMIURI) {
-        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI(username, password, registryRMIURI);
+        AiravataAPI airavataAPI = SampleUtil.getAiravataAPI();
         try {
             List<String> experiments = airavataAPI.getProvenanceManager().getExperimentIdList(airavataAPI.getCurrentUser());
             //airavataAPI.getProvenanceManager().getWorkflowInstanceData(new WorkflowInstance("MultiplyWorkflow_0c5c975e-0d8c-4ba9-833a-c7ee76c4ab49","MultiplyWorkflow_0c5c975e-0d8c-4ba9-833a-c7ee76c4ab49"));

Modified: airavata/sandbox/client-api-demo/src/main/webapp/deployment.properties
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/webapp/deployment.properties?rev=1397560&r1=1397559&r2=1397560&view=diff
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/webapp/deployment.properties (original)
+++ airavata/sandbox/client-api-demo/src/main/webapp/deployment.properties Fri Oct 12 13:34:16
2012
@@ -1,7 +1,10 @@
+ca.certificates.directory=/home/heshan/Dev/setup/gram-provider/certificates
+host.name=http://localhost:8080
+
+# redundant params
 jcr.username=admin
 jcr.password=admin
 jcr.url=http://localhost:8090/jackrabbit-webapp-2.4.0/rmi
-ca.certificates.directory=/home/heshan/Dev/setup/gram-provider/certificates
 myproxy.username=
 myproxy.password=
 myproxy.server=myproxy.teragrid.org

Modified: airavata/sandbox/client-api-demo/src/main/webapp/execute_workflow_result.jsp
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/webapp/execute_workflow_result.jsp?rev=1397560&r1=1397559&r2=1397560&view=diff
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/webapp/execute_workflow_result.jsp (original)
+++ airavata/sandbox/client-api-demo/src/main/webapp/execute_workflow_result.jsp Fri Oct 12
13:34:16 2012
@@ -61,7 +61,9 @@
             String result = null;
             try {
                 // String workflowTemplateId,List<WorkflowInput> inputs, String user,
String metadata, String workflowInstanceName
-                result = airavataAPI.getExecutionManager().runExperiment(workflowName, workflowInputs,
"admin", "", workflowName);
+                // TODO Check this! NOT WORKING
+                result = airavataAPI.getExecutionManager().runExperiment(workflowName, workflowInputs,
"airavata", "", workflowName);
+
             } catch (AiravataAPIInvocationException e) {
                 e.printStackTrace();
 //                  TODO alert(e)

Modified: airavata/sandbox/client-api-demo/src/main/webapp/monitor_experiment_result.jsp
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/webapp/monitor_experiment_result.jsp?rev=1397560&r1=1397559&r2=1397560&view=diff
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/webapp/monitor_experiment_result.jsp (original)
+++ airavata/sandbox/client-api-demo/src/main/webapp/monitor_experiment_result.jsp Fri Oct
12 13:34:16 2012
@@ -31,7 +31,7 @@
             String password = props.getProperty("jcr.password");
             String registryURL = props.getProperty("jcr.url");
 
-            AiravataAPI airavataAPI = SampleUtil.getAiravataAPI(username, password, registryURL);
+            AiravataAPI airavataAPI = SampleUtil.getAiravataAPI();
             ProvenanceManager provenanceManager = airavataAPI.getProvenanceManager();
 
             String experimentID = request.getParameter("experimentID");
@@ -91,11 +91,12 @@
                                 e.printStackTrace();
                             }
 
+                            if (ioParameterData != null)
                             for (NameValue next : ioParameterData) {
                                 String inputName = next.getName();
                                 String inputValue = next.getValue();
-//                                System.out.println("input name : " + inputName);
-//                                System.out.println("input value : " + inputValue);
+                                System.out.println("input name : " + inputName);
+                                System.out.println("input value : " + inputValue);
 
                 %>
                 <tr>
@@ -106,6 +107,9 @@
                 </tr>
                 <%
 
+                            } else {
+                                // TODO Check
+                                System.out.println("IO parameter Data is null !!!");
                             }
 
                         }

Modified: airavata/sandbox/client-api-demo/src/main/webapp/register_app_result.jsp
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/webapp/register_app_result.jsp?rev=1397560&r1=1397559&r2=1397560&view=diff
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/webapp/register_app_result.jsp (original)
+++ airavata/sandbox/client-api-demo/src/main/webapp/register_app_result.jsp Fri Oct 12 13:34:16
2012
@@ -67,7 +67,7 @@
 //                  TODO alert()
             }
 
-            out.print("Registration was successful");
+            System.out.println("Registration was successful");
 
             System.out.println("Registration DONE!");
         %>



Mime
View raw message