From 68b2cba1cf2bc96a996a15220e4df95b2e86520e Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Thu, 14 Nov 2019 20:09:45 +0100 Subject: Add basic client --- .../pl/edu/mimuw/cloudatlas/client/Client.java | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/client/Client.java (limited to 'src/main/java') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/client/Client.java b/src/main/java/pl/edu/mimuw/cloudatlas/client/Client.java new file mode 100644 index 0000000..e573d6c --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/Client.java @@ -0,0 +1,42 @@ +package pl.edu.mimuw.cloudatlas.client; + +import pl.edu.mimuw.cloudatlas.agent.Api; + +import java.rmi.registry.LocateRegistry; +import java.rmi.RemoteException; +import java.rmi.registry.Registry; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * Main class for a client. + * + * Set the following properties on the command line: + * + *
+ * -Djava.rmi.server.useCodebaseOnly=false + *
+ * -Djava.rmi.server.codebase=file:/path/to/compiled/classes/ + *
+ * -Djava.security.policy=client.policy + *
+ * + * NOTE: MAKE SURE YOU HAVE THE TRAILING / ON THE CODEBASE PATH + */ + +// https://github.com/rm5248/Java-RMI-Example/ + +@SpringBootApplication +public class Client { + public static void main(String[] args) { + try { + Registry registry = LocateRegistry.getRegistry("localhost"); + Api api = (Api) registry.lookup("Api"); + + SpringApplication.run(Client.class, args); + } catch (Exception e) { + System.err.println("Client exception:"); + e.printStackTrace(); + } + } +} -- cgit v1.2.3