|
From: Peter P. <pr...@us...> - 2006-11-27 11:10:51
|
Update of /cvsroot/pyxida/Pyxida/src/edu/harvard/syrah/pyxida In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3812/src/edu/harvard/syrah/pyxida Modified Files: Pyxida.java Log Message: Addressed some (all?) of Jon's TODO. Jon, grep for "TODO JTL". Index: Pyxida.java =================================================================== RCS file: /cvsroot/pyxida/Pyxida/src/edu/harvard/syrah/pyxida/Pyxida.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Pyxida.java 26 Nov 2006 23:41:37 -0000 1.8 --- Pyxida.java 27 Nov 2006 11:10:48 -0000 1.9 *************** *** 10,19 **** import edu.harvard.syrah.sbon.async.EventLoop; import edu.harvard.syrah.sbon.async.CallbacksIF.CB0; - import edu.harvard.syrah.sbon.comm.AddressFactory; import edu.harvard.syrah.sbon.comm.AddressIF; - import edu.harvard.syrah.sbon.comm.*; - import edu.harvard.syrah.sbon.comm.obj.*; - import edu.harvard.syrah.sbon.comm.obj.ObjComm; import edu.harvard.syrah.sbon.comm.obj.ObjCommIF; --- 10,15 ---- *************** *** 24,32 **** private static final String PYXIDA_VERSION = "0.1"; private static Pyxida pyxida = null; ! private NCManager ncManager = null; ! private APIManager apiManager = null; ! private PingManager pingManager = null; private ObjCommIF comm; --- 20,31 ---- private static final String PYXIDA_VERSION = "0.1"; + public static final String PYXIDA_CONFIG_FILE = System + .getProperty("pyxida.config", "config/pyxida.cfg"); + private static Pyxida pyxida = null; ! private NCManager ncManager; ! private APIManager apiManager; ! private PingManager pingManager; private ObjCommIF comm; *************** *** 35,54 **** private void init() { ! // TODO not sure if this needs to be out here ! // or can be pushed into NCManager comm = new ObjComm(); ! // Initialise the measurement modules ! pingManager = new PingManager(); ! pingManager.init(new CB0() { protected void cb(CBResult result) { ! // Initialise the NCs that we're responsible for ! ncManager = new NCManager(comm, pingManager); ! ncManager.init(); ! ! // Initialise the external APIs ! apiManager = new APIManager(ncManager); ! apiManager.init(); ! } ! }); } --- 34,80 ---- private void init() { ! // Initiliase the ObjComm communication module comm = new ObjComm(); ! int port = Integer.parseInt(Config.getConfigProps().getProperty("pyxida.port", "55500")); ! AddressIF objCommAddr = AddressFactory.createServer(port); ! comm.initServer(objCommAddr, new CB0() { protected void cb(CBResult result) { ! switch (result.state) { ! case OK: { ! // Initialise the measurement modules ! pingManager = new PingManager(); ! pingManager.init(new CB0() { ! protected void cb(CBResult result) { ! // Initialise the NCs that we're responsible for ! ncManager = new NCManager(comm, pingManager); ! ncManager.init(new CB0() { ! protected void cb(CBResult result) { ! switch (result.state) { ! case OK: { ! // Initialise the external APIs ! apiManager = new APIManager(ncManager); ! apiManager.init(); ! break; ! } ! case TIMEOUT: ! case ERROR: { ! log.error("Could not initialise the NCManager: " + result.what); ! break; ! } ! } ! } ! }); ! } ! }); ! break; ! } ! case TIMEOUT: ! case ERROR: { ! log.error("Could not bind to objcomm port: " + result.what); ! break; ! } ! } ! } ! }); } *************** *** 59,62 **** --- 85,91 ---- log.main("Pyxida Version " + PYXIDA_VERSION + " starting..."); + // TODO JTL: do you GetOpt magic here + // we need a switch to specify the config file and to turn on debugging + if (args.length > 0 && args[0].equals("-d")) { Log.setPackageRoot(Pyxida.class); *************** *** 66,69 **** --- 95,105 ---- args = newArgs; } + + // Read the config file + String configFileName = PYXIDA_CONFIG_FILE; + if (args.length == 1) { + configFileName = args[0]; + } + Config.read(configFileName); // Turn on assertions |