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.mandel;
20:
21: import java.io.*;
22: import java.util.*;
23:
24: import org.apache.log4j.*;
25: import org.apache.commons.cli.*;
26:
27: import org.homedns.dade.jcgrid.*;
28: import org.homedns.dade.jcgrid.cmd.*;
29: import org.homedns.dade.jcgrid.server.*;
30: import org.homedns.dade.jcgrid.worker.impl.mandel.*;
31:
32: public class JCGridServer {
33: private final static String className = JCGridServer.class
34: .getName();
35: private static Logger log = Logger.getLogger(className);
36: private static Logger logDetail = Logger.getLogger("DETAIL."
37: + className);
38:
39: public static void main(String[] args) {
40: try {
41: // Setup log4j
42:
43: MainCmd.setUpLog4J("server", true);
44:
45: // Setup GridServer
46:
47: log.warn("-----------------------------------------------");
48: log.warn("-- JCGridServer MandelGrid v" + Version.RELEASE);
49: log.warn("-----------------------------------------------");
50:
51: GridServer gs = new GridServer();
52: GridConfig gc = gs.getNodeConfig().getGridConfig();
53: gc.setServerAddress(MandelConfig.MANDELGRID_SERVER);
54: gc.setServerClientPort(MandelConfig.MANDELGRID_CLIENT_PORT);
55: gc.setServerWorkerPort(MandelConfig.MANDELGRID_WORKER_PORT);
56: gc.setServerAdminPort(MandelConfig.MANDELGRID_ADMIN_PORT);
57: gc
58: .setUseCompression(MandelConfig.MANDELGRID_USE_COMPRESSION);
59: gc.setUseVFS(false);
60:
61: // Parse command line options
62:
63: Options options = new Options();
64: try {
65: CommandLine cmd = MainCmd.parseCommonOptions(options,
66: gs.getNodeConfig(), args);
67:
68: if (cmd.getArgs().length > 0)
69: throw new Exception("Unknown command line option");
70: } catch (Exception ex) {
71: log.warn("Error while parsing command line", ex);
72:
73: HelpFormatter formatter = new HelpFormatter();
74: formatter.printHelp("JCGridServer", options);
75:
76: System.exit(0);
77: }
78:
79: // Start Server
80:
81: gs.start();
82:
83: log.warn("Running...");
84: } catch (Exception ex) {
85: log.warn("Error", ex);
86: System.exit(0);
87: }
88: }
89: }
|