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.worker.*;
27: import org.homedns.dade.jcgrid.worker.impl.dummy.*;
28:
29: public class JCGridWorker {
30: private final static String className = JCGridWorker.class
31: .getName();
32: private static Logger log = Logger.getLogger(className);
33: private static Logger logDetail = Logger.getLogger("DETAIL."
34: + className);
35:
36: public static void main(String[] args) {
37: try {
38: // Setup log4j
39:
40: MainCmd.setUpLog4J("worker", true);
41:
42: // Setup GridServer
43:
44: log.warn("-----------------------------------------------");
45: log.warn("-- JCGridWorker Dummy v" + Version.RELEASE);
46: log.warn("-----------------------------------------------");
47:
48: GridWorker gw = new GridWorker();
49:
50: // Parse command line options
51:
52: Options options = new Options();
53: try {
54: CommandLine cmd = MainCmd.parseCommonOptions(options,
55: gw.getNodeConfig(), args);
56:
57: if (cmd.getArgs().length > 0)
58: throw new Exception("Unknown command line option");
59: } catch (Exception ex) {
60: log.warn("Error while parsing command line", ex);
61:
62: HelpFormatter formatter = new HelpFormatter();
63: formatter.printHelp("JCGridWorker", options);
64:
65: System.exit(0);
66: }
67:
68: // Start Worker
69:
70: gw.start();
71: log.warn("Running...");
72:
73: // Wait shutdown
74:
75: gw.waitShutdown();
76: } catch (Exception ex) {
77: log.warn("Error", ex);
78: System.exit(0);
79: }
80: }
81: }
|