JCGridServer.java :  » Net » JCGrid » org » homedns » dade » jcgrid » cmd » dummy » Java Open Source

Java Open Source » Net » JCGrid 
JCGrid » org » homedns » dade » jcgrid » cmd » dummy » JCGridServer.java
/*
 Copyright (C) 2004 David Bucciarelli (davibu@interfree.it)

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

package org.homedns.dade.jcgrid.cmd.dummy;

import org.apache.log4j.*;
import org.apache.commons.cli.*;

import org.homedns.dade.jcgrid.*;
import org.homedns.dade.jcgrid.cmd.*;
import org.homedns.dade.jcgrid.server.*;

public class JCGridServer {
    private final static String className=JCGridServer.class.getName();
    private static Logger log=Logger.getLogger(className);
    private static Logger logDetail=Logger.getLogger("DETAIL."+className);

    public static void main(String[] args) {
        try {
            // Setup log4j

            MainCmd.setUpLog4J("server",true);

            // Setup GridServer

            log.warn("-----------------------------------------------");
            log.warn("-- JCGridServer Dummy v"+Version.RELEASE);
            log.warn("-----------------------------------------------");
            
            GridServer gs=new GridServer();
            
            // Parse command line options

            Options options=new Options();
            try {
                CommandLine cmd=MainCmd.parseCommonOptions(
                    options,gs.getNodeConfig(),args);

                if(cmd.getArgs().length>0)
                    throw new Exception("Unknown command line option");
            } catch(Exception ex) {
                log.warn("Error while parsing command line",ex);

                HelpFormatter formatter=new HelpFormatter();
                formatter.printHelp("JCGridServer",options);
                
                System.exit(0);
            }

            // Start Server

            gs.start();

            log.warn("Running...");
        } catch(Exception ex) {
            log.warn("Error",ex);
            System.exit(0);
        }
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.