Main.java
Go to the documentation of this file.
00001 package ros.zeroconf.jmdns.demos;
00002 
00003 import java.io.IOException;
00004 import java.util.Enumeration;
00005 import java.util.logging.ConsoleHandler;
00006 import java.util.logging.Level;
00007 import java.util.logging.LogManager;
00008 import java.util.logging.Logger;
00009 import ros.zeroconf.jmdns.Zeroconf;
00010 
00016 public class Main {
00017     public static void main(String argv[]) throws IOException {
00018         int argc = argv.length;
00019         boolean debug = false;
00020 
00021         if ((argc > 0) && "--debug".equals(argv[0])) {
00022             System.arraycopy(argv, 1, argv, 0, --argc);
00023 
00024             {
00025                 ConsoleHandler handler = new ConsoleHandler();
00026                 handler.setLevel(Level.FINEST);
00027                 for (Enumeration<String> enumerator = LogManager.getLogManager().getLoggerNames(); enumerator.hasMoreElements();) {
00028                     String loggerName = enumerator.nextElement();
00029                     Logger logger = Logger.getLogger(loggerName);
00030                     logger.addHandler(handler);
00031                     logger.setLevel(Level.FINEST);
00032                 }
00033             }
00034             debug = true;
00035         }
00036 
00037                 if (argc == 0) {
00038                 Main.usage();
00039             System.exit(1);
00040                 } else if ( (argc >= 1) && "--polling".equals(argv[0])) {
00041                         Discovery.main_polling(argv);
00042                 } else if ( "--publisher".equals(argv[0]) ) {
00043                         Publisher.main_publisher(argv);
00044                 } else if ( "--discovery".equals(argv[0]) ) {
00045                         Discovery.main_handler(argv);
00046         } else {
00047                 Main.usage();
00048             System.exit(1);
00049         }
00050     }
00051     public static void usage() {
00052         System.out.println();
00053         System.out.println("jmdns:");
00054         System.out.println("     --debug          - output debugging info");
00055         System.out.println("     --publisher      - publishes a _ros-master._tcp for 8s");
00056         System.out.println("     --polling        - polling discovery for ros masters (_ros-master._tcp)");
00057         System.out.println("     --discovery      - callback discovery for ros services (ros, concert, app-manager)");
00058         System.out.println();
00059     }
00060 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends


zeroconf_jmdns_demos
Author(s): Daniel Stonier
autogenerated on Tue Nov 6 2012 14:19:14