Revision: 40784
          http://brlcad.svn.sourceforge.net/brlcad/?rev=40784&view=rev
Author:   davidloman
Date:     2010-09-29 11:44:34 +0000 (Wed, 29 Sep 2010)

Log Message:
-----------
Make geoserv.cxx parse config for node name and port.  

Modified Paths:
--------------
    rt^3/trunk/src/GS/geoserv.cxx

Modified: rt^3/trunk/src/GS/geoserv.cxx
===================================================================
--- rt^3/trunk/src/GS/geoserv.cxx       2010-09-29 11:33:13 UTC (rev 40783)
+++ rt^3/trunk/src/GS/geoserv.cxx       2010-09-29 11:44:34 UTC (rev 40784)
@@ -17,7 +17,7 @@
  * License along with this file; see the file named COPYING for more
  * information.
  */
-/** @file gsmain.cxx
+/** @file geoserv.cxx
  *
  * Brief description
  *
@@ -30,18 +30,20 @@
 #include "libevent.h"
 
 #include <iostream>
+#include <stdlib.h>
 
 #include <QtCore/QString>
 
 int main(int argc, char* argv[])
 {
     std::cout << std::endl << std::endl;
+    Logger* log = Logger::getInstance();
+    log->logBANNER("geoserv", "GeometryService Config Loader");
 
-    Logger* log = Logger::getInstance();
     Config* c = Config::getInstance();
 
     //TODO Configure system loads stuff here
-    if (c->loadFile("geoserve.config")) {
+    if (c->loadFile("geoserve.config", true)) {
        return 1;
     }
 
@@ -50,7 +52,34 @@
        localNodename = "DefaultGSNodename";
     }
 
-    log->logBANNER("GSMain", "Booting GeometryService: " + localNodename);
 
+    log->logBANNER("geoserv", "Booting GeometryService: " + localNodename);
+
+    QString sport = c->getConfigValue("ListenPort");
+    if (sport == NULL){
+       log->logERROR("geoserv", "Config File does not contain a 'ListenPort' 
parameter");
+       return 1;
+    }
+    if (sport.length() <= 0){
+       log->logERROR("geoserv", "Config File contains a 'ListenPort' key, 
however the value was <= 0.");
+       return 1;
+    }
+
+    bool ok;
+    quint16 port = sport.toUShort(&ok, 10);
+    if (!ok){
+       log->logERROR("geoserv", "Config File contains a 'ListenPort' key, 
however the value failed to parse to a valid number.");
+       return 1;
+    }
+
+    bool daemon = false;
+
+    GeometryService* gs = new GeometryService(localNodename, port);
+
+    if (daemon){
+       gs->start();
+    }
+
+
     return 0;
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to