From bb6ec388cbf4296446ba41fded63b4625b24857d Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 3 Dec 2014 15:04:06 -0500 Subject: [PATCH] Hatch various repairs; setup readme; gitignore Signed-off-by: Bill Erickson --- .gitignore | 4 ++++ README | 28 ++++++++++++++++++++++++++- hatch.xml | 4 ++-- run.sh | 4 ++-- src/org/evergreen_ils/hatch/Hatch.java | 5 +++++ src/org/evergreen_ils/hatch/PrintManager.java | 3 ++- 6 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..2db1c34273 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +jdk* +jetty* +lib/ + diff --git a/README b/README index da2faa2e31..3add0a0059 100644 --- a/README +++ b/README @@ -1,3 +1,29 @@ Hatch - Java Print / Storage / Etc Service -TODO: more info +** ROUGH SETUP NOTES ** + +Install Hatch on your desktop -- Linux edition: + +% wget http://download.eclipse.org/jetty/stable-9/dist/jetty-distribution-9.2.5.v20141112.tar.gz +% tar -zxf jetty-distribution-9.2.5.v20141112.tar.gz +% ln -s jetty-distribution-9.2.5.v20141112 jetty + +# download jdk1.8 (requires license agreement) -- haven't tested on openjdk yet. +# http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html +# and extract in the same directory +% ln -s jdk1.8.0_25 jdk1.8 + +% mkdir lib +% wget -O lib/jetty-util-ajax-9.2.5.v20141112.jar \ + 'http://central.maven.org/maven2/org/eclipse/jetty/jetty-util-ajax/9.2.5.v20141112/jetty-util-ajax-9.2.5.v20141112.jar' + +# compile +% ./run.sh + +# compile + run +% ./run.sh 1 + +# open https://localhost:8443/ in Chrome and click through the security warning. +# Then open the browser client. +# Set "This workstation uses a remote print / storage service ("Hatch")?" under Admin -> Workstation +# optionally configure / test printing diff --git a/hatch.xml b/hatch.xml index ac25f1b998..372cba7489 100644 --- a/hatch.xml +++ b/hatch.xml @@ -44,10 +44,10 @@ https://:8443/ and confirm the cert is trusted --> - /jetty-distribution-9.1.4.v20140401/etc/keystore + /jetty/etc/keystore OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 OBF:1u2u1wml1z7s1z7a1wnl1u2g - /jetty-distribution-9.1.4.v20140401/etc/keystore + /jetty/etc/keystore OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 diff --git a/run.sh b/run.sh index 186de4d780..91d2dca3de 100755 --- a/run.sh +++ b/run.sh @@ -1,5 +1,5 @@ -JAVA_HOME=jdk1.8.0 -JETTY_HOME=jetty-distribution-9.1.4.v20140401 +JAVA_HOME=jdk1.8 +JETTY_HOME=jetty # compile $JAVA_HOME/bin/javac \ diff --git a/src/org/evergreen_ils/hatch/Hatch.java b/src/org/evergreen_ils/hatch/Hatch.java index 7e9ad7418f..716ccae41e 100644 --- a/src/org/evergreen_ils/hatch/Hatch.java +++ b/src/org/evergreen_ils/hatch/Hatch.java @@ -153,6 +153,11 @@ public class Hatch extends Application { String content = (String) params.get("content"); String contentType = (String) params.get("contentType"); + if (content == null) { + logger.warn("handlePrint() called with no content"); + return; + } + browser = new BrowserView(); Scene scene = new Scene(browser); primaryStage.setScene(scene); diff --git a/src/org/evergreen_ils/hatch/PrintManager.java b/src/org/evergreen_ils/hatch/PrintManager.java index 9ecfcefe52..40a4003d7c 100644 --- a/src/org/evergreen_ils/hatch/PrintManager.java +++ b/src/org/evergreen_ils/hatch/PrintManager.java @@ -393,7 +393,8 @@ public class PrintManager { HashMap printerMap = new HashMap(); printerMaps.add(printerMap); printerMap.put("name", printer.getName()); - if (printer.getName().equals(defaultPrinter.getName())) { + if (defaultPrinter != null && + printer.getName().equals(defaultPrinter.getName())) { printerMap.put("is-default", new Boolean(true)); } logger.info("found printer " + printer.getName()); -- 2.11.0