001: /*
002: Copyright (C) 2004 David Bucciarelli (davibu@interfree.it)
003:
004: This program is free software; you can redistribute it and/or
005: modify it under the terms of the GNU General Public License
006: as published by the Free Software Foundation; either version 2
007: of the License, or (at your option) any later version.
008:
009: This program is distributed in the hope that it will be useful,
010: but WITHOUT ANY WARRANTY; without even the implied warranty of
011: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: GNU General Public License for more details.
013:
014: You should have received a copy of the GNU General Public License
015: along with this program; if not, write to the Free Software
016: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
017: */
018:
019: package org.homedns.dade.jcgrid;
020:
021: import java.io.*;
022: import java.net.*;
023: import javax.net.ssl.*;
024:
025: import org.apache.log4j.*;
026:
027: import org.homedns.dade.jcgrid.message.*;
028: import org.homedns.dade.jcgrid.server.*;
029: import org.homedns.dade.jcgrid.util.*;
030:
031: public abstract class GridNode {
032: private final static String className = GridNode.class.getName();
033: private static Logger log = Logger.getLogger(className);
034: private static Logger logDetail = Logger.getLogger("DETAIL."
035: + className);
036:
037: private GridNodeConfig config;
038:
039: public GridNode(GridNodeConfig cfg) {
040: if (log.isDebugEnabled())
041: log.debug("Start GridNode(" + cfg + ")");
042:
043: config = cfg;
044:
045: if (log.isDebugEnabled())
046: log.debug("End GridNode()");
047: }
048:
049: //----------------------------- Start & Stop -------------------------------
050:
051: public void start() throws Exception {
052: if (logDetail.isDebugEnabled())
053: logDetail.debug("Start start()");
054:
055: log.warn("Starting JCGrid Node...");
056:
057: GridConfig gCfg = config.getGridConfig();
058:
059: log.warn(" Server address: " + gCfg.getServerAddress());
060: log.warn(" Server client port: " + gCfg.getServerClientPort());
061: log.warn(" Server worker port: " + gCfg.getServerWorkerPort());
062: log.warn(" Server admin. port: " + gCfg.getServerAdminPort());
063: log.warn(" Working dir.: " + config.getWorkingDir());
064: log.warn(" Use secure connection: "
065: + (gCfg.getUseSecureConnection() ? "yes" : "no"));
066: log.warn(" Node type: " + config.getType());
067: log.warn(" Use compressed connection: "
068: + (gCfg.getUseCompression() ? "yes" : "no"));
069:
070: if (logDetail.isDebugEnabled())
071: logDetail.debug("End start()");
072: }
073:
074: public void stop() throws Exception {
075: if (logDetail.isDebugEnabled())
076: logDetail.debug("Start stop()");
077: if (logDetail.isDebugEnabled())
078: logDetail.debug("End stop()");
079: }
080:
081: //------------------------------- Get & Set --------------------------------
082:
083: public GridNodeConfig getNodeConfig() {
084: if (logDetail.isDebugEnabled())
085: logDetail.debug("Start getNodeConfig()");
086: if (logDetail.isDebugEnabled())
087: logDetail.debug("End getNodeConfig(" + config + ")");
088:
089: return config;
090: }
091:
092: public void setNodeConfig(GridNodeGenericConfig cfg) {
093: if (logDetail.isDebugEnabled())
094: logDetail.debug("Start setNodeConfig(" + cfg + ")");
095:
096: config = cfg;
097:
098: if (logDetail.isDebugEnabled())
099: logDetail.debug("End setNodeConfig()");
100: }
101: }
|