Index: src/Fragmentation/Automation/FragmentScheduler.cpp
===================================================================
--- src/Fragmentation/Automation/FragmentScheduler.cpp	(revision cd4a6e84fc65152a21053ba13c6d87bca6e724ae)
+++ src/Fragmentation/Automation/FragmentScheduler.cpp	(revision cd4a6e84fc65152a21053ba13c6d87bca6e724ae)
@@ -0,0 +1,91 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2011 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * \file FragmentScheduler.cpp
+ *
+ * This file strongly follows the Serialization example from the boost::asio
+ * library (see server.cpp)
+ *
+ *  Created on: Oct 19, 2011
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// boost asio needs specific operator new
+#include <boost/asio.hpp>
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include <boost/bind.hpp>
+#include <boost/lexical_cast.hpp>
+#include <iostream>
+#include <vector>
+#include "Connection.hpp" // Must come before boost/serialization headers.
+#include <boost/serialization/vector.hpp>
+#include "CodePatterns/Info.hpp"
+#include "FragmentJob.hpp"
+
+#include "FragmentScheduler.hpp"
+
+FragmentScheduler::FragmentScheduler(boost::asio::io_service& io_service, unsigned short port) :
+  acceptor_(io_service,
+      boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port)
+  )
+{
+    Info info(__FUNCTION__);
+  FragmentJob s(std::string("test"), 1);
+  jobs_.push_back(s);
+
+  // Start an accept operation for a new connection.
+  connection_ptr new_conn(new Connection(acceptor_.get_io_service()));
+  acceptor_.async_accept(new_conn->socket(),
+    boost::bind(&FragmentScheduler::handle_accept, this,
+      boost::asio::placeholders::error, new_conn));
+}
+
+/// Handle completion of a accept operation.
+void FragmentScheduler::handle_accept(const boost::system::error_code& e, connection_ptr conn)
+{
+  Info info(__FUNCTION__);
+  std::cout << "handle_accept called." << std::endl;
+  if (!e)
+  {
+    // Successfully accepted a new connection. Send the list of jobs to the
+    // client. The connection::async_write() function will automatically
+    // serialize the data structure for us.
+    conn->async_write(jobs_,
+      boost::bind(&FragmentScheduler::handle_write, this,
+      boost::asio::placeholders::error, conn));
+
+    // Start an accept operation for a new Connection.
+    connection_ptr new_conn(new Connection(acceptor_.get_io_service()));
+    acceptor_.async_accept(new_conn->socket(),
+      boost::bind(&FragmentScheduler::handle_accept, this,
+      boost::asio::placeholders::error, new_conn));
+  }
+  else
+  {
+    // An error occurred. Log it and return. Since we are not starting a new
+    // accept operation the io_service will run out of work to do and the
+    // server will exit.
+    std::cerr << "Error: " << e.message() << std::endl;
+  }
+}
+
+/// Handle completion of a write operation.
+void FragmentScheduler::handle_write(const boost::system::error_code& e, connection_ptr conn)
+{
+    Info info(__FUNCTION__);
+  // Nothing to do. The socket will be closed automatically when the last
+  // reference to the connection object goes away.
+}
+
Index: src/Fragmentation/Automation/FragmentScheduler.hpp
===================================================================
--- src/Fragmentation/Automation/FragmentScheduler.hpp	(revision cd4a6e84fc65152a21053ba13c6d87bca6e724ae)
+++ src/Fragmentation/Automation/FragmentScheduler.hpp	(revision cd4a6e84fc65152a21053ba13c6d87bca6e724ae)
@@ -0,0 +1,46 @@
+/*
+ * FragmentScheduler.hpp
+ *
+ *  Created on: Oct 19, 2011
+ *      Author: heber
+ */
+
+#ifndef FRAGMENTSCHEDULER_HPP_
+#define FRAGMENTSCHEDULER_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <vector>
+#include <boost/asio.hpp>
+
+#include "Connection.hpp"
+#include "FragmentJob.hpp"
+
+/** FragmentScheduler serves FragmentJobs to Workers.
+ *
+ */
+class FragmentScheduler
+{
+public:
+  /// Constructor opens the acceptor and starts waiting for the first incoming
+  /// Connection.
+  FragmentScheduler(boost::asio::io_service& io_service, unsigned short port);
+
+  /// Handle completion of a accept operation.
+  void handle_accept(const boost::system::error_code& e, connection_ptr conn);
+
+  /// Handle completion of a write operation.
+  void handle_write(const boost::system::error_code& e, connection_ptr conn);
+
+private:
+  /// The acceptor object used to accept incoming socket connections.
+  boost::asio::ip::tcp::acceptor acceptor_;
+
+  /// The data to be sent to each client.
+  std::vector<FragmentJob> jobs_;
+};
+
+#endif /* FRAGMENTSCHEDULER_HPP_ */
Index: src/Fragmentation/Automation/FragmentWorker.cpp
===================================================================
--- src/Fragmentation/Automation/FragmentWorker.cpp	(revision cd4a6e84fc65152a21053ba13c6d87bca6e724ae)
+++ src/Fragmentation/Automation/FragmentWorker.cpp	(revision cd4a6e84fc65152a21053ba13c6d87bca6e724ae)
@@ -0,0 +1,103 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2011 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * \file FragmentWorker.cpp
+ *
+ * This file strongly follows the Serialization example from the boost::asio
+ * library (see client.cpp).
+ *
+ *  Created on: Nov 18, 2011
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// boost asio needs specific operator new
+#include <boost/asio.hpp>
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include <boost/bind.hpp>
+#include <iostream>
+#include <vector>
+#include "Connection.hpp" // Must come before boost/serialization headers.
+#include <boost/serialization/vector.hpp>
+#include "CodePatterns/Info.hpp"
+#include "FragmentJob.hpp"
+#include "FragmentWorker.hpp"
+
+/// Constructor starts the asynchronous connect operation.
+FragmentWorker::FragmentWorker(
+    boost::asio::io_service& io_service,
+    const std::string& host,
+    const std::string& service) :
+  connection_(io_service)
+{
+    Info info(__FUNCTION__);
+  // Resolve the host name into an IP address.
+  boost::asio::ip::tcp::resolver resolver(io_service);
+  boost::asio::ip::tcp::resolver::query query(host, service);
+  boost::asio::ip::tcp::resolver::iterator endpoint_iterator =
+    resolver.resolve(query);
+  boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
+
+  // Start an asynchronous connect operation.
+  connection_.socket().async_connect(endpoint,
+    boost::bind(&FragmentWorker::handle_connect, this,
+      boost::asio::placeholders::error));
+}
+
+/// Handle completion of a connect operation.
+void FragmentWorker::handle_connect(const boost::system::error_code& e)
+{
+    Info info(__FUNCTION__);
+  if (!e)
+  {
+    // Successfully established connection. Start operation to read the list
+    // of jobs. The connection::async_read() function will automatically
+    // decode the data that is read from the underlying socket.
+    connection_.async_read(jobs_,
+      boost::bind(&FragmentWorker::handle_read, this,
+      boost::asio::placeholders::error));
+  }
+  else
+  {
+    // An error occurred. Log it and return. Since we are not starting a new
+    // operation the io_service will run out of work to do and the client will
+    // exit.
+    std::cerr << e.message() << std::endl;
+  }
+}
+
+/// Handle completion of a read operation.
+void FragmentWorker::handle_read(const boost::system::error_code& e)
+{
+    Info info(__FUNCTION__);
+  if (!e)
+  {
+    // Print out the data that was received.
+    for (std::size_t i = 0; i < jobs_.size(); ++i)
+    {
+        std::cout << "Job number " << i << "\n";
+        std::cout << "  output: " << jobs_[i].outputfile << "\n";
+        std::cout << "  id: " << jobs_[i].JobId << "\n";
+    }
+  }
+  else
+  {
+    // An error occurred.
+    std::cerr << e.message() << std::endl;
+  }
+
+  // Since we are not starting a new operation the io_service will run out of
+  // work to do and the client will exit.
+}
+
Index: src/Fragmentation/Automation/FragmentWorker.hpp
===================================================================
--- src/Fragmentation/Automation/FragmentWorker.hpp	(revision cd4a6e84fc65152a21053ba13c6d87bca6e724ae)
+++ src/Fragmentation/Automation/FragmentWorker.hpp	(revision cd4a6e84fc65152a21053ba13c6d87bca6e724ae)
@@ -0,0 +1,45 @@
+/*
+ * \file FragmentWorker.hpp
+ *
+ *  Created on: Nov 18, 2011
+ *      Author: heber
+ */
+
+#ifndef FRAGMENTWORKER_HPP_
+#define FRAGMENTWORKER_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <boost/asio.hpp>
+#include <vector>
+#include "Connection.hpp"
+#include "FragmentJob.hpp"
+
+/** Receives a job from Server to execute and return FragmentResult.
+ *
+ */
+class FragmentWorker
+{
+public:
+  /// Constructor starts the asynchronous connect operation.
+  FragmentWorker(boost::asio::io_service& io_service,
+      const std::string& host, const std::string& service);
+
+  /// Handle completion of a connect operation.
+  void handle_connect(const boost::system::error_code& e);
+
+  /// Handle completion of a read operation.
+  void handle_read(const boost::system::error_code& e);
+
+private:
+  /// The Connection to the server.
+  Connection connection_;
+
+  /// The data received from the server.
+  std::vector<FragmentJob> jobs_;
+};
+
+#endif /* FRAGMENTWORKER_HPP_ */
Index: src/Fragmentation/Automation/Makefile.am
===================================================================
--- src/Fragmentation/Automation/Makefile.am	(revision 8c9596e4625116d26a89a0b50b4ed923834abde4)
+++ src/Fragmentation/Automation/Makefile.am	(revision cd4a6e84fc65152a21053ba13c6d87bca6e724ae)
@@ -14,9 +14,9 @@
 servers11n_SOURCES = \
   Connection.hpp \
-  server.cpp \
   FragmentJob.cpp \
   FragmentJob.hpp \
-  StockServer.cpp \
-  StockServer.hpp
+  FragmentScheduler.cpp \
+  FragmentScheduler.hpp \
+  server.cpp
 servers11n_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
 servers11n_CXXFLAGS = $(AM_CPPFLAGS)
@@ -33,6 +33,6 @@
   FragmentJob.cpp \
   FragmentJob.hpp \
-  StockClient.cpp \
-  StockClient.hpp
+  FragmentWorker.cpp \
+  FragmentWorker.hpp
 clients11n_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
 clients11n_CXXFLAGS = $(AM_CPPFLAGS)
Index: src/Fragmentation/Automation/StockClient.cpp
===================================================================
--- src/Fragmentation/Automation/StockClient.cpp	(revision 8c9596e4625116d26a89a0b50b4ed923834abde4)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * FragmentWorker.cpp
- *
- *  Created on: Nov 18, 2011
- *      Author: heber
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// boost asio needs specific operator new
-#include <boost/asio.hpp>
-
-#include "CodePatterns/MemDebug.hpp"
-
-#include <boost/bind.hpp>
-#include <iostream>
-#include <vector>
-#include "Connection.hpp" // Must come before boost/serialization headers.
-#include <boost/serialization/vector.hpp>
-#include "CodePatterns/Info.hpp"
-#include "FragmentJob.hpp"
-#include "StockClient.hpp"
-
-/// Constructor starts the asynchronous connect operation.
-FragmentWorker::FragmentWorker(
-    boost::asio::io_service& io_service,
-    const std::string& host,
-    const std::string& service) :
-  connection_(io_service)
-{
-    Info info(__FUNCTION__);
-  // Resolve the host name into an IP address.
-  boost::asio::ip::tcp::resolver resolver(io_service);
-  boost::asio::ip::tcp::resolver::query query(host, service);
-  boost::asio::ip::tcp::resolver::iterator endpoint_iterator =
-    resolver.resolve(query);
-  boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
-
-  // Start an asynchronous connect operation.
-  connection_.socket().async_connect(endpoint,
-    boost::bind(&FragmentWorker::handle_connect, this,
-      boost::asio::placeholders::error));
-}
-
-/// Handle completion of a connect operation.
-void FragmentWorker::handle_connect(const boost::system::error_code& e)
-{
-    Info info(__FUNCTION__);
-  if (!e)
-  {
-    // Successfully established connection. Start operation to read the list
-    // of stocks. The connection::async_read() function will automatically
-    // decode the data that is read from the underlying socket.
-    connection_.async_read(jobs_,
-      boost::bind(&FragmentWorker::handle_read, this,
-      boost::asio::placeholders::error));
-  }
-  else
-  {
-    // An error occurred. Log it and return. Since we are not starting a new
-    // operation the io_service will run out of work to do and the client will
-    // exit.
-    std::cerr << e.message() << std::endl;
-  }
-}
-
-/// Handle completion of a read operation.
-void FragmentWorker::handle_read(const boost::system::error_code& e)
-{
-    Info info(__FUNCTION__);
-  if (!e)
-  {
-    // Print out the data that was received.
-    for (std::size_t i = 0; i < jobs_.size(); ++i)
-    {
-        std::cout << "Job number " << i << "\n";
-        std::cout << "  output: " << jobs_[i].outputfile << "\n";
-        std::cout << "  id: " << jobs_[i].JobId << "\n";
-    }
-  }
-  else
-  {
-    // An error occurred.
-    std::cerr << e.message() << std::endl;
-  }
-
-  // Since we are not starting a new operation the io_service will run out of
-  // work to do and the client will exit.
-}
-
Index: src/Fragmentation/Automation/StockClient.hpp
===================================================================
--- src/Fragmentation/Automation/StockClient.hpp	(revision 8c9596e4625116d26a89a0b50b4ed923834abde4)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * FragmentWorker.hpp
- *
- *  Created on: Nov 18, 2011
- *      Author: heber
- */
-
-#ifndef STOCKCLIENT_HPP_
-#define STOCKCLIENT_HPP_
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include <boost/asio.hpp>
-#include <vector>
-#include "Connection.hpp" // Must come before boost/serialization headers.
-#include "FragmentJob.hpp"
-
-/// Downloads stock quote information from a server.
-class FragmentWorker
-{
-public:
-  /// Constructor starts the asynchronous connect operation.
-  FragmentWorker(boost::asio::io_service& io_service,
-      const std::string& host, const std::string& service);
-
-  /// Handle completion of a connect operation.
-  void handle_connect(const boost::system::error_code& e);
-
-  /// Handle completion of a read operation.
-  void handle_read(const boost::system::error_code& e);
-
-private:
-  /// The connection to the server.
-  Connection connection_;
-
-  /// The data received from the server.
-  std::vector<FragmentJob> jobs_;
-};
-
-#endif /* STOCKCLIENT_HPP_ */
Index: src/Fragmentation/Automation/StockServer.cpp
===================================================================
--- src/Fragmentation/Automation/StockServer.cpp	(revision 8c9596e4625116d26a89a0b50b4ed923834abde4)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * FragmentScheduler.cpp
- *
- *  Created on: 18.11.2011
- *      Author: heber
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// boost asio needs specific operator new
-#include <boost/asio.hpp>
-
-#include "CodePatterns/MemDebug.hpp"
-
-#include <boost/bind.hpp>
-#include <boost/lexical_cast.hpp>
-#include <iostream>
-#include <vector>
-#include "Connection.hpp" // Must come before boost/serialization headers.
-#include <boost/serialization/vector.hpp>
-#include "CodePatterns/Info.hpp"
-#include "FragmentJob.hpp"
-
-#include "StockServer.hpp"
-
-FragmentScheduler::FragmentScheduler(boost::asio::io_service& io_service, unsigned short port) :
-  acceptor_(io_service,
-      boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port)
-  )
-{
-    Info info(__FUNCTION__);
-  FragmentJob s(std::string("test"), 1);
-  jobs_.push_back(s);
-
-  // Start an accept operation for a new connection.
-  connection_ptr new_conn(new Connection(acceptor_.get_io_service()));
-  acceptor_.async_accept(new_conn->socket(),
-    boost::bind(&FragmentScheduler::handle_accept, this,
-      boost::asio::placeholders::error, new_conn));
-}
-
-void FragmentScheduler::handle_accept(const boost::system::error_code& e, connection_ptr conn)
-{
-    Info info(__FUNCTION__);
-  std::cout << "handle_accept called." << std::endl;
-  if (!e)
-  {
-    // Successfully accepted a new connection. Send the list of stocks to the
-    // client. The connection::async_write() function will automatically
-    // serialize the data structure for us.
-    conn->async_write(jobs_,
-      boost::bind(&FragmentScheduler::handle_write, this,
-      boost::asio::placeholders::error, conn));
-  }
-
-  connection_ptr new_conn(new Connection(acceptor_.get_io_service()));
-  acceptor_.async_accept(new_conn->socket(),
-    boost::bind(&FragmentScheduler::handle_accept, this,
-      boost::asio::placeholders::error, new_conn));
-}
-
-void FragmentScheduler::handle_write(const boost::system::error_code& e, connection_ptr conn)
-{
-    Info info(__FUNCTION__);
-  // Nothing to do. The socket will be closed automatically when the last
-  // reference to the connection object goes away.
-}
Index: src/Fragmentation/Automation/StockServer.hpp
===================================================================
--- src/Fragmentation/Automation/StockServer.hpp	(revision 8c9596e4625116d26a89a0b50b4ed923834abde4)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * FragmentScheduler.hpp
- *
- *  Created on: 18.11.2011
- *      Author: heber
- */
-
-#ifndef STOCKSERVER_HPP_
-#define STOCKSERVER_HPP_
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include <boost/asio.hpp>
-#include <vector>
-#include "Connection.hpp" // Must come before boost/serialization headers.
-#include "FragmentJob.hpp"
-
-/// Serves stock quote information to any client that connects to it.
-class FragmentScheduler
-{
-public:
-  /// Constructor opens the acceptor and starts waiting for the first incoming
-  /// connection.
-  FragmentScheduler(boost::asio::io_service& io_service, unsigned short port);
-
-  /// Handle completion of a accept operation.
-  void handle_accept(const boost::system::error_code& e, connection_ptr conn);
-
-  /// Handle completion of a write operation.
-  void handle_write(const boost::system::error_code& e, connection_ptr conn);
-
-private:
-  /// The acceptor object used to accept incoming socket connections.
-  boost::asio::ip::tcp::acceptor acceptor_;
-
-  /// The data to be sent to each client.
-  std::vector<FragmentJob> jobs_;
-};
-
-#endif /* STOCKSERVER_HPP_ */
Index: src/Fragmentation/Automation/client.cpp
===================================================================
--- src/Fragmentation/Automation/client.cpp	(revision 8c9596e4625116d26a89a0b50b4ed923834abde4)
+++ src/Fragmentation/Automation/client.cpp	(revision cd4a6e84fc65152a21053ba13c6d87bca6e724ae)
@@ -11,5 +11,5 @@
 #include <boost/asio.hpp>
 #include <iostream>
-#include "StockClient.hpp"
+#include "FragmentWorker.hpp"
 
 
Index: src/Fragmentation/Automation/server.cpp
===================================================================
--- src/Fragmentation/Automation/server.cpp	(revision 8c9596e4625116d26a89a0b50b4ed923834abde4)
+++ src/Fragmentation/Automation/server.cpp	(revision cd4a6e84fc65152a21053ba13c6d87bca6e724ae)
@@ -12,5 +12,5 @@
 #include <boost/lexical_cast.hpp>
 #include <iostream>
-#include "StockServer.hpp"
+#include "FragmentScheduler.hpp"
 
 
