| 
      
      
      From: <las...@us...> - 2007-10-28 16:43:49
       | 
| Revision: 1808
          http://cogkit.svn.sourceforge.net/cogkit/?rev=1808&view=rev
Author:   laszewsk
Date:     2007-10-28 09:43:47 -0700 (Sun, 28 Oct 2007)
Log Message:
-----------
reorganizing source
Added Paths:
-----------
    trunk/cyberaide/src/js/
    trunk/cyberaide/src/js/README.txt
    trunk/cyberaide/src/js/securelogin/
    trunk/cyberaide/src/js/src/
Removed Paths:
-------------
    trunk/cyberaide/src/javascript/
    trunk/cyberaide/src/js/README.txt
    trunk/cyberaide/src/js/sample/
    trunk/cyberaide/src/js/src/
Copied: trunk/cyberaide/src/js (from rev 1804, trunk/cyberaide/src/javascript)
Deleted: trunk/cyberaide/src/js/README.txt
===================================================================
--- trunk/cyberaide/src/javascript/README.txt	2007-10-28 16:34:33 UTC (rev 1804)
+++ trunk/cyberaide/src/js/README.txt	2007-10-28 16:43:47 UTC (rev 1808)
@@ -1 +0,0 @@
-see ../../README.txt
Copied: trunk/cyberaide/src/js/README.txt (from rev 1807, trunk/cyberaide/src/javascript/README.txt)
===================================================================
--- trunk/cyberaide/src/js/README.txt	                        (rev 0)
+++ trunk/cyberaide/src/js/README.txt	2007-10-28 16:43:47 UTC (rev 1808)
@@ -0,0 +1 @@
+see ../../README.txt
Copied: trunk/cyberaide/src/js/securelogin (from rev 1807, trunk/cyberaide/src/javascript/securelogin)
Copied: trunk/cyberaide/src/js/src (from rev 1807, trunk/cyberaide/src/javascript/src)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <fug...@us...> - 2007-11-02 18:33:59
       | 
| Revision: 1827
          http://cogkit.svn.sourceforge.net/cogkit/?rev=1827&view=rev
Author:   fugangwang
Date:     2007-11-02 11:33:58 -0700 (Fri, 02 Nov 2007)
Log Message:
-----------
restore the src directory
Added Paths:
-----------
    trunk/cyberaide/src/README.txt
    trunk/cyberaide/src/axis2/
    trunk/cyberaide/src/axis2/README.txt
    trunk/cyberaide/src/jaxws/
    trunk/cyberaide/src/jaxws/test/
    trunk/cyberaide/src/jaxws/test/README.txt
    trunk/cyberaide/src/jaxws/test/testCircleService/
    trunk/cyberaide/src/jaxws/test/testCircleService/CircleFunctions.java
    trunk/cyberaide/src/jaxws/test/testCircleService/Makefile
    trunk/cyberaide/src/jaxws/test/testCircleService/TestCircleFunctions.java
    trunk/cyberaide/src/jaxws/test/testCircleService/stop.sh
    trunk/cyberaide/src/jaxws/test/testMultipleService/
    trunk/cyberaide/src/jaxws/test/testMultipleService/CircleFunctions.java
    trunk/cyberaide/src/jaxws/test/testMultipleService/Makefile
    trunk/cyberaide/src/jaxws/test/testMultipleService/SquareFunctions.java
    trunk/cyberaide/src/jaxws/test/testMultipleService/TestMultipleService.java
    trunk/cyberaide/src/jaxws/test/testMultipleService/stop.sh
    trunk/cyberaide/src/js/
    trunk/cyberaide/src/js/README.txt
    trunk/cyberaide/src/js/java/
    trunk/cyberaide/src/js/java/CoGHandler/
    trunk/cyberaide/src/js/java/CoGHandler/.classpath
    trunk/cyberaide/src/js/java/CoGHandler/.project
    trunk/cyberaide/src/js/java/CoGHandler/SimpleHandler.java
    trunk/cyberaide/src/js/java/CoGHandler/SimpleHandlerStub.java
    trunk/cyberaide/src/js/securelogin/
    trunk/cyberaide/src/js/securelogin/WEB-INF/
    trunk/cyberaide/src/js/securelogin/WEB-INF/classes/
    trunk/cyberaide/src/js/securelogin/WEB-INF/classes/org/
    trunk/cyberaide/src/js/securelogin/WEB-INF/classes/org/apache/
    trunk/cyberaide/src/js/securelogin/WEB-INF/classes/org/apache/xmlrpc/
    trunk/cyberaide/src/js/securelogin/WEB-INF/classes/org/apache/xmlrpc/webserver/
    trunk/cyberaide/src/js/securelogin/WEB-INF/classes/org/apache/xmlrpc/webserver/XmlRpcServlet.properties
    trunk/cyberaide/src/js/securelogin/WEB-INF/classes/zhguo/
    trunk/cyberaide/src/js/securelogin/WEB-INF/classes/zhguo/test/
    trunk/cyberaide/src/js/securelogin/WEB-INF/web.xml
    trunk/cyberaide/src/js/securelogin/cogkit/
    trunk/cyberaide/src/js/securelogin/cogkit/CoGHandler.js
    trunk/cyberaide/src/js/securelogin/www/
    trunk/cyberaide/src/js/securelogin/www/error.html
    trunk/cyberaide/src/js/securelogin/www/index.html
    trunk/cyberaide/src/js/securelogin/www/login.html
Added: trunk/cyberaide/src/README.txt
===================================================================
--- trunk/cyberaide/src/README.txt	                        (rev 0)
+++ trunk/cyberaide/src/README.txt	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1 @@
+see ../README.txt
Added: trunk/cyberaide/src/axis2/README.txt
===================================================================
--- trunk/cyberaide/src/axis2/README.txt	                        (rev 0)
+++ trunk/cyberaide/src/axis2/README.txt	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1 @@
+see ../../README.txt
Added: trunk/cyberaide/src/jaxws/test/README.txt
===================================================================
--- trunk/cyberaide/src/jaxws/test/README.txt	                        (rev 0)
+++ trunk/cyberaide/src/jaxws/test/README.txt	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,3 @@
+./testCircleService/ contains a test example to deploy a web service using jaxws and consume it from a java client program
+./testMultipleService/ contains a test example to deploy two web services at one host using jaxws and consume the two services from a single java client program
+The build class files and stubs generated by wsgen and wsimport are stored in /cyberaide/build/org/cogkit/cyberaide/jaxws/test; the generated wsdl files are stored in /cyberaide/build/wsdl
Added: trunk/cyberaide/src/jaxws/test/testCircleService/CircleFunctions.java
===================================================================
--- trunk/cyberaide/src/jaxws/test/testCircleService/CircleFunctions.java	                        (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testCircleService/CircleFunctions.java	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,44 @@
+/*
+ * CircleFunctions.java
+ * 
+ * @version:
+ *     $Id v1.2$
+ *
+ * Revisions:
+ *     10/28/2007  Initial version
+ *     11/01/2007  modify package name
+ *                 modify package name to use in multiple service deployment
+ *     11/02/2007  modify package name to fit into the global project
+ */
+package org.cogkit.cyberaide.jaxws.test.circlefunctions.service;
+
+import javax.jws.WebService;
+import javax.xml.ws.Endpoint;
+
+@WebService
+public class CircleFunctions {
+    
+	/*
+	 * return area of a circle
+	 */	
+	public double getArea(double r) {
+       return java.lang.Math.PI * (r * r);
+    }
+	
+	/*
+	 * return circumference of a circle
+	 */	
+    public double getCircumference(double r) {
+        return 2 * java.lang.Math.PI * r;
+    }
+   
+    /*
+	 * publish the service
+	 */	
+    public static void main(String[] args) {
+
+          Endpoint.publish(
+             "http://localhost:8080/jaxws/circlefunctions",
+             new CircleFunctions());
+    }
+}
Added: trunk/cyberaide/src/jaxws/test/testCircleService/Makefile
===================================================================
--- trunk/cyberaide/src/jaxws/test/testCircleService/Makefile	                        (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testCircleService/Makefile	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,28 @@
+all: compile service client stop
+	@echo done
+
+init:
+	mkdir -p ../../../../build/wsdl/circlefunctions
+
+compile: init
+	javac -d ../../../../build/ CircleFunctions.java
+
+service:
+	@echo "Starting the two services..."
+	wsgen -cp ../../../../build/ -d ../../../../build/ -r ../../../../build/wsdl/circlefunctions/ -wsdl org.cogkit.cyberaide.jaxws.test.circlefunctions.service.CircleFunctions
+	java -cp ../../../../build/ org.cogkit.cyberaide.jaxws.test.circlefunctions.service.CircleFunctions &
+	sleep 2
+
+client:
+	@echo "Generating and running client..."
+	wsimport -keep -d ../../../../build/ -p org.cogkit.cyberaide.jaxws.test.circlefunctions.clientstub http://localhost:8080/jaxws/circlefunctions?WSDL
+	javac -cp ../../../../build/ -d ../../../../build/ TestCircleFunctions.java
+	java -cp ../../../../build/ org.cogkit.cyberaide.jaxws.test.circlefunctions.client.TestCircleFunctions
+
+stop:
+	@echo "Stopping services..."
+	sh stop.sh
+
+clean:
+	rm -fr ../../../../build/org/cogkit/cyberaide/jaxws/test/circlefunctions
+	rm -fr ../../../../build/wsdl/circlefunctions
Added: trunk/cyberaide/src/jaxws/test/testCircleService/TestCircleFunctions.java
===================================================================
--- trunk/cyberaide/src/jaxws/test/testCircleService/TestCircleFunctions.java	                        (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testCircleService/TestCircleFunctions.java	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,56 @@
+/*
+ * TestCircleFunctions.java
+ * 
+ * @version:
+ *     $Id v1.0$
+ *
+ * Revisions:
+ *     11/01/2007  Initial version
+ *     11/02/2007  modify package name to fit into the global project
+ *
+ */
+package org.cogkit.cyberaide.jaxws.test.circlefunctions.client;
+
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import org.cogkit.cyberaide.jaxws.test.circlefunctions.clientstub.*;
+import org.cogkit.cyberaide.jaxws.test.circlefunctions.clientstub.*;
+
+/**
+ * test circle functions services on a remote server
+ */
+public class TestCircleFunctions {
+    static CircleFunctionsService service = new CircleFunctionsService();
+
+    public static void main(String[] args) {
+        try {
+            TestCircleFunctions client = new TestCircleFunctions();
+            client.doTest(args);
+        } catch(Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void doTest(String[] args) {
+        try {
+            System.out.println("------------------from Client running------------------");
+            System.out.println("Retrieving the port from the following service:\n\t " + service);
+            CircleFunctions port = service.getCircleFunctionsPort();
+            double radius,area,circumference;
+            
+            System.out.println("Invoking the getArea operation on the port...");
+            System.out.print("Response from server:\n\tThe area of a circle with radius 10:");
+            radius = 10;
+            area = port.getArea(radius);
+            System.out.println( area );
+            
+            System.out.println("Invoking the getCircumference operation on the port...");
+            System.out.print("Response from server:\n\tThe circumference of a circle with radius 10:");
+            circumference = port.getCircumference(radius);
+            System.out.println( circumference );
+
+        } catch(Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
Added: trunk/cyberaide/src/jaxws/test/testCircleService/stop.sh
===================================================================
--- trunk/cyberaide/src/jaxws/test/testCircleService/stop.sh	                        (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testCircleService/stop.sh	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1 @@
+kill -9 `ps -a|grep java|awk '{print $1}'`
Added: trunk/cyberaide/src/jaxws/test/testMultipleService/CircleFunctions.java
===================================================================
--- trunk/cyberaide/src/jaxws/test/testMultipleService/CircleFunctions.java	                        (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testMultipleService/CircleFunctions.java	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,44 @@
+/*
+ * CircleFunctions.java
+ * 
+ * @version:
+ *     $Id v1.2$
+ *
+ * Revisions:
+ *     10/28/2007  Initial version
+ *     11/01/2007  modify package name
+ *                 modify package name to use in multiple service deployment
+ *     11/02/2007  modify package name to fit into the global project
+ */
+package org.cogkit.cyberaide.jaxws.test.multipleservice.service.circle;
+
+import javax.jws.WebService;
+import javax.xml.ws.Endpoint;
+
+@WebService
+public class CircleFunctions {
+    
+	/*
+	 * return area of a circle
+	 */	
+	public double getArea(double r) {
+       return java.lang.Math.PI * (r * r);
+    }
+	
+	/*
+	 * return circumference of a circle
+	 */	
+    public double getCircumference(double r) {
+        return 2 * java.lang.Math.PI * r;
+    }
+   
+    /*
+	 * publish the service
+	 */	
+    public static void main(String[] args) {
+
+          Endpoint.publish(
+             "http://localhost:8080/jaxws/circlefunctions",
+             new CircleFunctions());
+    }
+}
Added: trunk/cyberaide/src/jaxws/test/testMultipleService/Makefile
===================================================================
--- trunk/cyberaide/src/jaxws/test/testMultipleService/Makefile	                        (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testMultipleService/Makefile	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,33 @@
+all: compile service client stop
+	@echo done
+
+init:
+	mkdir -p ../../../../build/wsdl/multipleservice
+
+compile: init
+	javac -d ../../../../build/ CircleFunctions.java
+	javac -d ../../../../build/ SquareFunctions.java
+
+service:
+	@echo "Starting the two services..."
+	wsgen -cp ../../../../build/ -d ../../../../build/ -r ../../../../build/wsdl/multipleservice/ -wsdl org.cogkit.cyberaide.jaxws.test.multipleservice.service.circle.CircleFunctions
+	java -cp ../../../../build/ org.cogkit.cyberaide.jaxws.test.multipleservice.service.circle.CircleFunctions &
+	sleep 2
+	wsgen -cp ../../../../build/ -d ../../../../build/ -r ../../../../build/wsdl/multipleservice/ -wsdl org.cogkit.cyberaide.jaxws.test.multipleservice.service.square.SquareFunctions
+	java -cp ../../../../build/ org.cogkit.cyberaide.jaxws.test.multipleservice.service.square.SquareFunctions &
+	sleep 2
+
+client:
+	@echo "Generating and running client..."
+	wsimport -keep -d ../../../../build/ -p org.cogkit.cyberaide.jaxws.test.multipleservice.clientstub.circle http://localhost:8080/jaxws/circlefunctions?WSDL
+	wsimport -keep -d ../../../../build/ -p org.cogkit.cyberaide.jaxws.test.multipleservice.clientstub.square http://localhost:8180/jaxws/squarefunctions?WSDL
+	javac -cp ../../../../build/ -d ../../../../build/ TestMultipleService.java
+	java -cp ../../../../build/ org.cogkit.cyberaide.jaxws.test.multipleservice.client.TestMultipleService
+
+stop:
+	@echo "Stopping services..."
+	sh stop.sh
+
+clean:
+	rm -fr ../../../../build/org/cogkit/cyberaide/jaxws/test/multipleservice
+	rm -fr ../../../../build/wsdl/multipleservice
Added: trunk/cyberaide/src/jaxws/test/testMultipleService/SquareFunctions.java
===================================================================
--- trunk/cyberaide/src/jaxws/test/testMultipleService/SquareFunctions.java	                        (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testMultipleService/SquareFunctions.java	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,43 @@
+/*
+ * SquareFunctions.java
+ * 
+ * @version:
+ *     $Id v1.0$
+ *
+ * Revisions:
+ *     11/01/2007  Initial version
+ *     11/02/2007  modify package name to fit into the global project
+ *
+ */
+package org.cogkit.cyberaide.jaxws.test.multipleservice.service.square;
+
+import javax.jws.WebService;
+import javax.xml.ws.Endpoint;
+
+@WebService
+public class SquareFunctions {
+    
+	/*
+	 * return area of a Square
+	 */	
+	public double getArea(double s) {
+       return (s * s);
+    }
+	
+	/*
+	 * return circumference of a Square
+	 */	
+    public double getCircumference(double s) {
+        return 4 * s;
+    }
+   
+    /*
+	 * publish the service
+	 */	
+    public static void main(String[] args) {
+
+          Endpoint.publish(
+             "http://localhost:8180/jaxws/squarefunctions",
+             new SquareFunctions());
+    }
+}
Added: trunk/cyberaide/src/jaxws/test/testMultipleService/TestMultipleService.java
===================================================================
--- trunk/cyberaide/src/jaxws/test/testMultipleService/TestMultipleService.java	                        (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testMultipleService/TestMultipleService.java	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,74 @@
+/*
+ * TestMultipleService.java
+ * 
+ * @version:
+ *     $Id v1.0$
+ *
+ * Revisions:
+ *     11/01/2007  Initial version
+ *     11/02/2007  modify package name to fit into the global project
+ *
+ */
+package org.cogkit.cyberaide.jaxws.test.multipleservice.client;
+
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import org.cogkit.cyberaide.jaxws.test.multipleservice.clientstub.circle.*;
+import org.cogkit.cyberaide.jaxws.test.multipleservice.clientstub.square.*;
+
+/**
+ * test consuming multiple services on a remote server
+ */
+public class TestMultipleService {
+    static CircleFunctionsService service1 = new CircleFunctionsService();
+    static SquareFunctionsService service2 = new SquareFunctionsService();
+
+    public static void main(String[] args) {
+        try {
+            TestMultipleService client = new TestMultipleService();
+            client.doTest(args);
+        } catch(Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void doTest(String[] args) {
+        try {
+            System.out.println("------------------from Client running------------------");
+            System.out.println("----------try to call the first service----------");
+            System.out.println("Retrieving the port from the following service:\n\t " + service1);
+            CircleFunctions port1 = service1.getCircleFunctionsPort();
+            double radius,area,circumference;
+            
+            System.out.println("Invoking the getArea operation on the port...");
+            System.out.print("Response from server:\n\tThe area of a circle with radius 10:");
+            radius = 10;
+            area = port1.getArea(radius);
+            System.out.println( area );
+            
+            System.out.println("Invoking the getCircumference operation on the port...");
+            System.out.print("Response from server:\n\tThe circumference of a circle with radius 10:");
+            circumference = port1.getCircumference(radius);
+            System.out.println( circumference );
+            
+            System.out.println("----------try to get to another service----------");
+            System.out.println("Retrieving the port from the following service:\n\t " + service2);
+            SquareFunctions port2 = service2.getSquareFunctionsPort();
+            double side = 10;
+            
+            System.out.println("Invoking the getArea operation on the port...");
+            System.out.print("Response from server:\n\tThe area of a square with side 10:");
+            area = port2.getArea(radius);
+            System.out.println( area );
+            
+            System.out.println("Invoking the getCircumference operation on the port...");
+            System.out.print("Response from server:\n\tThe circumference of a square with side 10:");
+            circumference = port2.getCircumference(radius);
+            System.out.println( circumference );
+            
+
+        } catch(Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
Added: trunk/cyberaide/src/jaxws/test/testMultipleService/stop.sh
===================================================================
--- trunk/cyberaide/src/jaxws/test/testMultipleService/stop.sh	                        (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testMultipleService/stop.sh	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1 @@
+kill -9 `ps -a|grep java|awk '{print $1}'`
Added: trunk/cyberaide/src/js/README.txt
===================================================================
--- trunk/cyberaide/src/js/README.txt	                        (rev 0)
+++ trunk/cyberaide/src/js/README.txt	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1 @@
+see ../../README.txt
Added: trunk/cyberaide/src/js/java/CoGHandler/.classpath
===================================================================
--- trunk/cyberaide/src/js/java/CoGHandler/.classpath	                        (rev 0)
+++ trunk/cyberaide/src/js/java/CoGHandler/.classpath	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/cyberaide/src/js/java/CoGHandler/.project
===================================================================
--- trunk/cyberaide/src/js/java/CoGHandler/.project	                        (rev 0)
+++ trunk/cyberaide/src/js/java/CoGHandler/.project	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>COGHandler</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
Added: trunk/cyberaide/src/js/java/CoGHandler/SimpleHandler.java
===================================================================
--- trunk/cyberaide/src/js/java/CoGHandler/SimpleHandler.java	                        (rev 0)
+++ trunk/cyberaide/src/js/java/CoGHandler/SimpleHandler.java	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,94 @@
+package org.cogkit.cyberaide.???.CoGHandler.test;
+
+import java.io.*;
+
+import org.cogkit.cyberaide.???.CoGHandler.test.SimpleHandlerStub.Echo;
+import org.cogkit.cyberaide.???.CoGHandler.test.SimpleHandlerStub.EchoResponse;
+import org.cogkit.cyberaide.???.CoGHandler.test.SimpleHandlerStub.CmdCOGExecute;
+import org.cogkit.cyberaide.???.CoGHandler.test.SimpleHandlerStub.CmdCOGExecuteResponse;
+
+/* 
+ * It is to be used to XML-RPC framework.
+ */
+
+
+/*
+   String apache_home = E:\\Prog ...
+   String service_home = http:/loca ....
+   String WEBINF_home = ....
+   String cog_workflow_exe = .....
+
+   long timeout = ....
+*/
+
+public class SimpleHandler{
+//	private 
+    public SimpleHandler (){}
+
+    public String echo (String input){
+	try{
+	    //write input into a file for logging
+	    File recordfile = new File("E:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\webapps\\sample\\WEB-INF\\parameters.txt");
+	    BufferedWriter br = new BufferedWriter(new FileWriter( recordfile ));
+	    br.write (input);
+	    br.close();
+	}catch (Exception e ){
+	    System.exit (1);
+	}
+	
+	SimpleHandlerStub stub 
+	    = new SimpleHandlerStub("http://localhost:8080/axis2/services/SimpleHandler");
+	Echo req = new Echo();
+	req.setInput (input);
+	EchoResponse resp = new EchoResponse();
+	
+	//call the corresponding web service
+	return "Your input is:\n" + input;
+    }
+    public static int add (OperationInterfaceStub stub) {
+        try {
+            Add req = new Add();
+            req.setParam0(op1);
+            req.setParam1(op2);
+            AddResponse resp = new AddResponse();
+            resp = stub.add(req);
+            System.out.println("done");
+            System.out.println(op1 + "+"+ op2 + " is " + resp.get_return());
+            return resp.get_return();
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.out.println("\n\n\n");
+        }
+        return 0;
+    }
+    
+    public String cmdCOGExecute( String workflow ){
+	Process wfproc = null;
+	int exit = -1;
+	try {
+	    String filename = "E:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\webapps\\sample\\WEB-INF\\workflow.xml";
+	    File recordfile = new File(filename);
+	    BufferedWriter br = new BufferedWriter(new FileWriter(recordfile));
+	    br.write(workflow);
+	    br.close();
+	    
+	    String cmd = "E:\\my_program\\cog-4_1_5\\bin\\cog-workflow.bat " + filename;
+	    long timeout = 1000 * 5;
+	    wfproc = Runtime.getRuntime().exec(cmd);
+	    synchronized(wfproc) {
+		wfproc.wait(timeout);
+	    }
+	    exit = wfproc.exitValue();
+	} catch (IllegalThreadStateException  e) {
+	    //if the thread 
+	    wfproc.destroy();
+	    return e.toString();
+	} catch (Exception e){
+	    return e.toString();
+	}
+	return "exit value " + String.valueOf(exit);
+    }
+    public static void main( String []args ){
+	SimpleHandler hd = new SimpleHandler();
+    }
+}
\ No newline at end of file
Added: trunk/cyberaide/src/js/java/CoGHandler/SimpleHandlerStub.java
===================================================================
--- trunk/cyberaide/src/js/java/CoGHandler/SimpleHandlerStub.java	                        (rev 0)
+++ trunk/cyberaide/src/js/java/CoGHandler/SimpleHandlerStub.java	2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,2882 @@
+/**
+ * SimpleHandlerStub.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: 1.3  Built on : Aug 10, 2007 (04:45:47 LKT)
+ */
+package zhguo.test;
+
+
+/*
+ *  SimpleHandlerStub java implementation
+ */
+public class SimpleHandlerStub extends org.apache.axis2.client.Stub {
+    protected org.apache.axis2.description.AxisOperation[] _operations;
+
+    //hashmaps to keep the fault mapping
+    private java.util.HashMap faultExceptionNameMap = new java.util.HashMap();
+    private java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap();
+    private java.util.HashMap faultMessageMap = new java.util.HashMap();
+    private javax.xml.namespace.QName[] opNameArray = null;
+
+    /**
+     *Constructor that takes in a configContext
+     */
+    public SimpleHandlerStub(
+        org.apache.axis2.context.ConfigurationContext configurationContext,
+        java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault {
+        this(configurationContext, targetEndpoint, false);
+    }
+
+    /**
+     * Constructor that takes in a configContext  and useseperate listner
+     */
+    public SimpleHandlerStub(
+        org.apache.axis2.context.ConfigurationContext configurationContext,
+        java.lang.String targetEndpoint, boolean useSeparateListener)
+        throws org.apache.axis2.AxisFault {
+        //To populate AxisService
+        populateAxisService();
+        populateFaults();
+
+        _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,
+                _service);
+
+        configurationContext = _serviceClient.getServiceContext()
+                                             .getConfigurationContext();
+
+        _serviceClient.getOptions()
+                      .setTo(new org.apache.axis2.addressing.EndpointReference(
+                targetEndpoint));
+        _serviceClient.getOptions().setUseSeparateListener(useSeparateListener);
+
+        //Set the soap version
+        _serviceClient.getOptions()
+                      .setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+    }
+
+    /**
+     * Default Constructor
+     */
+    public SimpleHandlerStub(
+        org.apache.axis2.context.ConfigurationContext configurationContext)
+        throws org.apache.axis2.AxisFault {
+        this(configurationContext,
+            "http://localhost:8080/axis2/services/SimpleHandler");
+    }
+
+    /**
+     * Default Constructor
+     */
+    public SimpleHandlerStub() throws org.apache.axis2.AxisFault {
+        this("http://localhost:8080/axis2/services/SimpleHandler");
+    }
+
+    /**
+     * Constructor taking the target endpoint
+     */
+    public SimpleHandlerStub(java.lang.String targetEndpoint)
+        throws org.apache.axis2.AxisFault {
+        this(null, targetEndpoint);
+    }
+
+    private void populateAxisService() throws org.apache.axis2.AxisFault {
+        //creating the Service with a unique name
+        _service = new org.apache.axis2.description.AxisService("SimpleHandler" +
+                this.hashCode());
+
+        //creating the operations
+        org.apache.axis2.description.AxisOperation __operation;
+
+        _operations = new org.apache.axis2.description.AxisOperation[3];
+
+        __operation = new org.apache.axis2.description.OutOnlyAxisOperation();
+
+        __operation.setName(new javax.xml.namespace.QName("http://test.zhguo",
+                "main"));
+        _service.addOperation(__operation);
+
+        _operations[0] = __operation;
+
+        __operation = new org.apache.axis2.description.OutInAxisOperation();
+
+        __operation.setName(new javax.xml.namespace.QName("http://test.zhguo",
+                "cmdCOGExecute"));
+        _service.addOperation(__operation);
+
+        _operations[1] = __operation;
+
+        __operation = new org.apache.axis2.description.OutInAxisOperation();
+
+        __operation.setName(new javax.xml.namespace.QName("http://test.zhguo",
+                "echo"));
+        _service.addOperation(__operation);
+
+        _operations[2] = __operation;
+    }
+
+    //populates the faults
+    private void populateFaults() {
+    }
+
+    public void main(zhguo.test.SimpleHandlerStub.Main main)
+        throws java.rmi.RemoteException {
+        org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
+        _operationClient.getOptions().setAction("urn:main");
+        _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
+
+        addPropertyToOperationClient(_operationClient,
+            org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
+            "&");
+
+        org.apache.axiom.soap.SOAPEnvelope env = null;
+        org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
+
+        //Style is Doc.
+        env = toEnvelope(getFactory(_operationClient.getOptions()
+                                                    .getSoapVersionURI()),
+                main,
+                optimizeContent(
+                    new javax.xml.namespace.QName("http://test.zhguo", "main")));
+
+        //adding SOAP soap_headers
+        _serviceClient.addHeadersToEnvelope(env);
+        // create message context with that soap envelope
+        _messageContext.setEnvelope(env);
+
+        // add the message contxt to the operation client
+        _operationClient.addMessageContext(_messageContext);
+
+        _operationClient.execute(true);
+
+        return;
+    }
+
+    /**
+     * Auto generated method signature
+     * @see zhguo.test.SimpleHandler#cmdCOGExecute
+     * @param cmdCOGExecute
+     */
+    public zhguo.test.SimpleHandlerStub.CmdCOGExecuteResponse cmdCOGExecute(
+        zhguo.test.SimpleHandlerStub.CmdCOGExecute cmdCOGExecute)
+        throws java.rmi.RemoteException {
+        try {
+            org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[1].getName());
+            _operationClient.getOptions().setAction("urn:cmdCOGExecute");
+            _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
+
+            addPropertyToOperationClient(_operationClient,
+                org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
+                "&");
+
+            // create a message context
+            org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
+
+            // create SOAP envelope with that payload
+            org.apache.axiom.soap.SOAPEnvelope env = null;
+
+            env = toEnvelope(getFactory(_operationClient.getOptions()
+                                                        .getSoapVersionURI()),
+                    cmdCOGExecute,
+                    optimizeContent(
+                        new javax.xml.namespace.QName("http://test.zhguo",
+                            "cmdCOGExecute")));
+
+            //adding SOAP soap_headers
+            _serviceClient.addHeadersToEnvelope(e...
 
[truncated message content] | 
| 
      
      
      From: <je...@us...> - 2008-01-05 17:26:48
       | 
| Revision: 1865
          http://cogkit.svn.sourceforge.net/cogkit/?rev=1865&view=rev
Author:   jenvor
Date:     2008-01-05 09:26:32 -0800 (Sat, 05 Jan 2008)
Log Message:
-----------
(1)add functionality that user can query status of a workflow based on the workflow id.;(2)modify user interface to separate submission panel and status query panel.(3)Modify the stuff returned after a workflow is submitted.;(4)Modify the location of configuration file.Modify the method by which configuration file is located(Absolute path -> relative path).
Modified Paths:
--------------
    trunk/cyberaide/src/axis2/axis2ws_client/SimpleHandlerClient.java
    trunk/cyberaide/src/axis2/axis2ws_client/SimpleHandlerClientInterface.java
    trunk/cyberaide/src/axis2/axis2ws_server/SimpleHandlerInterfaceSkeleton.java
    trunk/cyberaide/src/axis2/axis2ws_server/StatusServiceInterface.java
    trunk/cyberaide/src/axis2/axis2ws_server/StatusServiceInterfaceSkeleton.java
    trunk/cyberaide/src/js/securelogin/cogkit/handler.js
    trunk/cyberaide/src/js/securelogin/cogkit/index.html
Added Paths:
-----------
    trunk/cyberaide/src/js/securelogin/cogkit/wflist.js
Modified: trunk/cyberaide/src/axis2/axis2ws_client/SimpleHandlerClient.java
===================================================================
--- trunk/cyberaide/src/axis2/axis2ws_client/SimpleHandlerClient.java	2008-01-05 02:43:28 UTC (rev 1864)
+++ trunk/cyberaide/src/axis2/axis2ws_client/SimpleHandlerClient.java	2008-01-05 17:26:32 UTC (rev 1865)
@@ -47,40 +47,51 @@
 import org.cogkit.cyberaide.axis2ws.StatusServiceInterfaceStub.AddWorkflowFromString;
 import org.cogkit.cyberaide.axis2ws.StatusServiceInterfaceStub.GetJSONStatusByUID;
 import org.cogkit.cyberaide.axis2ws.StatusServiceInterfaceStub.GetJSONStatusByUIDResponse;
+import org.cogkit.cyberaide.axis2ws.StatusServiceInterfaceStub.GetJSONStatusByUIDWFID;
+import org.cogkit.cyberaide.axis2ws.StatusServiceInterfaceStub.GetJSONStatusByUIDWFIDResponse;
 
 public class SimpleHandlerClient implements SimpleHandlerClientInterface{
 	private static String prefix = "(This is done by using Web service)\n";
 	//private static String propertiesFile = "/home/tomcat/apache-tomcat-6.0.14/webapps/webservice.properties";
-	private static String propertiesFile = "/home/tomcat/apache-tomcat-6.0.14/webapps/agent.properties";
-	private static String wsendpoint = "";
- 	private static StatusServiceNotifier _notifier = new StatusServiceNotifier();
-	private static AgentWFDB	_agentDb = null;
+	private static String agentConfigFile = "agent.properties";//"/home/tomcat/apache-tomcat-6.0.14/webapps/agent.properties";
+	private static String configFilename = "";
+	private static String executorEndpoint = "";
+	private static String statusserviceEndpoint = "";
+ 	private static StatusServiceNotifier _notifier = null;
+	private static AgentWFDB _agentDb = null;
 	private static SimpleHandlerInterfaceStub stub = null;
 
 	public SimpleHandlerClient(){
 		try{
+			configFilename = SimpleHandlerClient.class.getResource("/") + agentConfigFile; 
+			configFilename = configFilename.substring(configFilename.indexOf(":")+1);
+
+			System.out.println("?" + configFilename + "?");
 			 //open property file specified by propertiesFile
-            File propfile = new File(propertiesFile);
+            File propfile = new File(configFilename);
             if( propfile.exists() == false ){
-                System.out.println("property file: "+propertiesFile+" does not exist!");
+                System.out.println("property file: "+configFilename+" does not exist!");
                 return ;
             }
         
             // get service end point
             Properties prop = new Properties();
-            prop.load( new FileInputStream( propertiesFile ) );
-            String endpoint = prop.getProperty( "serviceendpoint" );
-            if( endpoint == null ){
-                System.out.println( "you must specify 'serviceendpoint' property in file service.properties" );
+            prop.load( new FileInputStream( propfile ) );
+            executorEndpoint = prop.getProperty( "executorservice.endpoint" );
+			statusserviceEndpoint = prop.getProperty( "statusservice.endpoint" );
+            if( executorEndpoint == null ){
+                System.out.println( "you must specify 'serviceendpoint' property in file " + configFilename );
             }else{
-                wsendpoint = endpoint;
-				stub = new SimpleHandlerInterfaceStub(wsendpoint);
+				stub = new SimpleHandlerInterfaceStub(executorEndpoint);
             }
         
             if( _agentDb == null ){
 				String dbfile = prop.getProperty("agentdb");
                 _agentDb = new AgentWFDB(dbfile);
 			}
+			if( _notifier == null ){
+ 				_notifier = new StatusServiceNotifier( statusserviceEndpoint );
+			}
 		}catch( Exception e ){
 			System.out.println( e.toString() );
 		}
@@ -164,6 +175,11 @@
 			transformer.LoadFromString(workflow);
 			workflow = transformer.getNewWF();
 
+			String filename = "/tmp/workflow.xml";
+			File recordfile = new File(filename);
+			BufferedWriter br = new BufferedWriter(new FileWriter(recordfile));
+			br.write(workflow);
+			br.close();
 			//send this workflow to status server
 			_notifier.addWorkFlowFromString(username, wfid, oldWF);
 
@@ -184,6 +200,10 @@
 	public String getStatusByUID(String struid){
 		return _notifier.getStatusByUID(struid);
 	}
+
+	public String getStatusByUIDWFID(String struid, String wfid){
+		return _notifier.getStatusByUIDWFID(struid, wfid);
+	}
 }
 
 class WorkflowTransformer{
@@ -241,7 +261,7 @@
 			Element root = doc.getDocumentElement();
 
 			//transformSubTree(root, doc);
-			transformSubTreeWithPath(root,doc,"");
+			transformSubTreeWithPath(root,doc,"/1", true);
 			
 			/*
 			String newWF = "test.xml";
@@ -311,7 +331,7 @@
 		parent.appendChild(newChild);
 	}
 
-	protected void transformSubTreeWithPath(Node root, Document doc, String path){
+	protected void transformSubTreeWithPath(Node root, Document doc, String path, boolean isRootNode ){
 		if(root.getChildNodes().getLength()==0)
 			return;
 		Node parent = root;
@@ -326,6 +346,17 @@
 			if( node.getNodeType() == Node.ELEMENT_NODE){
 				if( node.getNodeName().compareToIgnoreCase("include")==0){
 					childindex ++;
+					Element newChild = doc.createElement("echo");
+					echoMsg = path+"/"+childindex+"|job:include completed|2";
+					newChild.setAttribute("message", echoMsg);
+					Node nextSibling = node.getNextSibling();;
+					if( nextSibling != null ){
+						parent.insertBefore(newChild, nextSibling);
+					}else{
+						parent.appendChild( newChild );
+						break;
+					}
+					node = nextSibling;
 					continue;
 				}
 				childindex ++;
@@ -337,6 +368,14 @@
 				localpath = path+"/"+childindex;
 				
 				if( isfirstChild ){
+					if( isRootNode ){
+						Element newChild = doc.createElement("echo");
+						echoMsg = "/1|project started|1";
+						newChild.setAttribute("message", echoMsg);
+						parent.insertBefore(newChild, node);
+						Node newline = doc.createTextNode("\n");
+						parent.insertBefore(newline, node);
+					}
 					isfirstChild = false;
 					Element newChild = doc.createElement("echo");
 					echoMsg = localpath+"|job:"+nodename;
@@ -362,13 +401,22 @@
 				}
 				oldEchoMsg = echoMsg;
 				previousNode = nodename;
-				transformSubTreeWithPath(node, doc, localpath);
+				transformSubTreeWithPath(node, doc, localpath, false);
 			}
 		}while( (node=node.getNextSibling())!=null);
 		
 		Element newChild = doc.createElement("echo");
 		newChild.setAttribute("message", oldEchoMsg+" completed|2");
 		parent.appendChild(newChild);
+
+		if( isRootNode ){
+			newChild = doc.createElement("echo");
+			echoMsg = "/1|project completed|2";
+			newChild.setAttribute("message", echoMsg);
+			parent.appendChild(newChild);
+			Node newline = doc.createTextNode("\n");
+			parent.appendChild(newline);
+		}
 	}
 }
 
@@ -376,9 +424,9 @@
 	private String	_wsendpoint = "";
 	private StatusServiceInterfaceStub _stub = null;
 
-	public StatusServiceNotifier(){
+	public StatusServiceNotifier(String statusserviceendp){
 		try{
-	        _wsendpoint = "http://156.56.104.196:8080/axis2/services/StatusServiceInterface";
+	        _wsendpoint = statusserviceendp;//"http://156.56.104.196:8080/axis2/services/StatusServiceInterface";
        		_stub = new StatusServiceInterfaceStub(_wsendpoint);
 		} catch(Exception e){
 			System.out.println(e);
@@ -398,6 +446,20 @@
 		}
 	}
 
+	public String getStatusByUIDWFID(String struid, String wfid){
+		try{
+			if( _stub == null ) return "_stub is null";
+			GetJSONStatusByUIDWFID req = new GetJSONStatusByUIDWFID();
+			req.setParam0( struid );
+			req.setParam1( wfid );
+			GetJSONStatusByUIDWFIDResponse resp = new GetJSONStatusByUIDWFIDResponse();
+			resp = _stub.getJSONStatusByUIDWFID(req);
+			return resp.get_return();
+		}catch(Exception e){
+			return e.toString();
+		}
+	}
+
     public void addWorkFlowFromString(String userid, String wfid, String workflow){
     	try{
 			if( _stub == null ) return ;
Modified: trunk/cyberaide/src/axis2/axis2ws_client/SimpleHandlerClientInterface.java
===================================================================
--- trunk/cyberaide/src/axis2/axis2ws_client/SimpleHandlerClientInterface.java	2008-01-05 02:43:28 UTC (rev 1864)
+++ trunk/cyberaide/src/axis2/axis2ws_client/SimpleHandlerClientInterface.java	2008-01-05 17:26:32 UTC (rev 1865)
@@ -15,4 +15,7 @@
 	 * Notice: the user who submits the workflow is identified by <b><i>uid</i></b>
 	 */
 	String WFSubmit(String uid, String workflow);
+
+	String getStatusByUID( String struid );
+	String getStatusByUIDWFID( String struid, String wfid );
 }
Modified: trunk/cyberaide/src/axis2/axis2ws_server/SimpleHandlerInterfaceSkeleton.java
===================================================================
--- trunk/cyberaide/src/axis2/axis2ws_server/SimpleHandlerInterfaceSkeleton.java	2008-01-05 02:43:28 UTC (rev 1864)
+++ trunk/cyberaide/src/axis2/axis2ws_server/SimpleHandlerInterfaceSkeleton.java	2008-01-05 17:26:32 UTC (rev 1865)
@@ -37,23 +37,27 @@
 import org.cogkit.cyberaide.axis2ws.StatusServiceInterfaceStub;
 import org.cogkit.cyberaide.axis2ws.StatusServiceInterfaceStub.*;
 
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.ConfigurationContext;
+
 /**
  *  SimpleHandlerInterfaceSkeleton java skeleton for the axisService
  */
 public class SimpleHandlerInterfaceSkeleton implements SimpleHandlerInterfaceSkeletonInterface { 
-
-/*	private String _uid = "user1";
-	private String _wfid = "file1";
-	private String _workflow ="";
-*/
 	private static String _statusFilename = "/tmp/status.txt";
 	private static String _statusserviceendpoint = "";
-	private static String _configFilename = "/home/tomcat/apache-tomcat-6.0.14/webapps/executor.properties";
+	private static String _executorConfigFile = "executor.properties";
+	private static String _configFilename = "";
 	private static StatusServiceClient _statusclient =  null;
 
 	public SimpleHandlerInterfaceSkeleton(){
 		super();
 		try{
+			//Get the path of the configuration file. It should be under this directory:
+			//										"${TOMCAT_ROOT}/webapps/axis2/WEB-INF/classes/".
+			_configFilename = SimpleHandlerInterfaceSkeleton.class.getResource("/") + _executorConfigFile; 
+			_configFilename = _configFilename.substring(_configFilename.indexOf(":")+1);
+
 			//open property file specified by propertiesFile
 			File propfile = new File(_configFilename);
 			if( propfile.exists() == false ){
@@ -64,7 +68,7 @@
 			// get status service end point
 			Properties prop = new Properties();
 			prop.load( new FileInputStream( _configFilename ) );
-			String endpoint = prop.getProperty( "statusserviceendpoint" );
+			String endpoint = prop.getProperty( "statusservice.endpoint" );
 			if( endpoint == null ){
 				System.out.println( "you must specify 'serviceendpoint' property in file service.properties" );
 			}else{
@@ -218,7 +222,7 @@
 	 */
     private void getCertFromMyproxy(){//String host, int port, String user, String pwd, int lifetime){
 		try{
-			String propertiesFile = "/home/tomcat/apache-tomcat-6.0.14/webapps/myproxy.properties";
+			String propertiesFile = _configFilename;
 			String host = "";
 			int port = -1;
 			String user = "";
@@ -227,11 +231,11 @@
 
 			Properties prop = new Properties();
 			prop.load( new FileInputStream(propertiesFile) );
-			host = prop.getProperty("host");
-			port = Integer.parseInt( prop.getProperty("port") );
-			user = prop.getProperty("user");
-			pwd = prop.getProperty("pwd");
-			if( prop.getProperty("lifetime") != null ){
+			host = prop.getProperty("myproxy.host");
+			port = Integer.parseInt( prop.getProperty("myproxy.port") );
+			user = prop.getProperty("myproxy.user");
+			pwd = prop.getProperty("myproxy.pwd");
+			if( prop.getProperty("myproxy.lifetime") != null ){
 				lifetime = Integer.parseInt( prop.getProperty("lifetime") );
 			}
 
@@ -290,9 +294,9 @@
      */
     public org.cogkit.cyberaide.axis2ws.CmdWFSubmitResponse cmdWFSubmit(
         org.cogkit.cyberaide.axis2ws.CmdWFSubmit cmdWFSubmit0) {
-		String uid = cmdWFSubmit0.getParam0();
-		String wfid = cmdWFSubmit0.getParam1();
-		String workflow = cmdWFSubmit0.getParam2();
+		final String uid = cmdWFSubmit0.getParam0();
+		final String wfid = cmdWFSubmit0.getParam1();
+		final String workflow = cmdWFSubmit0.getParam2();
 
 		/*
 		//internally, invoke cmdCogExecution
@@ -304,117 +308,121 @@
 		wfresp.set_return(resp.get_return());
 		*/
 
-		Process wfproc = null;
-		String output = "";
 		int exit = -1;
-		try {
-			//First, get the proxy certificate from the myproxy server
-			getCertFromMyproxy();//"gf1.ucs.indiana.edu", 7512, "gerald", "....", 60*60*24*10);
+		new Thread( new Runnable(){
+				public void run(){
+					Process wfproc = null;
+					String output = "";
+					try{
+						//First, get the proxy certificate from the myproxy server
+						getCertFromMyproxy();//"gf1.ucs.indiana.edu", 7512, "gerald", "....", 60*60*24*10);
 
-			//store the input(it is a workflow description actually) in a file
-			String filename = "/tmp/workflow_WFSubmit.xml";
-			File recordfile = new File(filename);
-			BufferedWriter br = new BufferedWriter(new FileWriter(recordfile));
-			br.write(workflow);
-			br.close();
+						//store the input(it is a workflow description actually) in a file
+						String filename = "/tmp/workflow_WFSubmit.xml";
+						File recordfile = new File(filename);
+						BufferedWriter br = new BufferedWriter(new FileWriter(recordfile));
+						br.write(workflow);
+						br.close();
 
-			//filename = "\"" + filename +"\"";
-			//String cmd = "E:\\my_program\\cog-4_1_5\\bin\\cog-workflow.bat";// + filename;
-			// get value of environment variable COG_INSTALL_PATH
-			String cog_workflow = "";
-			String getEnvVar = "printenv COG_INSTALL_PATH";
-			String line = "";
+						//filename = "\"" + filename +"\"";
+						//String cmd = "E:\\my_program\\cog-4_1_5\\bin\\cog-workflow.bat";// + filename;
+						// get value of environment variable COG_INSTALL_PATH
+						String cog_workflow = "";
+						String getEnvVar = "printenv COG_INSTALL_PATH";
+						String line = "";
 
-			wfproc = Runtime.getRuntime().exec(getEnvVar);
-			BufferedReader input = new BufferedReader (new InputStreamReader(wfproc.getInputStream()));
-			while ((line = input.readLine()) != null) {
-				cog_workflow += line;
-			}
-			input.close();
-			wfproc.destroy();
-			if( cog_workflow.equals("") ){
-				throw new Exception("Environment variable COG_INSTALL_PATH is not set!!");
-			}
+						wfproc = Runtime.getRuntime().exec(getEnvVar);
+						BufferedReader input = new BufferedReader (new InputStreamReader(wfproc.getInputStream()));
+						while ((line = input.readLine()) != null) {
+							cog_workflow += line;
+						}
+						input.close();
+						wfproc.destroy();
+						if( cog_workflow.equals("") ){
+							throw new Exception("Environment variable COG_INSTALL_PATH is not set!!");
+						}
 
-			wfproc = null;
-			//call the cog command line tool to execute the workflow
-			String cmd = cog_workflow+"/bin/cog-workflow";
-			String []cmdarray = new String[2];
-			cmdarray[0] = cmd;	//command
-			cmdarray[1] = filename;//argument
-			long timeout = 1000 * 30;//30 seconds
-			System.out.println("Execute a new command");
-			wfproc = Runtime.getRuntime().exec(cmdarray);
+						wfproc = null;
+						//call the cog command line tool to execute the workflow
+						String cmd = cog_workflow+"/bin/cog-workflow";
+						String []cmdarray = new String[2];
+						cmdarray[0] = cmd;	//command
+						cmdarray[1] = filename;//argument
+						long timeout = 1000 * 30;//30 seconds
+						System.out.println("Execute a new command");
+						wfproc = Runtime.getRuntime().exec(cmdarray);
 
-			int statuscodeStarted = 1;
-			int statuscodeCompleted = 2;
+						final int statuscodeStarted = 1;
+						final int statuscodeCompleted = 2;
 
-			// notify status service that the workflow has started running
-			_statusclient.notifyStatusOfWF(uid, wfid, statuscodeStarted, "workflow execution started");
+						// notify status service that the workflow has started running
+						_statusclient.notifyStatusOfWF(uid, wfid, statuscodeStarted, "workflow execution started");
 
-			//get output from the executed tool
-			line = "";
-			input = new BufferedReader (new InputStreamReader(wfproc.getInputStream()));
-			boolean isfirstline = true;
-			while ((line = input.readLine()) != null) {
-				String msg = line;
-				/**
-				* Key point:
-				*	Every time a new message is generated during execution of workflow, the
-				*	message will be sent to status service based on web service.
-				*	First, we need to parse the generated message because it contains some 
-				*	more information than pure message. 
-				* 	Note: this must correspond to the method used to transform the received
-				*	workflow by the agent server.
-				*
-				* Format:
-				*	Currently, the generated status message has the format like this:
-				*		/1/2/1/3|job:...|0
-				*	Note: /1/2/1/3 denotes path of the target element in the workflow.
-				*		  The last number after '|' denotes status code. status code is
-				*		  0 in the example above. The meaning of status code MUST match the
-				*		  definition in StatusService program!!
-				*	Our job is to extract this part.
-				*/
-				int index = line.indexOf('|');
-				if( index == -1 ){
-					//this message is not status message, it is generated natively by
-					//original workflow.
-				}else{
-					String path = line.substring(0, index);
-					int endindex = line.lastIndexOf('|');
-					String statuscodestr = line.substring(endindex+1);
-					msg = msg.substring(index+1, endindex);
-					int statuscode = Integer.parseInt(statuscodestr);
-					_statusclient.notifyStatusOfElement(uid, wfid, path, statuscode, msg);
-				}
+						//get output from the executed tool
+						input = new BufferedReader (new InputStreamReader(wfproc.getInputStream()));
+						boolean isfirstline = true;
+						while ((line = input.readLine()) != null) {
+							String msg = line;
+							/**
+							 * Key point:
+							 *	Every time a new message is generated during execution of workflow, the
+							 *	message will be sent to status service based on web service.
+							 *	First, we need to parse the generated message because it contains some 
+							 *	more information than pure message. 
+							 * 	Note: this must correspond to the method used to transform the received
+							 *	workflow by the agent server.
+							 *
+							 * Format:
+							 *	Currently, the generated status message has the format like this:
+							 *		/1/2/1/3|job:...|0
+							 *	Note: /1/2/1/3 denotes path of the target element in the workflow.
+							 *		  The last number after '|' denotes status code. status code is
+							 *		  0 in the example above. The meaning of status code MUST match the
+							 *		  definition in StatusService program!!
+							 *	Our job is to extract this part.
+							 */
+							int index = line.indexOf('|');
+							if( index == -1 ){
+								//this message is not status message, it is generated natively by
+								//original workflow.
+							}else{
+								String path = line.substring(0, index);
+								int endindex = line.lastIndexOf('|');
+								String statuscodestr = line.substring(endindex+1);
+								msg = msg.substring(index+1, endindex);
+								int statuscode = Integer.parseInt(statuscodestr);
+								_statusclient.notifyStatusOfElement(uid, wfid, path, statuscode, msg);
+							}
 
-				if( isfirstline ){
-					isfirstline = false;
-					//output += "WFSubmit_Firstline:"+line;
-					output += msg;
-				}else{
-					//output += "\nWFSubmit_Following line:"+line;
-					output += "\n" + msg;
+							if( isfirstline ){
+								isfirstline = false;
+								//output += "WFSubmit_Firstline:"+line;
+								output += msg;
+							}else{
+								//output += "\nWFSubmit_Following line:"+line;
+								output += "\n" + msg;
+							}
+						}
+						input.close();
+
+						//notify status service that this workflow finishes executing
+						_statusclient.notifyStatusOfWF(uid, wfid, statuscodeCompleted, "workflow execution completed");
+
+						output = "succeeds!\nLog:\n"+output;
+						wfproc.destroy();
+				} catch (IllegalThreadStateException  e) {
+					wfproc.destroy();
+					output = e.toString();
+				} catch (Exception e){
+					wfproc.destroy();
+					output = e.toString();
 				}
 			}
-			input.close();
+		}).start();
 
-			//notify status service that this workflow finishes executing
-			_statusclient.notifyStatusOfWF(uid, wfid, statuscodeCompleted, "workflow execution completed");
-
-			output = "succeeds!\nLog:\n"+output;
-			wfproc.destroy();
-		} catch (IllegalThreadStateException  e) {
-			wfproc.destroy();
-			output = e.toString();
-		} catch (Exception e){
-			wfproc.destroy();
-			output = e.toString();
-		}
-
 		org.cogkit.cyberaide.axis2ws.CmdWFSubmitResponse wfresp = new org.cogkit.cyberaide.axis2ws.CmdWFSubmitResponse();
-		wfresp.set_return( output );
+	//	wfresp.set_return( output );
+		wfresp.set_return( "ID for the workflow you just submitted is:\n"+wfid+"\nYou can use it as a handle to check its status.");
 
 		return wfresp;
     }
Modified: trunk/cyberaide/src/axis2/axis2ws_server/StatusServiceInterface.java
===================================================================
--- trunk/cyberaide/src/axis2/axis2ws_server/StatusServiceInterface.java	2008-01-05 02:43:28 UTC (rev 1864)
+++ trunk/cyberaide/src/axis2/axis2ws_server/StatusServiceInterface.java	2008-01-05 17:26:32 UTC (rev 1865)
@@ -29,6 +29,7 @@
 	 */
 	public String getJSONStatusByUID(String struid);
 	public String getXMLStatusByUID(String struid);
+	public String getJSONStatusByUIDWFID(String struid, String strwfid);
 
 	/**
 	 * @deprecated
Modified: trunk/cyberaide/src/axis2/axis2ws_server/StatusServiceInterfaceSkeleton.java
===================================================================
--- trunk/cyberaide/src/axis2/axis2ws_server/StatusServiceInterfaceSkeleton.java	2008-01-05 02:43:28 UTC (rev 1864)
+++ trunk/cyberaide/src/axis2/axis2ws_server/StatusServiceInterfaceSkeleton.java	2008-01-05 17:26:32 UTC (rev 1865)
@@ -176,6 +176,33 @@
 		}
     }
 
+    public org.cogkit.cyberaide.axis2ws.GetJSONStatusByUIDWFIDResponse getJSONStatusByUIDWFID(
+        org.cogkit.cyberaide.axis2ws.GetJSONStatusByUIDWFID getJSONStatusByUIDWFID) {
+		try{
+		String struid = getJSONStatusByUIDWFID.getParam0();
+		String strwfid = getJSONStatusByUIDWFID.getParam1();
+
+		UID uid = new UIDUsername(struid);
+		StatusList sl = _db.getStatusByUID(uid);
+
+		String result = "{";
+		if( sl == null){
+			result = "No workflow found";
+		}else{
+			result = "{";	
+			result += "\""+TAGUID+"\":\""+struid+"\"";
+			result += ",";
+			result += "\""+TAGWORKFLOWS+"\":";
+			result += sl.toJSON(strwfid);
+			result += "}";
+		}
+		org.cogkit.cyberaide.axis2ws.GetJSONStatusByUIDWFIDResponse resp = new org.cogkit.cyberaide.axis2ws.GetJSONStatusByUIDWFIDResponse();
+		resp.set_return(result);
+		return resp;
+		}catch(Exception e){
+			return null;
+		}
+    }
     /**
      * Auto generated method signature
      * @param addWorkflowFromString5
@@ -654,6 +681,7 @@
 	/** contains list of nodes which are executed */
 //	private ArrayList<ITreeNode> _currentNodes = new ArrayList<ITreeNode>();
 	public KarajanTree(){
+		setRoot( new TreeNode() );
 	}
 	public void LoadFromFile(String filename) {
 		if(_isload)
@@ -684,7 +712,8 @@
 		}
 	}
 	protected void buildTree(ElementTree eletree){
-		setRoot( addSubTree(eletree.getRoot()));
+		//setRoot( addSubTree(eletree.getRoot()) );
+		getRoot().addChild( addSubTree(eletree.getRoot()) );
 //		_currentNodes.add(getRoot());
 	}
 	private ITreeNode addSubTree(FlowElement fe){
@@ -709,7 +738,11 @@
 		return fullname;
 	}
 	public String toJSON(){
-		return toJSON(getRoot());
+		String result = "";
+		for( int i = 0 ; i < getRoot().getChildren().length ; i ++ ){
+			result += toJSON(getRoot().getChildren()[i]);
+		}
+		return result;
 	}
 	private String toJSON(ITreeNode node){
 		if( node == null )
@@ -858,7 +891,26 @@
 		result += "]";
 		return result;
 	}
+
 	/**
+	 * serialize status of a workflow into JSON format
+	 */
+	public String toJSON( String wfid ){
+		Iterator it = _statuslist.iterator();
+		String result = "[";
+		WorkflowStatus wfs = null;
+		while(it.hasNext()){
+			wfs = (WorkflowStatus)it.next();
+			if( wfs.getWfid().compareTo(wfid) == 0 ){
+				result += wfs.toJSON();
+				break;
+			}
+		}
+		result += "]";
+		return result;
+	}
+
+	/**
 	 * serialize status into XML format.
 	 */
 	public String toXML(){
Modified: trunk/cyberaide/src/js/securelogin/cogkit/handler.js
===================================================================
--- trunk/cyberaide/src/js/securelogin/cogkit/handler.js	2008-01-05 02:43:28 UTC (rev 1864)
+++ trunk/cyberaide/src/js/securelogin/cogkit/handler.js	2008-01-05 17:26:32 UTC (rev 1865)
@@ -8,6 +8,7 @@
 else
 	COGHandler = PlainCOGHandler;
 
+
 function Handler( serviceurl ){
 	try{
 		this.url = serviceurl;
@@ -31,7 +32,8 @@
 			}
 			var callstr = "service."+methodname+"(";
 			
-			for( var i = 0; i < nargs; i++ ){//get and escape the arguments
+			var i = 0;
+			for( i = 0; i < nargs; i++ ){//get and escape the arguments
 				if( i > 0 ) callstr += ",";
 				if( typeof arguments[i+1] == "string" ){
 					var str = arguments[i+1];
@@ -46,8 +48,11 @@
 			if( cbfunc == null ){
 				callstr += ")";
 			}else{
-				timer=setTimeout("alert('Timeout.');",20000);//10 seconds timeout
-				callstr += ", " + cbfunc + ");";
+				//timer=setTimeout("alert('Time out');",30000);//30 seconds timeout
+				if( nargs > 0)
+					callstr += ", " + cbfunc + ");";
+				else
+					callstr += cbfunc + ");";
 			}
 
 			var rslt = eval( callstr );
Modified: trunk/cyberaide/src/js/securelogin/cogkit/index.html
===================================================================
--- trunk/cyberaide/src/js/securelogin/cogkit/index.html	2008-01-05 02:43:28 UTC (rev 1864)
+++ trunk/cyberaide/src/js/securelogin/cogkit/index.html	2008-01-05 17:26:32 UTC (rev 1865)
@@ -21,9 +21,33 @@
 		/* This piece of code adds visual widgets to ease workflow composition*/
 			Ext.onReady(function(){
 			   //createBasicDesktop('workflowdiv');
-			    createWidgetToolbox();
+			    var widgettoolbox = createWidgetToolbox();
 				promptwin.render('prompt');
 				promptwin.hide();
+				new Ext.TabPanel({
+					renderTo: 'tabs',
+					activeTab: 0,
+					width:'100%',
+					height:'100%',
+					//defaults:{autoScroll: true},
+					items:[
+						{	contentEl:'tab_wfsubmit', 
+							title:'Workflow Submit',
+							listeners: {
+								deactivate: function(){
+									widgettoolbox.hide();
+								},
+								activate: function(){
+									widgettoolbox.show();
+									widgettoolbox.collapse( false );
+								}
+							}
+						},
+						{	contentEl:'tab_wfquery', 
+							title:'Status Query',
+						}
+					]
+				});
 			});
 		</script>
 		
@@ -115,11 +139,11 @@
 					alert( exception );
 				else {
 					if( response == "No workflow found" ){
-						output('resp', response);
+						output('statusresp', response);
 					}else{
 						var list = new WFList( response );
 						var str = list.format();
-						output('resp', str);
+						output('statusresp', str);
 					}
 				}
 			}
@@ -127,6 +151,24 @@
 			 	COGHandler.executeMethods("WSHandler.getStatusByUID", "test", stateRetrieveCB);
 			}
 
+			function stateRetrieveAWFCB(response, exception){
+				if ( exception != null )
+					alert( exception );
+				else {
+					if( response == "No workflow found" ){
+						output('statusresp', response);
+					}else{
+						var list = new StatusOfOneWF( response );
+						var str = list.format();
+						output('statusresp', str);
+					}
+				}
+			}
+			function stateRetrieveAWF(){
+				var wfid = getInput("workflowids");
+			 	COGHandler.executeMethods("WSHandler.getStatusByUIDWFID", "test", wfid, stateRetrieveAWFCB);
+			}
+
 			/*
 			function wswfhandlewithstatus(){
 				var workflow = getInput("workflow");
@@ -139,8 +181,8 @@
 			}
 			*/
 
-			function clearoutput(){
-				var output = document.getElementById( 'resp' );
+			function clearoutput(eleid){
+				var output = document.getElementById( eleid );
 				output.value = "";
 			}
 
@@ -230,11 +272,11 @@
 			* Note:
 			*	Currently, only IE and Firefox are supported.
 			*/
-			function adjustTextArea(e){
+			function adjustTextArea(e, eleid){
 				var evt = e, xcord, ycord, rows;
 				var hiddenOutputId = "hiddenOutputArea";
 				var hiddenele = document.getElementById(hiddenOutputId);
-				var ele =  document.getElementById('resp');
+				var ele =  document.getElementById(eleid);
 				var clientwidth = document.body.clientWidth;
 				var clientheight = document.body.clientHeight;
 				var leftMargin = 50, topMargin = 50;
@@ -297,6 +339,8 @@
 	</head>
 	<body>
 		
+		<div id="tabs">
+		<div id="tab_wfsubmit">
 		<div>
 			<span style='font-size:large; padding-top:0.3em; padding-bottom:0.3em; color:blue;'>Workflow Sample</span>
 			    
@@ -333,10 +377,15 @@
 		<div style='padding-top:10px;padding-bottom:10px'>
 		...
 
[truncated message content] | 
| 
      
      
      From: <je...@us...> - 2008-01-10 04:19:18
       | 
| Revision: 1866
          http://cogkit.svn.sourceforge.net/cogkit/?rev=1866&view=rev
Author:   jenvor
Date:     2008-01-09 20:19:10 -0800 (Wed, 09 Jan 2008)
Log Message:
-----------
support to query status of more than one workflow in a single query request.
Modified Paths:
--------------
    trunk/cyberaide/src/axis2/axis2ws_server/StatusServiceInterfaceSkeleton.java
    trunk/cyberaide/src/js/securelogin/cogkit/index.html
Modified: trunk/cyberaide/src/axis2/axis2ws_server/StatusServiceInterfaceSkeleton.java
===================================================================
--- trunk/cyberaide/src/axis2/axis2ws_server/StatusServiceInterfaceSkeleton.java	2008-01-05 17:26:32 UTC (rev 1865)
+++ trunk/cyberaide/src/axis2/axis2ws_server/StatusServiceInterfaceSkeleton.java	2008-01-10 04:19:10 UTC (rev 1866)
@@ -186,8 +186,8 @@
 		StatusList sl = _db.getStatusByUID(uid);
 
 		String result = "{";
-		if( sl == null){
-			result = "No workflow found";
+		if( sl == null || sl.toJSON(strwfid).compareTo("[]") == 0 ){
+			result = "Workflow \"" + strwfid + "\" does not exist!";
 		}else{
 			result = "{";	
 			result += "\""+TAGUID+"\":\""+struid+"\"";
Modified: trunk/cyberaide/src/js/securelogin/cogkit/index.html
===================================================================
--- trunk/cyberaide/src/js/securelogin/cogkit/index.html	2008-01-05 17:26:32 UTC (rev 1865)
+++ trunk/cyberaide/src/js/securelogin/cogkit/index.html	2008-01-10 04:19:10 UTC (rev 1866)
@@ -155,7 +155,7 @@
 				if ( exception != null )
 					alert( exception );
 				else {
-					if( response == "No workflow found" ){
+					if( response.substr(0,8) == "Workflow" ){
 						output('statusresp', response);
 					}else{
 						var list = new StatusOfOneWF( response );
@@ -166,7 +166,13 @@
 			}
 			function stateRetrieveAWF(){
 				var wfid = getInput("workflowids");
-			 	COGHandler.executeMethods("WSHandler.getStatusByUIDWFID", "test", wfid, stateRetrieveAWFCB);
+				var space = /\s+/;
+				var wfids = wfid.split(space);
+				space = /^\s*$/;
+				for( var i = 0 ; i < wfids.length ; i++ ){
+					if( wfids[i].match(space) )continue;
+			 		COGHandler.executeMethods("WSHandler.getStatusByUIDWFID", "test", wfids[i], stateRetrieveAWFCB);
+				}
 			}
 
 			/*
@@ -267,6 +273,24 @@
 		</script>
 
 		<script type="text/javascript">
+			/**
+			* If key 'esc' is pressed, the element corresponding to eleid is hidden.
+			*/
+			function keypressed(e, eleid){
+				var evt = e;
+				var hiddenOutputId = eleid;
+				var hiddenele = document.getElementById(hiddenOutputId);
+				var ele =  document.getElementById(eleid);
+    					
+				if( typeof( window.event ) != "undefined" ){//IE
+    				evt = window.event;
+    			}
+				var keycode = evt.keyCode;
+				if( keycode == 27 ){//key esc is pressed?
+					ele.style.display = 'none';//if so, hide it
+				}
+			}
+
 		   /* When the output textarea is too small to display response from server,
 			* this function adjustes size of the textarea to contain more content.
 			* Note:
@@ -345,7 +369,7 @@
 			<span style='font-size:large; padding-top:0.3em; padding-bottom:0.3em; color:blue;'>Workflow Sample</span>
 			    
 			<input type="button" value="click to see sample" onClick="javascript:diagShow(event);"/>
-			<div><textarea rows=15 cols=100 wrap='off' id="wfsample" style="display:none;" onBlur="javascript:diagHide(event);">
+			<div><textarea rows=15 cols=100 wrap='off' id="wfsample" style="display:none;" onBlur="javascript:diagHide(event);" onkeypress='javascript:keypressed(event, "wfsample");'>
 <project>
   <include file="cogkit.xml"/>
   <execute executable="/bin/rm" arguments="-f thedate" host="gf1.ucs.indiana.edu" provider="GT2" redirect="false"/>
@@ -362,7 +386,7 @@
 			<div style='font-size:large; padding-top:0.3em; padding-bottom:0.3em; color:blue;'>Workflow description:</div>
 			<table>
 				<tr><td>
-			<textarea id='workflow' wrap='off' cols=100 rows=15 ></textarea>
+			<textarea id='workflow'  onblur='javascript:this.blur();' wrap='off' cols=100 rows=15 ></textarea>
 			<!-- <div id='workflowdiv'></div> -->
 			<td><td valign=top>
 		<div style='padding-top:10px;padding-bottom:10px'>
@@ -396,8 +420,7 @@
 		<div style='font-size:large; padding-top:0.2em; padding-bottom:0.1em; color:blue;'>Response from server:</div>
 			<table>
 				<tr><td>
-				<textarea WRAP='off' id='resp' cols=100 rows=15 readOnly='true'>
-				</textarea>
+				<textarea WRAP='off' id='resp' cols=100 rows=15 readOnly='true'></textarea>
 				<td><td valign=top>
 				<input type='button' value='clear' onclick='javascript:clearoutput("resp");'></input>
 
@@ -407,7 +430,7 @@
 				</td></tr>
 			</table>
 		</div>
-		<textarea style="display:none" id="hiddenOutputArea" onblur="javascript:this.style.display='none';"></textarea>
+		<textarea style="display:none" id="hiddenOutputArea" onblur="javascript:this.style.display='none';" onkeypress='javascript:keypressed(event, "hiddenOutputArea");'></textarea>
 		<div id="prompt"></div>
 		</div>
 
@@ -416,7 +439,7 @@
 			<div style='font-size:large; padding-top:0.3em; padding-bottom:0.3em; color:blue;'>Workflow id input area:</div>
 			<table>
 				<tr><td>
-				<textarea id='workflowids' wrap='off' cols=100 rows=10 ></textarea>
+				<textarea id='workflowids' onblur='javascript:this.blur();' onfocus='javascript:this.focus();' wrap='off' cols=100 rows=10 ></textarea>
 				<!-- <div id='workflowdiv'></div> -->
 				<td><td valign=top>
 				<div style='padding-top:10px;padding-bottom:10px'>
@@ -432,8 +455,7 @@
 			<div style='font-size:large; padding-top:0.2em; padding-bottom:0.1em; color:blue;'>Response from server:</div>
 			<table>
 				<tr><td>
-				<textarea WRAP='off' id='statusresp' cols=100 rows=20 readOnly='true'>
-				</textarea>
+				<textarea WRAP='off' id='statusresp' cols=100 rows=20 readOnly='true'></textarea>
 				<td><td valign=top>
 				<input type='button' value='clear' onclick='javascript:clearoutput("statusresp");'></input>
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |