01: /*
02: Copyright (C) 2004 David Bucciarelli (davibu@interfree.it)
03:
04: This program is free software; you can redistribute it and/or
05: modify it under the terms of the GNU General Public License
06: as published by the Free Software Foundation; either version 2
07: of the License, or (at your option) any later version.
08:
09: This program is distributed in the hope that it will be useful,
10: but WITHOUT ANY WARRANTY; without even the implied warranty of
11: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: GNU General Public License for more details.
13:
14: You should have received a copy of the GNU General Public License
15: along with this program; if not, write to the Free Software
16: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: */
18:
19: package org.homedns.dade.jcgrid.cmd.dummy;
20:
21: import org.apache.log4j.*;
22: import org.apache.commons.cli.*;
23:
24: import org.homedns.dade.jcgrid.*;
25: import org.homedns.dade.jcgrid.cmd.*;
26: import org.homedns.dade.jcgrid.server.*;
27:
28: public class JCGridServer {
29: private final static String className = JCGridServer.class
30: .getName();
31: private static Logger log = Logger.getLogger(className);
32: private static Logger logDetail = Logger.getLogger("DETAIL."
33: + className);
34:
35: public static void main(String[] args) {
36: try {
37: // Setup log4j
38:
39: MainCmd.setUpLog4J("server", true);
40:
41: // Setup GridServer
42:
43: log.warn("-----------------------------------------------");
44: log.warn("-- JCGridServer Dummy v" + Version.RELEASE);
45: log.warn("-----------------------------------------------");
46:
47: GridServer gs = new GridServer();
48:
49: // Parse command line options
50:
51: Options options = new Options();
52: try {
53: CommandLine cmd = MainCmd.parseCommonOptions(options,
54: gs.getNodeConfig(), args);
55:
56: if (cmd.getArgs().length > 0)
57: throw new Exception("Unknown command line option");
58: } catch (Exception ex) {
59: log.warn("Error while parsing command line", ex);
60:
61: HelpFormatter formatter = new HelpFormatter();
62: formatter.printHelp("JCGridServer", options);
63:
64: System.exit(0);
65: }
66:
67: // Start Server
68:
69: gs.start();
70:
71: log.warn("Running...");
72: } catch (Exception ex) {
73: log.warn("Error", ex);
74: System.exit(0);
75: }
76: }
77: }
|