Index: sample/pingpong/PingPong.cpp
===================================================================
--- sample/pingpong/PingPong.cpp	(revision 10700)
+++ sample/pingpong/PingPong.cpp	(revision 12060)
@@ -3,4 +3,8 @@
 #include "ariba/utility/visual/DddVis.h"
 
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/json_parser.hpp>
+
+
 using ariba::utility::Configuration;
 using namespace ariba;
@@ -17,6 +21,10 @@
 
 // construction
-PingPong::PingPong() : pingId( 0 ) {
-	Timer::setInterval( 1000 );
+PingPong::PingPong( string config)  :
+        node(),
+        pingId( 0 ),
+        config_file(config)
+{
+	Timer::setInterval( 3000 );
 }
 
@@ -26,76 +34,45 @@
 
 // implementation of the startup interface
-void PingPong::startup() {
-
+void PingPong::startup()
+{
+    using boost::property_tree::ptree;
+    using boost::property_tree::json_parser::read_json;
+    
 	// set up logging
-	logging_rootlevel_info();
+	logging_rootlevel_debug();
 	logging_classlevel_debug(PingPong);
 
-	logging_info( "starting up PingPong service ... " );
-
-	// create ariba module
-	logging_debug( "creating ariba underlay module ... " );
-	ariba = new AribaModule();
-
-	Name spovnetName("pingpong");
-	Name nodeName = Name::UNSPECIFIED;
-	this->name = string("<ping>");
-
-	// get settings from configuration object
-	if( Configuration::haveConfig() ){
-		Configuration& config = Configuration::instance();
-
-		// get node name
-		if (config.exists("node.name"))
-			nodeName = config.read<string> ("node.name");
-
-		// configure ariba module
-		if (config.exists("ariba.endpoints"))
-			ariba->setProperty("endpoints", config.read<string>("ariba.endpoints"));
-		if (config.exists("ariba.bootstrap.hints"))
-			ariba->setProperty("bootstrap.hints", config.read<string>("ariba.bootstrap.hints"));
-		if (config.exists("pingpong.name"))
-			name = config.read<string>("pingpong.name");
-
-		// get visualization
-		if( config.exists("ariba.visual3d.ip") && config.exists("ariba.visual3d.port")){
-			string ip = config.read<string>("ariba.visual3d.ip");
-			unsigned int port = config.read<unsigned int>("ariba.visual3d.port");
-			unsigned int color = config.exists("node.color") ?
-					config.read<unsigned int>("node.color") : 0;
-			ariba::utility::DddVis::instance().configure(ip, port, color);
-		}
-
-	} // if( Configuration::haveConfig() )
-
-	// start ariba module
-	ariba->start();
-
-	// create node and join
-	node = new Node( *ariba, nodeName );
-
+	logging_info( "[PINGPONG]\t starting up PingPong service ... " );
+
+    // read config
+    ptree config;
+    try
+    {
+        read_json(config_file, config);
+    }
+    catch ( exception& e )
+    {
+        logging_warn("ERROR: Failed to read config file Â»" << config_file << "Â«: ");
+        logging_warn(e.what());
+        logging_warn("---> Using fallback config.");
+        
+        config.put("ariba.spovnet_name", "pingpong");
+    }
+    
+    name = "TODO";
+    
 	// bind communication and node listener
-	node->bind( this );                              /*NodeListener*/
-	node->bind( this, PingPong::PINGPONG_SERVICEID); /*CommunicationListener*/
-
-	// start node module
-	node->start();
-
-	// when initiating, you can define the overlay type, default is Chord [CHORD_OVERLAY]
-	SpoVNetProperties params;
-	//params.setBaseOverlayType( SpoVNetProperties::ONE_HOP_OVERLAY ); // alternative: OneHop
-
-	// initiate the spovnet
-	logging_info("initiating spovnet");
-	node->initiate(spovnetName, params);
-
-	// join the spovnet
-	logging_info("joining spovnet");
-	node->join(spovnetName);
+	node.bind( this );                              /*NodeListener*/
+	node.bind( this, PingPong::PINGPONG_SERVICEID); /*CommunicationListener*/
+
+    // connecting
+    logging_debug( "connecting ... " );
+
+	node.connect(config.get_child("ariba"));
 
 	// ping pong started up...
-	logging_info( "pingpong starting up with"
-			<< " [spovnetid " << node->getSpoVNetId().toString() << "]"
-			<< " and [nodeid " << node->getNodeId().toString() << "]" );
+	logging_info( "[PINGPONG]\t pingpong starting up with"
+			<< " [spovnetid " << node.getSpoVNetId().toString() << "]"
+			<< " and [nodeid " << node.getNodeId().toString() << "]" );
 }
 
@@ -103,5 +80,5 @@
 void PingPong::shutdown() {
 
-	logging_info( "pingpong service starting shutdown sequence ..." );
+	logging_info( "[PINGPONG]\t pingpong service starting shutdown sequence ..." );
 
 	// stop timer
@@ -109,16 +86,9 @@
 
 	// leave spovnet
-	node->leave();
+	node.leave();
 
 	// unbind communication and node listener
-	node->unbind( this );                               /*NodeListener*/
-	node->unbind( this, PingPong::PINGPONG_SERVICEID ); /*CommunicationListener*/
-
-	// stop the ariba module
-	ariba->stop();
-
-	// delete node and ariba module
-	delete node;
-	delete ariba;
+	node.unbind( this );                               /*NodeListener*/
+	node.unbind( this, PingPong::PINGPONG_SERVICEID ); /*CommunicationListener*/
 
 	// now we are completely shut down
@@ -129,4 +99,10 @@
 void PingPong::eventFunction() {
 
+    if ( node.getNeighborNodes().size() == 0)
+    {
+        logging_info( "[PINGPONG]\t +++ no neighbors +++" );
+        return;
+    }
+    
 	// we ping all nodes that are known in the overlay structure
 	// this can be all nodes (OneHop) overlay or just some neighbors
@@ -140,7 +116,9 @@
 
 	pingId++;
-	logging_info( "pinging overlay neighbors with ping id " << pingId );
+//	logging_info( endl << "#################" << endl
+    logging_info( endl << "|||||||||| >>>>>>>>>>" << endl
+	        << "[PINGPONG]\t PINGING overlay neighbors with ping id " << pingId );
 	PingPongMessage pingmsg( pingId, name );
-
+	
 	//-----------------------------------------------------------------------
 	// Option 1: get all neighboring nodes and send the message to each
@@ -154,12 +132,12 @@
 			s = s+names[i];
 		}
-		logging_info("----> I am " << name << " and I know " << s);
+		logging_info("[PINGPONG]\t ----> I am " << name << " and I know " << s);
 		names.clear();
 	}
 
-	vector<NodeID> nodes = node->getNeighborNodes();
+	vector<NodeID> nodes = node.getNeighborNodes();
 	BOOST_FOREACH( NodeID nid, nodes ){
-		logging_info( "sending ping message to " << nid.toString() );
-		node->sendMessage( pingmsg, nid, PingPong::PINGPONG_SERVICEID );
+		logging_info( "[PINGPONG]\t sending ping message to " << nid.toString() );
+		node.sendMessage( pingmsg, nid, PingPong::PINGPONG_SERVICEID );
 	}
 
@@ -195,6 +173,12 @@
 	for (int i=0;i<names.size(); i++) if (names[i]==pingmsg->getName()) found=true;
 	if (!found) names.push_back(pingmsg->getName());
-	logging_info( "received ping message on link " << lnk.toString()
+//	logging_info( endl << "#################" << endl
+	logging_info( endl << "<<<<<<<<<< ||||||||||" << endl
+	        << "[PINGPONG]\t RECEIVED ping message on link "
+	        << lnk.toString()
+	        << " " << (node.isLinkDirect(lnk) ? "[DIRECT-LINK]" : "[INDIRECT-LINK]")
+	        << " HopCount: " << node.getHopCount(lnk)
 			<< " from node " << remote.toString()
+			<< " (" << pingmsg->getName() << ")"
 			<< ": " << pingmsg->info() );
 	delete pingmsg;
Index: sample/pingpong/PingPong.h
===================================================================
--- sample/pingpong/PingPong.h	(revision 10700)
+++ sample/pingpong/PingPong.h	(revision 12060)
@@ -33,5 +33,5 @@
 
 public:
-	PingPong();
+	PingPong( string config );
 	virtual ~PingPong();
 
@@ -61,6 +61,6 @@
 private:
 	// the ariba module and a node
-	AribaModule* ariba;
-	Node* node;
+//	AribaModule* ariba;
+	Node node;
 	string name;
 	int counter;
@@ -73,4 +73,5 @@
 	unsigned long pingId;
 
+	string config_file;
 };
 
Index: sample/pingpong/main.cpp
===================================================================
--- sample/pingpong/main.cpp	(revision 10700)
+++ sample/pingpong/main.cpp	(revision 12060)
@@ -10,12 +10,12 @@
 
 	// get config file
-	string config = "../etc/settings.cnf";
+	string config;
 	if (argc >= 2) config = argv[1];
 
-	StartupWrapper::initConfig( config );
+//	StartupWrapper::initConfig( config );
 	StartupWrapper::startSystem();
 
 	// this will do the main functionality and block
-	PingPong ping;
+	PingPong ping(config);
 	StartupWrapper::startup(&ping);
 
