diff --git a/ch.psi.fda/Readme.md b/ch.psi.fda/Readme.md index b1bf52d..17ade4c 100644 --- a/ch.psi.fda/Readme.md +++ b/ch.psi.fda/Readme.md @@ -4,6 +4,34 @@ This package holds the core functionality of FDA. # Usage use -Djava.util.logging.config.file=logging.properties` to configure logging +## Server + +The FDA server is started as follows: + +``` +./bin/server -h +usage: fda + -h Help + -p Server port (default: 8080) + -s Server address (default: x07mb-cons-1) +``` + +Start new scan: +``` +curl -X PUT -d @scan1d.xml -H 'Content-Type:application/xml' http://emac:8080/fda/scan +``` + +## Viewer + +``` +./bin/viewer -h +usage: viewer + -h Help + -p Server port (default: 10000) + -s Server address (default: localhost) + ``` + + # Development When checking out the project from the repository there is the `target/generated-sources/xjc` folder missing. After checking out the project execute `mvn compile` to create the folder and the required classes. diff --git a/ch.psi.fda/pom.xml b/ch.psi.fda/pom.xml index dcd2cb1..47e6cc2 100644 --- a/ch.psi.fda/pom.xml +++ b/ch.psi.fda/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ch.psi fda - 2.1.0 + 2.1.1 diff --git a/ch.psi.fda/src/main/assembly/assembly.xml b/ch.psi.fda/src/main/assembly/assembly.xml index fca2325..b2c40e6 100644 --- a/ch.psi.fda/src/main/assembly/assembly.xml +++ b/ch.psi.fda/src/main/assembly/assembly.xml @@ -1,4 +1,8 @@ - + + + bin diff --git a/ch.psi.fda/src/main/java/ch/psi/fda/rest/FdaServer.java b/ch.psi.fda/src/main/java/ch/psi/fda/rest/FdaServer.java index add0f5b..954e3cf 100644 --- a/ch.psi.fda/src/main/java/ch/psi/fda/rest/FdaServer.java +++ b/ch.psi.fda/src/main/java/ch/psi/fda/rest/FdaServer.java @@ -1,6 +1,7 @@ package ch.psi.fda.rest; import java.io.IOException; +import java.net.InetAddress; import java.net.URI; import java.util.concurrent.CountDownLatch; import java.util.logging.Logger; @@ -29,8 +30,7 @@ public class FdaServer { public static void main(String[] args) throws IOException, ParseException { int port = 8080; -// String hostname = InetAddress.getLocalHost().getHostName(); - String hostname = "localhost"; + String hostname = InetAddress.getLocalHost().getHostName(); Options options = new Options(); options.addOption("h", false, "Help"); diff --git a/ch.psi.fda/src/main/java/ch/psi/fda/rest/ResourceBinder.java b/ch.psi.fda/src/main/java/ch/psi/fda/rest/ResourceBinder.java index 60f0c51..ddf95a7 100644 --- a/ch.psi.fda/src/main/java/ch/psi/fda/rest/ResourceBinder.java +++ b/ch.psi.fda/src/main/java/ch/psi/fda/rest/ResourceBinder.java @@ -20,7 +20,9 @@ public class ResourceBinder extends AbstractBinder { bind(AcquisitionEngine.class).to(AcquisitionEngine.class).in(Singleton.class); bind(FdaqEngine.class).to(FdaqEngine.class).in(Singleton.class); - bind(ZMQDataService.class).to(ZMQDataService.class).in(Singleton.class); + + // ZMQ data service singleton + bind(new ZMQDataService(10000)).to(ZMQDataService.class); bind(CdumpEngine.class).to(CdumpEngine.class).in(Singleton.class); bind(CdumpConfiguration.class).to(CdumpConfiguration.class).in(Singleton.class); diff --git a/ch.psi.fda/src/main/java/ch/psi/fda/rest/ZMQDataService.java b/ch.psi.fda/src/main/java/ch/psi/fda/rest/ZMQDataService.java index 8accede..3fec8ec 100644 --- a/ch.psi.fda/src/main/java/ch/psi/fda/rest/ZMQDataService.java +++ b/ch.psi.fda/src/main/java/ch/psi/fda/rest/ZMQDataService.java @@ -41,13 +41,15 @@ public class ZMQDataService { private static final Logger logger = Logger.getLogger(ZMQDataService.class.getName()); private final int bufferSize = 5; + private final int port; private ZMQ.Context context; private ZMQ.Socket socket; private String trackingId; - public ZMQDataService(){ + public ZMQDataService(int port){ + this.port = port; initialize(); } @@ -56,7 +58,7 @@ public class ZMQDataService { zmq.ZError.clear(); // Clear error code socket = context.socket(ZMQ.PUB); socket.setHWM(bufferSize); - socket.bind("tcp://*:10000"); + socket.bind("tcp://*:"+port); } public void terminate(){