[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Fri Jun 8 14:04:27 UTC 2007


gordonp
Fri Jun  8 10:04:27 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory dev.open-bio.org:/tmp/cvs-serv28675/src/main/org/biomoby/client

Modified Files:
	MobyRequest.java MobyRequestEvent.java 
	MobyRequestEventHandler.java 
Log Message:
Commit of Seahawk 1.0 updates and associated core updates
moby-live/Java/src/main/org/biomoby/client MobyRequest.java,1.25,1.26 MobyRequestEvent.java,1.4,1.5 MobyRequestEventHandler.java,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java	2007/04/26 15:08:03	1.25
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java	2007/06/08 14:04:27	1.26
@@ -273,17 +273,17 @@
      * @throws SOAPException i.e. there was a problem with the underlying transaction/transport layer
      */
     public MobyContentInstance invokeService() throws Exception, MobyException, SOAPException, NoSuccessException{
-	return invokeService((StringBuffer) null);
+	return invokeService(inputData, (StringBuffer) null);
     }
 
     // Used internally for asynchronous thread calls that all need the XML data
     // and can't rely on the answer from thread-insensitive getResponseXML()
-    private MobyContentInstance invokeService(StringBuffer contentsXML) 
+    private MobyContentInstance invokeService(MobyContentInstance inData, StringBuffer contentsXML) 
 	throws Exception, MobyException, SOAPException, NoSuccessException{
-	return invokeService(contentsXML, null, 0);
+	return invokeService(inData, contentsXML, null, 0);
     }
 
-    private MobyContentInstance invokeService(StringBuffer contentsXML, MobyRequestEventHandler handler, int requestId) 
+    private MobyContentInstance invokeService(MobyContentInstance inData, StringBuffer contentsXML, MobyRequestEventHandler handler, int requestId) 
 	throws Exception, MobyException, SOAPException, NoSuccessException{
 
 	if(mobyService == null){
@@ -293,10 +293,10 @@
 	Element mobyDOM = null;
 	if(mobyService.isAsynchronous()){
 	    // Async is "simpler", because it had to merge DOMs together into a single MobyContentInstance anyway
-	    return performAsyncSOAPRequest(mobyService, inputData, handler, requestId);
+	    return performAsyncSOAPRequest(mobyService, inData, handler, requestId);
 	}
 	else{
-	    String mobyXML = convertMOBYDataToMOBYRequest(inputData);
+	    String mobyXML = convertMOBYDataToMOBYRequest(inData);
 	    Call call = getServiceFromWSDL();
 	    mobyDOM = performSOAPRequest(call, mobyXML, contentsXML);
 	    // The following parses the DOM and extracts all the appropriate jMOBY objects to represent the XML in Java
@@ -342,7 +342,7 @@
 		    }
 		    
 		    // Inform the handler that some data has been added to the response (for incremental display?)
-		    MobyRequestEvent mre = new MobyRequestEvent(finalContents, this, null, requestId);
+		    MobyRequestEvent mre = new MobyRequestEvent(finalContents, this, mservice, null, requestId);
 		    StringWriter xmlWriter = new StringWriter();
 		    MobyDataUtils.toXMLDocument(xmlWriter, finalContents);
 
@@ -377,7 +377,7 @@
     public synchronized int invokeService(MobyRequestEventHandler handler){
 	int id = autoID++;
 
-	Thread t = new InvocationThread(this, handler, id);  // see internal class definition below
+	Thread t = new InvocationThread(this, inputData, handler, id);  // see internal class definition below
 	t.start();
 
 	return id;
@@ -386,12 +386,14 @@
     // This is the class that asynchronously calls the service and does a callback to 
     // the handler specified in the invocation.
     class InvocationThread extends Thread {
+	MobyContentInstance data;
 	MobyService mservice;
 	MobyRequest mobyRequest; 
 	MobyRequestEventHandler handler;
 	int requestId;
 
-	InvocationThread(MobyRequest mr, MobyRequestEventHandler h, int id){
+	InvocationThread(MobyRequest mr, MobyContentInstance inData, MobyRequestEventHandler h, int id){
+	    data = inData;
 	    mobyRequest = mr;
 	    mservice = mobyRequest.getService();
 	    handler = h;
@@ -402,21 +404,24 @@
 	}
 
 	public void run() {
-	    MobyContentInstance content = null;
+	    MobyRequestEvent requestEvent = new MobyRequestEvent(data, mobyRequest, mservice, null, requestId);
+	    // Tell the handler we're starting the request, with the given data
+	    handler.start(requestEvent);
+
 	    MobyRequestEvent responseEvent = null;
-	    handler.start(mobyRequest, requestId);
+	    MobyContentInstance content = null;
 	    StringBuffer contentsXML = new StringBuffer();  //to be filled in by the RPC call below
 	    try{
-		content = mobyRequest.invokeService(contentsXML, handler, requestId); //RPC call...
+		content = mobyRequest.invokeService(data, contentsXML, handler, requestId); //RPC call...
 	    }
 	    catch(Exception e){
-		responseEvent = new MobyRequestEvent(content, mobyRequest, e, requestId);
+		responseEvent = new MobyRequestEvent(content, mobyRequest, mservice, e, requestId);
 	    }
 	    catch(Error err){
-		responseEvent = new MobyRequestEvent(content, mobyRequest, err, requestId);
+		responseEvent = new MobyRequestEvent(content, mobyRequest, mservice, err, requestId);
 	    }
 	    if(responseEvent == null){
-		responseEvent = new MobyRequestEvent(content, mobyRequest, null, requestId);
+		responseEvent = new MobyRequestEvent(content, mobyRequest, mservice, null, requestId);
 	    }
 	    // We've got the raw XML laying around, so why not provide it unmolested to the callback?
 	    responseEvent.setContentsXML(contentsXML.toString());

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequestEvent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequestEvent.java	2006/07/07 04:12:39	1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequestEvent.java	2007/06/08 14:04:27	1.5
@@ -2,6 +2,7 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.ByteArrayInputStream;
+import org.biomoby.shared.MobyService;
 import org.biomoby.shared.data.MobyContentInstance;
 import org.biomoby.shared.data.MobyDataUtils;
 
@@ -18,17 +19,26 @@
     protected MobyContentInstance contents;
     protected MobyRequest originatingMobyRequest;
     protected String dataPayloadXML;
+    protected MobyService service;
     protected Throwable exception;
 
     private static int nextEventID = 0;
 
-    public MobyRequestEvent(MobyContentInstance mci, MobyRequest requestSource, Throwable e, int id){
+    public MobyRequestEvent(MobyContentInstance mci, MobyRequest requestSource, MobyService serv, Throwable e, int id){
 	consumed = false;
 	done = false;
 	contents = mci;
 	originatingMobyRequest = requestSource;
 	exception = e;
 	eventID = id;
+	service = serv;
+    }
+
+    /**
+     * @return the name of the remote service generating the event
+     */
+    public MobyService getService(){
+	return service;
     }
 
     /**

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequestEventHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequestEventHandler.java	2006/03/28 21:11:22	1.2
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequestEventHandler.java	2007/06/08 14:04:27	1.3
@@ -12,10 +12,10 @@
 public interface MobyRequestEventHandler{
 
     /**
-     * If a client, denotes that a service request has been sent.
+     * If a client, denotes that a service request has been sent (and the contents is exactly what is being sent to the service).
      * If a server, denotes that you should be ready to start receiving events (an init of sorts)
      */
-    public void start(MobyRequest request, int requestID);
+    public void start(MobyRequestEvent request);
 
     public void processEvent(MobyRequestEvent mre);
 




More information about the MOBY-guts mailing list