Index: src/Fragmentation/Automation/Controller/CommandRegistry.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/CommandRegistry.cpp	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
+++ src/Fragmentation/Automation/Controller/CommandRegistry.cpp	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
@@ -0,0 +1,36 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010-2012 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * CommandRegistry.cpp
+ *
+ *  Created on: Dec 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 "Controller/CommandRegistry.hpp"
+
+#include "CodePatterns/Registry_impl.hpp"
+
+
+CommandRegistry::CommandRegistry()
+{}
+
+CommandRegistry::~CommandRegistry()
+{}
+
+CONSTRUCT_REGISTRY(Operation)
Index: src/Fragmentation/Automation/Controller/CommandRegistry.hpp
===================================================================
--- src/Fragmentation/Automation/Controller/CommandRegistry.hpp	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
+++ src/Fragmentation/Automation/Controller/CommandRegistry.hpp	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
@@ -0,0 +1,27 @@
+/*
+ * CommandRegistry.hpp
+ *
+ *  Created on: Dec 11, 2011
+ *      Author: heber
+ */
+
+#ifndef COMMANDREGISTRY_HPP_
+#define COMMANDREGISTRY_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Controller/Commands/Operation.hpp"
+#include "CodePatterns/Registry.hpp"
+
+class CommandRegistry : public Registry<Operation>
+{
+public:
+  CommandRegistry();
+  ~CommandRegistry();
+
+};
+
+#endif /* COMMANDREGISTRY_HPP_ */
Index: src/Fragmentation/Automation/Controller/FragmentController.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/FragmentController.cpp	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ src/Fragmentation/Automation/Controller/FragmentController.cpp	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
@@ -29,4 +29,8 @@
 #include "Controller/FragmentController.hpp"
 #include "Controller/Commands/Operation.hpp"
+#include "Controller/Commands/CheckResultsOperation.hpp"
+#include "Controller/Commands/ReceiveJobsOperation.hpp"
+#include "Controller/Commands/SendResultsOperation.hpp"
+#include "Controller/Commands/ShutdownOperation.hpp"
 
 /** Constructor of class FragmentController.
@@ -38,11 +42,13 @@
 FragmentController::FragmentController(
     boost::asio::io_service& io_service) :
-    connection_(io_service),
-    recjobs(connection_),
-    checkres(connection_),
-    sendres(connection_),
-    shutdown(connection_)
+    connection_(io_service)
 {
   Info info(__FUNCTION__);
+
+  // insert commands into registry
+  Commands.registerInstance(new CheckResultsOperation(connection_));
+  Commands.registerInstance(new ReceiveJobsOperation(connection_));
+  Commands.registerInstance(new SendResultsOperation(connection_));
+  Commands.registerInstance(new ShutdownOperation(connection_));
 }
 
@@ -51,4 +57,21 @@
  */
 FragmentController::~FragmentController()
-{}
+{
+  Commands.cleanup();
+}
 
+/** Getter for Exitflag of all any Operation.
+ *
+ * We simply go through all of them and check which failed.
+ *
+ * @return Combined Exitflag of all Operations in \a Commands.
+ */
+size_t FragmentController::getExitflag() const
+{
+  for (CommandRegistry::const_iterator iter = Commands.getBeginIter();
+      iter != Commands.getEndIter(); ++iter)
+    if ((iter->second)->getExitflag() != 0)
+      return (iter->second)->getExitflag();
+  return 0;
+}
+
Index: src/Fragmentation/Automation/Controller/FragmentController.hpp
===================================================================
--- src/Fragmentation/Automation/Controller/FragmentController.hpp	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ src/Fragmentation/Automation/Controller/FragmentController.hpp	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
@@ -22,9 +22,5 @@
 #include "FragmentResult.hpp"
 
-#include "Controller/Commands/Operation.hpp"
-#include "Controller/Commands/CheckResultsOperation.hpp"
-#include "Controller/Commands/ReceiveJobsOperation.hpp"
-#include "Controller/Commands/SendResultsOperation.hpp"
-#include "Controller/Commands/ShutdownOperation.hpp"
+#include "Controller/CommandRegistry.hpp"
 
 /** The FragmentController sends bunches of jobs to a FragmentScheduler,
@@ -43,4 +39,7 @@
   ~FragmentController();
 
+  /// getter for operations exit flag.
+  size_t getExitflag() const;
+
 protected:
   /// The Connection to the server.
@@ -48,24 +47,6 @@
 
 public:
-
-  ReceiveJobsOperation recjobs;
-  CheckResultsOperation checkres;
-  SendResultsOperation  sendres;
-  ShutdownOperation shutdown;
-
-  // get the exit flag of the last operations
-  size_t getExitflag() const
-  {
-    if (recjobs.getExitflag() != 0)
-      return recjobs.getExitflag();
-    if (checkres.getExitflag() != 0)
-      return checkres.getExitflag();
-    if (sendres.getExitflag() != 0)
-      return sendres.getExitflag();
-    if (shutdown.getExitflag() != 0)
-      return shutdown.getExitflag();
-    return 0;
-  }
-
+  /// Registry with all commands of this controller
+  CommandRegistry Commands;
 };
 
Index: src/Fragmentation/Automation/Controller/JobAdder.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/JobAdder.cpp	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * 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 JobAdder.cpp
- *
- * This file strongly follows the Serialization example from the boost::asio
- * library (see client.cpp)
- *
- *  Created on: Nov 27, 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 <iostream>
-#include <vector>
-#include <boost/lexical_cast.hpp>
-
-#include "atexit.hpp"
-#include "CodePatterns/Info.hpp"
-#include "CodePatterns/Log.hpp"
-#include "Controller/FragmentController.hpp"
-#include "FragmentJob.hpp"
-#include "FragmentResult.hpp"
-
-
-int main(int argc, char* argv[])
-{
-  // from this moment on, we need to be sure to deeinitialize in the correct order
-  // this is handled by the cleanup function
-  atexit(cleanUp);
-
-  setVerbosity(3);
-
-  size_t Exitflag = 0;
-  try
-  {
-    // Check command line arguments.
-    if (argc != 4)
-    {
-      std::cerr << "Usage: " << argv[0] << " <host> <port> <number of jobs>" << std::endl;
-      return 1;
-    }
-    const int NoJobs = boost::lexical_cast<int>(argv[3]);
-    boost::asio::io_service io_service;
-    FragmentController controller(io_service);
-
-    LOG(1, "INFO: Creating " << NoJobs << " jobs for the server.");
-    std::vector<FragmentJob> jobs;
-    for (JobId_t i = 1; i <= NoJobs; ++i) {
-      FragmentJob testJob(std::string("do something"), i);
-      jobs.push_back(testJob);
-    }
-    controller.recjobs.addJobs(jobs);
-    controller.recjobs(argv[1], argv[2]);
-    {
-      Info info("io_service");
-      io_service.run();
-    }
-    Exitflag = controller.getExitflag();
-  }
-  catch (std::exception& e)
-  {
-    std::cerr << e.what() << std::endl;
-  }
-
-  return Exitflag;
-}
Index: src/Fragmentation/Automation/Controller/ResultChecker.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/ResultChecker.cpp	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * 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 ResultChecker.cpp
- *
- * This file strongly follows the Serialization example from the boost::asio
- * library (see client.cpp)
- *
- *  Created on: Nov 27, 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 <iostream>
-#include <vector>
-
-#include "atexit.hpp"
-#include "CodePatterns/Info.hpp"
-#include "CodePatterns/Log.hpp"
-#include "Controller/FragmentController.hpp"
-#include "FragmentJob.hpp"
-#include "FragmentResult.hpp"
-
-
-int main(int argc, char* argv[])
-{
-  // from this moment on, we need to be sure to deeinitialize in the correct order
-  // this is handled by the cleanup function
-  atexit(cleanUp);
-
-  setVerbosity(3);
-
-  size_t Exitflag = 0;
-  try
-  {
-    // Check command line arguments.
-    if (argc != 3)
-    {
-      std::cerr << "Usage: " << argv[0] << " <host> <port>" << std::endl;
-      return 1;
-    }
-
-    boost::asio::io_service io_service;
-    FragmentController controller(io_service);
-
-    controller.checkres(argv[1], argv[2]);
-    {
-      Info info("io_service");
-      io_service.run();
-    }
-    size_t doneJobs = controller.checkres.getDoneJobs();
-    LOG(1, "INFO: " << doneJobs << " jobs are calculated so far.");
-    Exitflag = controller.getExitflag();
-  }
-  catch (std::exception& e)
-  {
-    std::cerr << e.what() << std::endl;
-  }
-
-  return Exitflag;
-}
Index: src/Fragmentation/Automation/Controller/ResultGetter.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/ResultGetter.cpp	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * 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 ResultGetter.cpp
- *
- * This file strongly follows the Serialization example from the boost::asio
- * library (see client.cpp)
- *
- *  Created on: Nov 27, 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 <iostream>
-#include <vector>
-
-#include "atexit.hpp"
-#include "CodePatterns/Info.hpp"
-#include "CodePatterns/Log.hpp"
-#include "Controller/FragmentController.hpp"
-#include "FragmentJob.hpp"
-#include "FragmentResult.hpp"
-
-
-int main(int argc, char* argv[])
-{
-  // from this moment on, we need to be sure to deeinitialize in the correct order
-  // this is handled by the cleanup function
-  atexit(cleanUp);
-
-  setVerbosity(3);
-
-  size_t Exitflag = 0;
-  try
-  {
-    // Check command line arguments.
-    if (argc != 3)
-    {
-      std::cerr << "Usage: " << argv[0] << " <host> <port>" << std::endl;
-      return 1;
-    }
-
-    boost::asio::io_service io_service;
-    FragmentController controller(io_service);
-
-    std::vector<FragmentJob> jobs;
-    {
-      FragmentJob testJob(std::string("do something"), 1);
-      FragmentJob othertestJob(std::string("do something else"), 2);
-      jobs.push_back(testJob);
-      jobs.push_back(othertestJob);
-    }
-
-    controller.sendres(argv[1], argv[2]);
-    {
-      Info info("io_service");
-      io_service.run();
-    }
-    std::vector<FragmentResult> results = controller.sendres.getResults();
-    for (std::vector<FragmentResult>::const_iterator iter = results.begin();
-        iter != results.end(); ++iter)
-      LOG(1, "RESULT: job #"+toString((*iter).getId())+": "+toString((*iter).result));
-    Exitflag = controller.getExitflag();
-  }
-  catch (std::exception& e)
-  {
-    std::cerr << e.what() << std::endl;
-  }
-
-  return Exitflag;
-}
Index: src/Fragmentation/Automation/Controller/Shutdowner.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/Shutdowner.cpp	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * 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 Shutdowner.cpp
- *
- * This file strongly follows the Serialization example from the boost::asio
- * library (see client.cpp)
- *
- *  Created on: Dez 09, 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 <iostream>
-#include <vector>
-
-#include "atexit.hpp"
-#include "CodePatterns/Info.hpp"
-#include "CodePatterns/Log.hpp"
-#include "Controller/FragmentController.hpp"
-#include "FragmentJob.hpp"
-#include "FragmentResult.hpp"
-
-
-int main(int argc, char* argv[])
-{
-  // from this moment on, we need to be sure to deeinitialize in the correct order
-  // this is handled by the cleanup function
-  atexit(cleanUp);
-
-  setVerbosity(3);
-
-  size_t Exitflag = 0;
-  try
-  {
-    // Check command line arguments.
-    if (argc != 3)
-    {
-      std::cerr << "Usage: " << argv[0] << " <host> <port>" << std::endl;
-      return 1;
-    }
-
-    boost::asio::io_service io_service;
-    FragmentController controller(io_service);
-
-    controller.shutdown(argv[1], argv[2]);
-    {
-      Info info("io_service");
-      io_service.run();
-    }
-    Exitflag = controller.getExitflag();
-  }
-  catch (std::exception& e)
-  {
-    std::cerr << e.what() << std::endl;
-  }
-
-  return Exitflag;
-}
