@Test public void testMain() throws Exception { System.out.println("main"); String[] args = null; try { Application.main(args); } catch(Exception ex) { } }
public static void main(String[] args) throws Exception { Logger.getLogger("org.sonews").log(Level.INFO, VERSION); boolean feed = false; boolean purger = false; int port = -1; for (int n = 0; n < args.length; n++) { switch (args[n]) { case "-c": case "-config": { Config.inst().set(Config.LEVEL_CLI, Config.CONFIGFILE, args[++n]); System.out.println("Using config file " + args[n]); break; } case "-C": case "-context": { n++; break; } case "-dumpjdbcdriver": { System.out.println("Available JDBC drivers:"); Enumeration<Driver> drvs = DriverManager.getDrivers(); while (drvs.hasMoreElements()) { System.out.println(drvs.nextElement()); } return; } case "-feed": { feed = true; break; } case "-h": case "-help": { printArguments(); return; } case "-p": { port = Integer.parseInt(args[++n]); break; } case "-plugin-storage": { System.out .println("Warning: -plugin-storage is not implemented!"); break; } case "-purger": { purger = true; break; } case "-v": case "-version": return; } } ApplicationContext context = new AnnotationConfigApplicationContext(Application.class); context = new FileSystemXmlApplicationContext( new String[]{"sonews.xml"}, context); StorageProvider sprov = context.getBean("storageProvider", StorageProvider.class); StorageManager.enableProvider(sprov); ChannelLineBuffers.allocateDirect(); Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownHook())); if (port <= 0) { port = Config.inst().get(Config.PORT, 119); } NNTPDaemonRunnable nntpDaemon = (NNTPDaemonRunnable)context.getBean("NNTPDaemon"); nntpDaemon.setPort(port); DaemonThread daemon; daemon = new DaemonThread(nntpDaemon); daemon.start(); new DaemonThread(Connections.getInstance()).start(); if (feed) { FeedManager.startFeeding(); } if (purger) { new DaemonThread(new Purger()).start(); } daemon.join(); }
Application { public static void main(String[] args) throws Exception { Logger.getLogger("org.sonews").log(Level.INFO, VERSION); boolean feed = false; boolean purger = false; int port = -1; for (int n = 0; n < args.length; n++) { switch (args[n]) { case "-c": case "-config": { Config.inst().set(Config.LEVEL_CLI, Config.CONFIGFILE, args[++n]); System.out.println("Using config file " + args[n]); break; } case "-C": case "-context": { n++; break; } case "-dumpjdbcdriver": { System.out.println("Available JDBC drivers:"); Enumeration<Driver> drvs = DriverManager.getDrivers(); while (drvs.hasMoreElements()) { System.out.println(drvs.nextElement()); } return; } case "-feed": { feed = true; break; } case "-h": case "-help": { printArguments(); return; } case "-p": { port = Integer.parseInt(args[++n]); break; } case "-plugin-storage": { System.out .println("Warning: -plugin-storage is not implemented!"); break; } case "-purger": { purger = true; break; } case "-v": case "-version": return; } } ApplicationContext context = new AnnotationConfigApplicationContext(Application.class); context = new FileSystemXmlApplicationContext( new String[]{"sonews.xml"}, context); StorageProvider sprov = context.getBean("storageProvider", StorageProvider.class); StorageManager.enableProvider(sprov); ChannelLineBuffers.allocateDirect(); Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownHook())); if (port <= 0) { port = Config.inst().get(Config.PORT, 119); } NNTPDaemonRunnable nntpDaemon = (NNTPDaemonRunnable)context.getBean("NNTPDaemon"); nntpDaemon.setPort(port); DaemonThread daemon; daemon = new DaemonThread(nntpDaemon); daemon.start(); new DaemonThread(Connections.getInstance()).start(); if (feed) { FeedManager.startFeeding(); } if (purger) { new DaemonThread(new Purger()).start(); } daemon.join(); } }
Application { public static void main(String[] args) throws Exception { Logger.getLogger("org.sonews").log(Level.INFO, VERSION); boolean feed = false; boolean purger = false; int port = -1; for (int n = 0; n < args.length; n++) { switch (args[n]) { case "-c": case "-config": { Config.inst().set(Config.LEVEL_CLI, Config.CONFIGFILE, args[++n]); System.out.println("Using config file " + args[n]); break; } case "-C": case "-context": { n++; break; } case "-dumpjdbcdriver": { System.out.println("Available JDBC drivers:"); Enumeration<Driver> drvs = DriverManager.getDrivers(); while (drvs.hasMoreElements()) { System.out.println(drvs.nextElement()); } return; } case "-feed": { feed = true; break; } case "-h": case "-help": { printArguments(); return; } case "-p": { port = Integer.parseInt(args[++n]); break; } case "-plugin-storage": { System.out .println("Warning: -plugin-storage is not implemented!"); break; } case "-purger": { purger = true; break; } case "-v": case "-version": return; } } ApplicationContext context = new AnnotationConfigApplicationContext(Application.class); context = new FileSystemXmlApplicationContext( new String[]{"sonews.xml"}, context); StorageProvider sprov = context.getBean("storageProvider", StorageProvider.class); StorageManager.enableProvider(sprov); ChannelLineBuffers.allocateDirect(); Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownHook())); if (port <= 0) { port = Config.inst().get(Config.PORT, 119); } NNTPDaemonRunnable nntpDaemon = (NNTPDaemonRunnable)context.getBean("NNTPDaemon"); nntpDaemon.setPort(port); DaemonThread daemon; daemon = new DaemonThread(nntpDaemon); daemon.start(); new DaemonThread(Connections.getInstance()).start(); if (feed) { FeedManager.startFeeding(); } if (purger) { new DaemonThread(new Purger()).start(); } daemon.join(); } Application(); }
Application { public static void main(String[] args) throws Exception { Logger.getLogger("org.sonews").log(Level.INFO, VERSION); boolean feed = false; boolean purger = false; int port = -1; for (int n = 0; n < args.length; n++) { switch (args[n]) { case "-c": case "-config": { Config.inst().set(Config.LEVEL_CLI, Config.CONFIGFILE, args[++n]); System.out.println("Using config file " + args[n]); break; } case "-C": case "-context": { n++; break; } case "-dumpjdbcdriver": { System.out.println("Available JDBC drivers:"); Enumeration<Driver> drvs = DriverManager.getDrivers(); while (drvs.hasMoreElements()) { System.out.println(drvs.nextElement()); } return; } case "-feed": { feed = true; break; } case "-h": case "-help": { printArguments(); return; } case "-p": { port = Integer.parseInt(args[++n]); break; } case "-plugin-storage": { System.out .println("Warning: -plugin-storage is not implemented!"); break; } case "-purger": { purger = true; break; } case "-v": case "-version": return; } } ApplicationContext context = new AnnotationConfigApplicationContext(Application.class); context = new FileSystemXmlApplicationContext( new String[]{"sonews.xml"}, context); StorageProvider sprov = context.getBean("storageProvider", StorageProvider.class); StorageManager.enableProvider(sprov); ChannelLineBuffers.allocateDirect(); Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownHook())); if (port <= 0) { port = Config.inst().get(Config.PORT, 119); } NNTPDaemonRunnable nntpDaemon = (NNTPDaemonRunnable)context.getBean("NNTPDaemon"); nntpDaemon.setPort(port); DaemonThread daemon; daemon = new DaemonThread(nntpDaemon); daemon.start(); new DaemonThread(Connections.getInstance()).start(); if (feed) { FeedManager.startFeeding(); } if (purger) { new DaemonThread(new Purger()).start(); } daemon.join(); } Application(); static void main(String[] args); }
Application { public static void main(String[] args) throws Exception { Logger.getLogger("org.sonews").log(Level.INFO, VERSION); boolean feed = false; boolean purger = false; int port = -1; for (int n = 0; n < args.length; n++) { switch (args[n]) { case "-c": case "-config": { Config.inst().set(Config.LEVEL_CLI, Config.CONFIGFILE, args[++n]); System.out.println("Using config file " + args[n]); break; } case "-C": case "-context": { n++; break; } case "-dumpjdbcdriver": { System.out.println("Available JDBC drivers:"); Enumeration<Driver> drvs = DriverManager.getDrivers(); while (drvs.hasMoreElements()) { System.out.println(drvs.nextElement()); } return; } case "-feed": { feed = true; break; } case "-h": case "-help": { printArguments(); return; } case "-p": { port = Integer.parseInt(args[++n]); break; } case "-plugin-storage": { System.out .println("Warning: -plugin-storage is not implemented!"); break; } case "-purger": { purger = true; break; } case "-v": case "-version": return; } } ApplicationContext context = new AnnotationConfigApplicationContext(Application.class); context = new FileSystemXmlApplicationContext( new String[]{"sonews.xml"}, context); StorageProvider sprov = context.getBean("storageProvider", StorageProvider.class); StorageManager.enableProvider(sprov); ChannelLineBuffers.allocateDirect(); Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownHook())); if (port <= 0) { port = Config.inst().get(Config.PORT, 119); } NNTPDaemonRunnable nntpDaemon = (NNTPDaemonRunnable)context.getBean("NNTPDaemon"); nntpDaemon.setPort(port); DaemonThread daemon; daemon = new DaemonThread(nntpDaemon); daemon.start(); new DaemonThread(Connections.getInstance()).start(); if (feed) { FeedManager.startFeeding(); } if (purger) { new DaemonThread(new Purger()).start(); } daemon.join(); } Application(); static void main(String[] args); static final String VERSION; static final LocalDateTime STARTDATE; }