|
From: <las...@us...> - 2007-10-28 17:04:01
|
Revision: 1813
http://cogkit.svn.sourceforge.net/cogkit/?rev=1813&view=rev
Author: laszewsk
Date: 2007-10-28 10:04:00 -0700 (Sun, 28 Oct 2007)
Log Message:
-----------
more code restructuring
Modified Paths:
--------------
trunk/cyberaide/src/js/java/CoGHandler/SimpleHandler.java
Modified: trunk/cyberaide/src/js/java/CoGHandler/SimpleHandler.java
===================================================================
--- trunk/cyberaide/src/js/java/CoGHandler/SimpleHandler.java 2007-10-28 16:54:21 UTC (rev 1812)
+++ trunk/cyberaide/src/js/java/CoGHandler/SimpleHandler.java 2007-10-28 17:04:00 UTC (rev 1813)
@@ -1,37 +1,51 @@
-package zhguo.test;
+package org.cogkit.cyberaide.???.CoGHandler.test;
import java.io.*;
-import zhguo.test.SimpleHandlerStub.Echo;
-import zhguo.test.SimpleHandlerStub.EchoResponse;
-import zhguo.test.SimpleHandlerStub.CmdCOGExecute;
-import zhguo.test.SimpleHandlerStub.CmdCOGExecuteResponse;
+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 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);
}
- public static int add(OperationInterfaceStub stub) {
+
+ 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);
@@ -48,33 +62,33 @@
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 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();
}
- public static void main( String []args ){
- SimpleHandler hd = new SimpleHandler();
- }
+ return "exit value " + String.valueOf(exit);
+ }
+ public static void main( String []args ){
+ SimpleHandler hd = new SimpleHandler();
+ }
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|