implemented client bootstrap. created a status object to model connection statuses...
[OpenSRF.git] / src / java / org / opensrf / Stack.java
index 6db285e..89649a5 100644 (file)
@@ -66,10 +66,23 @@ public class Stack {
      * Process a server response
      */
     private static void processResponse(ClientSession session, Message msg) {
-        if(msg.RESULT.equals(msg.getType())) {
+        String type = msg.getType();
+        if(msg.RESULT.equals(type)) {
             session.pushResponse(msg);
             return;
         }
+
+        if(msg.STATUS.equals(type)) {
+
+            OSRFObject obj = (OSRFObject) msg.getPayload();
+            Status stat = new Status(obj.getString("status"), obj.getInt("statusCode"));
+            int statusCode = stat.getStatusCode();
+            String status = stat.getStatus();
+
+            if(statusCode == stat.COMPLETE) {
+                session.setRequestComplete(msg.getId());
+            }
+        }
     }
 
     /**