From 03db92e84101589a4ad12df53b92ca74c6233fef Mon Sep 17 00:00:00 2001
From: Georg Lukas <georg@op-co.de>
Date: Tue, 31 Mar 2009 04:00:06 +0200
Subject: config can not register itself

---
 src/awds/config.h |    3 ++-
 src/config.cc     |   29 +++++++++--------------------
 src/testmodul.cc  |    5 +++--
 3 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/src/awds/config.h b/src/awds/config.h
index b198c4fb54a8f7104f87576e4bf521a5adeecf41..27a2a6ccabf813b9031ec3ab6a0161cce4dca300 100644
--- a/src/awds/config.h
+++ b/src/awds/config.h
@@ -50,7 +50,8 @@ public:
   */
 
 	virtual int registerVar(ConfigVariable* cv);
-	int init();
+	void initShell();
+	void initSPP();
 private:
 	int remoteCall(std::string variableName,std::string variableValue,std::string nodeList);
 
diff --git a/src/config.cc b/src/config.cc
index 9760bb40ede7f80048acbad04b6b357bd1add8a5..e2e2097858ed68be0b5997823ca14bcdc34f755d 100644
--- a/src/config.cc
+++ b/src/config.cc
@@ -67,30 +67,19 @@ static const char *config_cmd_usage =
     "	<variable>	config variable to be queried/set. default: list all\n"
     "	<value>		the value to be assigned to the variable\n";
 
-int Config::init() {
+void Config::initShell() {
 
     REP_MAP_OBJ(Shell *, shell);
+
+    shell->add_command("rc", remoteconfig_command_fn, this,
+	       "remote configuration", config_cmd_usage);
+}
+
+void Config::initSPP() {
+
     REP_MAP_OBJ(SppManager *, sppManager);
 
-    /* either shell or SPP must be present for config to make sense */
-    if (!shell && !sppManager)
-	return -1;
-
-    if (shell) {
-	    shell->add_command("rc", remoteconfig_command_fn, this,
-			       "remote configuration",
-			       config_cmd_usage);
-    } else {
-	    GEA.dbg() << "Config is missing shell. no local configuration possible!" << std::endl;
-    }
-
-    if (sppManager) {
-	    sppManager->registerHandler(SPP_CONFIG_ID, 0, Config::requestHandler);
-    } else {
-	    GEA.dbg() << "Config is missing SPPManager. no remote configuration possible!" << std::endl;
-    }
-
-    return 0;
+    sppManager->registerHandler(SPP_CONFIG_ID, 0, Config::requestHandler);
 }
 
 int Config::remoteCall(std::string nodeList,std::string variableName,std::string variableValue)
diff --git a/src/testmodul.cc b/src/testmodul.cc
index 7df5afd7923aaf0e698bc8cbda17e2863d32b00c..fef4ad7d698e2268535d03e80ea979b974e8e5c1 100644
--- a/src/testmodul.cc
+++ b/src/testmodul.cc
@@ -94,8 +94,8 @@ GEA_MAIN(argc, argv)
 {
 
 	Config *config = new Config();
-	if (config->init() != 0)
-		return -1;
+	config->initSPP();
+	config->initShell();
 
 	REP_INSERT_OBJ(Config *, config, config);
 
@@ -106,4 +106,5 @@ GEA_MAIN(argc, argv)
 			GEA.dbg() << "RemoteConfigTest Module not found :( " << endl;
 	}
 	else remoteConfigTest->addRemoteConfigTestModulCmd();
+	GEA.dbg() << "RemoteConfigTest module running..." << endl;
 }
-- 
1.6.2.1


