Native Messaging WIP - docs, tweaks
authorBill Erickson <berickxx@gmail.com>
Thu, 10 Nov 2016 19:46:45 +0000 (14:46 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 10 Nov 2016 19:46:45 +0000 (14:46 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
src/org/evergreen_ils/hatch/MessageIO.java
src/org/evergreen_ils/hatch/RequestHandler.java
src/org/evergreen_ils/hatch/TestHatch.java

index d24ecb0..caa3863 100644 (file)
@@ -1,9 +1,25 @@
+/* -----------------------------------------------------------------------
+ * Copyright 2016 King County Library System
+ * Bill Erickson <berickxx@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * -----------------------------------------------------------------------
+ */
 package org.evergreen_ils.hatch;
 
 import java.util.logging.*;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.nio.ByteBuffer;
 import java.io.IOException;
+import java.util.regex.Pattern;
 import org.json.*;
 
 /**
@@ -16,11 +32,12 @@ public class MessageIO {
 
     private LinkedBlockingQueue<JSONObject> inQueue;
     private LinkedBlockingQueue<JSONObject> outQueue;
-    static final Logger logger = Hatch.getLogger();
 
     private MessageReader reader;
     private MessageWriter writer;
 
+    static final Logger logger = Hatch.getLogger();
+
     public MessageIO() {
         inQueue = new LinkedBlockingQueue<JSONObject>();
         outQueue = new LinkedBlockingQueue<JSONObject>();
@@ -111,7 +128,7 @@ public class MessageIO {
 
             String message = new String(msgBytes, "UTF-8");
 
-            logger.info("MessageReader read: " + message);
+            logger.info("MessageReader read: " + message.length());
 
             return message;
         }
@@ -137,13 +154,14 @@ public class MessageIO {
                     System.exit(1);
 
                 } catch (IOException ioe) {
+
                     logger.warning(ioe.toString());
+                    continue;
 
                 } catch (JSONException je) {
 
                     logger.warning("Error parsing JSON message on STDIN " +
                         je.toString() + " : " + message);
-
                     continue;
                 }
 
index 548ef82..4cce19e 100644 (file)
@@ -1,3 +1,18 @@
+/* -----------------------------------------------------------------------
+ * Copyright 2016 King County Library System
+ * Bill Erickson <berickxx@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * -----------------------------------------------------------------------
+ */
 package org.evergreen_ils.hatch;
 
 import org.json.*;
index 240d1e5..08c68c9 100644 (file)
@@ -1,3 +1,18 @@
+/* -----------------------------------------------------------------------
+ * Copyright 2016 King County Library System
+ * Bill Erickson <berickxx@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * -----------------------------------------------------------------------
+ */
 package org.evergreen_ils.hatch;
 
 import java.util.logging.Logger;