- UIUtils.setLookAndFeel();
- BasicReader.setDefaultReaderType(ReaderType.LOCAL);
- BasicReader.getReader().start(null);
+ if (BasicReader.getReader() == null) {
+ Instance.syserr(new Exception(
+ "No reader type has been configured"));
+ exitCode = 10;
+ break;
+ }
+ BasicReader.getReader().browse(null);
+ break;
+ case SERVER:
+ if (port == null) {
+ exitCode = 255;
+ break;
+ }
+ try {
+ Server server = new RemoteLibraryServer(key, port);
+ server.start();
+ System.out.println("Remote server started on: " + port);
+ } catch (IOException e) {
+ Instance.syserr(e);
+ }
+ return;
+ case STOP_SERVER:
+ if (port == null) {
+ exitCode = 255;
+ break;
+ }
+
+ try {
+ final String fkey = key;
+ new ConnectActionClient(host, port, true) {
+ @Override
+ public void action(Version serverVersion)
+ throws Exception {
+ try {
+ send(new Object[] { fkey, "EXIT" });
+ } catch (Exception e) {
+ Instance.syserr(e);
+ }
+ }
+ }.connect();
+ } catch (IOException e) {
+ Instance.syserr(e);
+ }
+ break;
+ case REMOTE:
+ exitCode = 255; // should not be reachable (REMOTE -> START)