private static void handleResolverExpression() { final Resolver resolver = cloudname.getResolver(); try { System.out.println( "Added a resolver listener for expression: " + resolverExpression + ". Will print out all events for the given expression."); resolver.addResolverListener( resolverExpression, new ResolverListener() { @Override public void endpointEvent(Event event, Endpoint endpoint) { System.out.println("Received event: " + event + " for endpoint: " + endpoint); } }); } catch (CloudnameException e) { System.err.println("Problem with cloudname: " + e.getMessage()); } final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (true) { System.out.println("Press enter to exit"); String s = null; try { s = br.readLine(); } catch (IOException e) { e.printStackTrace(); } if (s.length() == 0) { System.out.println("Exiting"); System.exit(0); } } }
private static void checkArgumentCombinationValid(final Flags flags) { int actionSelectedCount = 0; final Object[] actionSelectingFlags = {filePath, coordinateFlag, resolverExpression, listFlag}; for (Object flag : actionSelectingFlags) { if (flag != null) { actionSelectedCount++; } } if (actionSelectedCount != 1) { System.err.println("Must specify exactly one of the following options:"); System.err.println(actionSelectingFlagNames); flags.printHelp(System.err); System.exit(1); } }