Index: src/Jobs/JobMarket/FragmentJob.cpp
===================================================================
--- src/Jobs/JobMarket/FragmentJob.cpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
+++ src/Jobs/JobMarket/FragmentJob.cpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
@@ -0,0 +1,77 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2014 Frederik Heber. All rights reserved.
+ * 
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * FragmentJob.cpp
+ *
+ * Originally taken from my JobMarket project at 1.1.4.
+ *
+ *  Created on: Oct 19, 2011
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#ifdef HAVE_JOBMARKET
+#include "JobMarket/Jobs/FragmentJob.hpp"
+#include "JobMarket/Results/FragmentResult.hpp"
+#else
+#include "Jobs/JobMarket/FragmentJob.hpp"
+#include "Jobs/JobMarket/FragmentResult.hpp"
+#endif
+
+/** Constructor for class FragmentJob.
+ *
+ */
+FragmentJob::FragmentJob() :
+  JobId(JobId::IllegalJob),
+  priority(0)
+{}
+
+/** Constructor for class FragmentJob.
+ *
+ * \param _JobId unique id of this job
+ */
+FragmentJob::FragmentJob(const JobId_t _JobId) :
+  JobId(_JobId),
+  priority(0)
+{}
+
+/** Destructor for class FragmentJob.
+ *
+ */
+FragmentJob::~FragmentJob()
+{}
+
+/** Comparator for class FragmentJob.
+ * \param other instance to compare to
+ * \return every member variable is the same, else - is not
+ */
+bool FragmentJob::operator==(const FragmentJob &other) const
+{
+  return (getId() == other.getId());
+}
Index: src/Jobs/JobMarket/FragmentJob.hpp
===================================================================
--- src/Jobs/JobMarket/FragmentJob.hpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
+++ src/Jobs/JobMarket/FragmentJob.hpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
@@ -0,0 +1,129 @@
+/*
+ * FragmentJob.hpp
+ *
+ * Originally taken from my JobMarket project at 1.1.4.
+ *
+ *  Created on: Oct 19, 2011
+ *      Author: heber
+ */
+
+#ifndef FRAGMENTJOB_HPP_
+#define FRAGMENTJOB_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string>
+
+#include "boost/shared_ptr.hpp"
+#include "boost/serialization/access.hpp"
+#include "boost/serialization/shared_ptr.hpp"
+
+#ifdef HAVE_JOBMARKET
+#include "JobMarket/Results/FragmentResult.hpp"
+#include "JobMarket/JobId.hpp"
+#include "JobMarket/types.hpp"
+#else
+#include "Jobs//JobMarket/FragmentResult.hpp"
+#include "Jobs//JobMarket/JobId.hpp"
+#include "Jobs//JobMarket/types.hpp"
+#endif
+
+class FragmentController;
+class FragmentJobTest;
+class FragmentQueueTest;
+class FragmentWorker;
+
+/** FragmentJob contains all information for the Worker to start the job and
+ * deliver a FragmentResult.
+ *
+ * Important is that this class is fully serializable such that it can be
+ * transfered to a scheduler (server) and be deserialized by the Worker.
+ */
+class FragmentJob : public JobId
+{
+  //!> allow FragmentQueue unit test access
+  friend class FragmentQueueTest;
+  //!> allow own unit test access
+  friend class FragmentJobTest;
+  //!> allow FragmentController access to setJobId()
+  friend class FragmentController;
+
+public:
+  //!> typedef for priorities of a job
+  typedef size_t priority_t;
+
+private:
+  //!> Internal priority of the job
+  priority_t priority;
+
+public:
+  typedef boost::shared_ptr<FragmentJob> ptr;
+
+  FragmentJob(const JobId_t _JobId);
+  virtual ~FragmentJob();
+
+  virtual FragmentResult::ptr Work() = 0;
+
+  bool operator==(const FragmentJob &other) const;
+
+  bool operator!=(const FragmentJob &other) const {
+    return !(*this == other);
+  }
+
+  /** Less-than-operator required for priority queue.
+   *
+   * \param other other instance to compare to
+   * \return true - this instance is less than other (in priority)
+   */
+  bool operator<(const FragmentJob &other) const {
+    return priority < other.priority;
+  }
+
+  /** Setter for the job's priority.
+   *
+   * \param _priority priority to set
+   */
+  void setPriority(const priority_t _priority) {
+    priority = _priority;
+  }
+
+protected:
+  /** Passing JobId::setId() on to grant FragmentController' access.
+   *
+   * \param _id new id to set
+   */
+  void setId(const JobId_t _id) { JobId::setId(_id); }
+
+private:
+  /** private default cstor for serialization only
+   *
+   * Use normal cstor with JobId::IllegalJob if you want to instantiate
+   * a job without id.
+   */
+  FragmentJob();
+
+  friend class boost::serialization::access;
+  // serialization
+  template <typename Archive>
+  void serialize(Archive& ar, const unsigned int version)
+  {
+    ar & boost::serialization::base_object<JobId>(*this);
+    ar & priority;
+  }
+};
+
+/** Helper function for allow less on ptr's of FragmentJob.
+ *
+ * \param a first instance
+ * \param b second instance
+ * \return \see FragmentJob::operator<()
+ */
+inline
+bool operator<(const FragmentJob::ptr &a, const FragmentJob::ptr &b)
+{ return (*a) < (*b); }
+
+
+#endif /* FRAGMENTJOB_HPP_ */
Index: src/Jobs/JobMarket/FragmentResult.cpp
===================================================================
--- src/Jobs/JobMarket/FragmentResult.cpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
+++ src/Jobs/JobMarket/FragmentResult.cpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
@@ -0,0 +1,119 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2014 Frederik Heber. All rights reserved.
+ * 
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * FragmentResult.cpp
+ *
+ * Originally taken from my JobMarket project at 1.1.4.
+ *
+ *  Created on: Oct 19, 2011
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#ifdef HAVE_JOBMARKET
+#include "JobMarket/Results/FragmentResult.hpp"
+#else
+#include "Jobs/JobMarket/FragmentResult.hpp"
+#endif
+
+/** Private default Constructor of class FragmentResult.
+ *
+ * This cstor is for serialization of this class inside a vector
+ * only. Without it, we would not need it.
+ */
+FragmentResult::FragmentResult() :
+  JobId(JobId::NoJob),
+  result(std::string("NoJob")),
+  exitflag(0),
+  time_Work(0.)
+{}
+
+/** Constructor of class FragmentResult.
+ *
+ * \param _id id of FragmntJob associated to this FragmentResult.
+ */
+FragmentResult::FragmentResult(const JobId_t _id) :
+  JobId(_id),
+  result(std::string("Nothing")),
+  exitflag(0),
+  time_Work(0.)
+{}
+
+/** Constructor of class FragmentResult.
+ */
+FragmentResult::FragmentResult(const JobId_t _id, const std::string &_result) :
+  JobId(_id),
+  result(_result),
+  exitflag(0),
+  time_Work(0.)
+{}
+
+/** Copy constructor of class FragmentResult.
+ *
+ */
+FragmentResult::FragmentResult(const FragmentResult &other) :
+  JobId(other.getId()),
+  result(other.result),
+  exitflag(other.exitflag),
+  time_Work(other.time_Work)
+{}
+
+/** Destructor of class FragmentResult.
+ *
+ */
+FragmentResult::~FragmentResult()
+{}
+
+/** Equality operator: Equal if both JobIds are the same
+ *
+ * \param other instance to check against
+ * \return true - both JobIds are the same, false - JobIds are not the same.
+ */
+bool FragmentResult::operator==(const FragmentResult &other) const
+{
+  return getId() == other.getId();
+}
+
+/** Assigment operator.
+ *
+ * \note We can't use default assigment because of const member FragmentResult::JobId.
+ *
+ * \param other instance to make equal to
+ */
+FragmentResult& FragmentResult::operator=(const FragmentResult &other)
+{
+  /// check self-assignment
+  if (this != &other) {
+    setId(other.getId());
+    result = other.result;
+    exitflag = other.exitflag;
+    time_Work = other.time_Work;
+  }
+  return *this;
+}
Index: src/Jobs/JobMarket/FragmentResult.hpp
===================================================================
--- src/Jobs/JobMarket/FragmentResult.hpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
+++ src/Jobs/JobMarket/FragmentResult.hpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
@@ -0,0 +1,85 @@
+/*
+ * FragmentResult.hpp
+ *
+ * Originally taken from my JobMarket project at 1.1.4.
+ *
+ *  Created on: Oct 19, 2011
+ *      Author: heber
+ */
+
+#ifndef FRAGMENTRESULT_HPP_
+#define FRAGMENTRESULT_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include <string>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/serialization/array.hpp>
+#include <boost/serialization/shared_ptr.hpp>
+
+#ifdef HAVE_JOBMARKET
+#include "JobMarket/JobId.hpp"
+#include "JobMarket/types.hpp"
+#else
+#include "Jobs/JobMarket/JobId.hpp"
+#include "Jobs/JobMarket/types.hpp"
+#endif
+
+class FragmentQueueTest;
+class FragmentResultTest;
+
+/** This class contains the result to a specific FragmentJob.
+ *
+ */
+class FragmentResult : public JobId
+{
+  //!> allow FragmentQueue unit test access
+  friend class FragmentQueueTest;
+  //!> allow own unit test access
+  friend class FragmentResultTest;
+public:
+  typedef boost::shared_ptr<FragmentResult> ptr;
+
+  FragmentResult(const JobId_t id);
+  FragmentResult(const JobId_t id, const std::string &_result);
+  FragmentResult(const FragmentResult &other);
+  ~FragmentResult();
+
+  FragmentResult& operator=(const FragmentResult &other);
+  bool operator==(const FragmentResult &other) const;
+  bool operator!=(const FragmentResult &other) const
+    { return !(*this == other); }
+
+  //!> result
+  std::string result;
+
+  //!> exit flag
+  int exitflag;
+
+  //!> time needed for Work()
+  double time_Work;
+
+private:
+  friend class boost::serialization::access;
+
+  /// private default constructor for serialization only.
+  FragmentResult();
+
+  // serialization
+  template <typename Archive>
+  void serialize(Archive& ar, const unsigned int version)
+  {
+    ar & boost::serialization::base_object<JobId>(*this);
+    ar & result;
+    ar & exitflag;
+    ar & time_Work;
+  }
+};
+
+
+#endif /* FRAGMENTRESULT_HPP_ */
Index: src/Jobs/JobMarket/JobId.cpp
===================================================================
--- src/Jobs/JobMarket/JobId.cpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
+++ src/Jobs/JobMarket/JobId.cpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
@@ -0,0 +1,78 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2014 Frederik Heber. All rights reserved.
+ * 
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * JobId.cpp
+ *
+ * Originally taken from my JobMarket project at 1.1.4.
+ *
+ *  Created on: Oct 23, 2011
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#ifdef HAVE_JOBMARKET
+#include "JobMarket/JobId.hpp"
+#else
+#include "Jobs/JobMarket/JobId.hpp"
+#endif
+
+/** Constructor for class JobId.
+ *
+ */
+JobId::JobId()
+{}
+
+/** Constructor for class JobId.
+ * \param id JobId to set
+ */
+JobId::JobId(const JobId_t id) :
+  id(id)
+{}
+
+/** Destructor for class JobId.
+ *
+ */
+JobId::~JobId()
+{}
+
+/** Getter for id.
+ * \return id
+ */
+const JobId_t JobId::getId() const
+{
+  return id;
+}
+
+/** Protected seetter for id.
+ * \param _id new id
+ */
+void JobId::setId(const JobId_t _id)
+{
+  id = _id;
+}
Index: src/Jobs/JobMarket/JobId.hpp
===================================================================
--- src/Jobs/JobMarket/JobId.hpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
+++ src/Jobs/JobMarket/JobId.hpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
@@ -0,0 +1,61 @@
+/*
+ * JobId.hpp
+ *
+ * Originally taken from my JobMarket project at 1.1.4.
+ *
+ *  Created on: Oct 23, 2011
+ *      Author: heber
+ */
+
+#ifndef JOBID_HPP_
+#define JOBID_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "boost/serialization/access.hpp"
+
+#ifdef HAVE_JOBMARKET
+#include "JobMarket/types.hpp"
+#else
+#include "Jobs/JobMarket/types.hpp"
+#endif
+
+
+/** Class simply contains an Id along with getter and setter,
+ *
+ */
+class JobId
+{
+public:
+  JobId();
+  JobId(const JobId_t id);
+  ~JobId();
+
+  enum {
+    NoJob = 0,
+    IllegalJob = -1
+  };
+
+  const JobId_t getId() const;
+
+protected:
+  void setId(const JobId_t id);
+
+private:
+  friend class boost::serialization::access;
+  // serialization
+  template <typename Archive>
+  void serialize(Archive& ar, const unsigned int version)
+  {
+    ar & id;
+  }
+
+private:
+  //!> unique id of this job (used for the temporary filename) and associating result
+  JobId_t id;
+};
+
+#endif /* JOBID_HPP_ */
Index: src/Jobs/JobMarket/SystemCommandJob.cpp
===================================================================
--- src/Jobs/JobMarket/SystemCommandJob.cpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
+++ src/Jobs/JobMarket/SystemCommandJob.cpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
@@ -0,0 +1,212 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2014 Frederik Heber. All rights reserved.
+ * 
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * SystemCommandJob.cpp
+ *
+ * Originally taken from my JobMarket project at 1.1.4.
+ *
+ *  Created on: Feb 5, 2012
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <boost/iostreams/device/file_descriptor.hpp>
+#include <boost/iostreams/stream.hpp>
+
+#include "CodePatterns/MemDebug.hpp"
+
+// include headers that implement a archive in simple text format
+// otherwise BOOST_CLASS_EXPORT_IMPLEMENT has no effect
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+
+#ifdef HAVE_JOBMARKET
+#include "JobMarket/Jobs/SystemCommandJob.hpp"
+#else
+#include "Jobs/JobMarket/SystemCommandJob.hpp"
+#endif
+
+#include <cstdio>
+#include <cstdlib>
+#include <fcntl.h>
+#include <fstream>
+#include <iostream>
+#include <string>
+#include <streambuf>
+#include <boost/filesystem.hpp>
+
+#include "CodePatterns/Chronos.hpp"
+#include "CodePatterns/Info.hpp"
+#include "CodePatterns/Log.hpp"
+#include "CodePatterns/toString.hpp"
+
+/** Constructor for class SystemCommandJob.
+ *
+ */
+SystemCommandJob::SystemCommandJob() :
+  FragmentJob(JobId::IllegalJob)
+{}
+
+/** Constructor for class SystemCommandJob.
+ *
+ * \param _command command to execute
+ * \param _outputfile configuration file for solver
+ * \param _JobId unique id of this job
+ */
+SystemCommandJob::SystemCommandJob(const std::string &_command, const std::string &_outputfile, const JobId_t _JobId) :
+  FragmentJob(_JobId),
+  command(_command),
+  outputfile(_outputfile)
+{}
+
+/** Destructor for class SystemCommandJob.
+ *
+ */
+SystemCommandJob::~SystemCommandJob()
+{}
+
+/** Work routine of this SystemCommandJob.
+ *
+ * This function encapsulates all the work that has to be done to generate
+ * a FragmentResult. Hence, the FragmentWorker does not need to know anything
+ * about the operation: it just receives it and executes this function.
+ *
+ * We obtain FragmentResult::exitflag from std::system's return value and
+ * FragmentResult::result from the contents of the piped output file.
+ *
+ * \return result of this job
+ */
+FragmentResult::ptr SystemCommandJob::Work()
+{
+//  Info info((std::string(__FUNCTION__)+std::string(", id #")+toString(getId())).c_str());
+
+  // the following is taken from http://stackoverflow.com/questions/2746168/how-to-construct-a-c-fstream-from-a-posix-file-descriptor
+  char tmpTemplate[24];
+  strncpy(tmpTemplate, "/tmp/XXXXXX_", 14);
+  const std::string idstring(toString(getId()));
+  const size_t idlength = idstring.length();
+  ASSERT(idlength <= 8,
+    "SystemCommandJob::Work() - the id contains more than 8 digits.");
+  strcat(tmpTemplate, toString(getId()).c_str());
+  const int fd = mkstemps(tmpTemplate, idlength+1);
+
+  // write outputfile to temporary file
+  LOG(2, "DEBUG: Temporary file is " << tmpTemplate << ".");
+  std::ofstream output(tmpTemplate);
+  ASSERT(output.is_open(),
+    "SystemCommandJob::Work() - the temporary file could not be opened.");
+  output << outputfile << std::endl;
+
+  // fork into subprocess and launch command
+  const std::string WorkName = std::string("Work #")+idstring;
+  Chronos::getInstance().startTiming(WorkName);
+  FragmentResult::ptr s;
+  {
+    // open process
+    std::string command_args = command+std::string(" ")+tmpTemplate;
+    LOG(1, "INFO: Executing '" << command_args << "'.");
+    FILE *stdoutstream = NULL;
+    while (stdoutstream == NULL) {
+      stdoutstream = popen(command_args.c_str(), "r");
+      if (stdoutstream == NULL) {
+        ELOG(2, "File descriptors are full, waiting for 1 sec...");
+        sleep(1);
+      }
+    }
+
+    int exitflag;
+    // read stdout from process
+    const int fd = fileno(stdoutstream);
+    fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
+    boost::iostreams::stream<boost::iostreams::file_descriptor_source> stdoutfile(fd, boost::iostreams::never_close_handle);
+    stdoutfile.set_auto_close(false); // https://svn.boost.org/trac/boost/ticket/3517
+    std::istreambuf_iterator<char> beginiter = (std::istreambuf_iterator<char>(stdoutfile));
+    std::string resultstring( beginiter, std::istreambuf_iterator<char>());
+
+    // construct result
+    LOG(2, "DEBUG: First 50 characters of output: " << resultstring.substr(0,50));
+    s = extractResult(resultstring);
+
+    // end process
+    if ((exitflag = pclose(stdoutstream)) == -1)
+      ELOG(0, "pclose error");
+
+    if (exitflag != 0)
+      ELOG(1, "Job " << getId() << " failed on executing: " << command_args);
+    s->exitflag = exitflag;
+  }
+  Chronos::getInstance().endTiming(WorkName);
+
+  // close temporary file and remove it
+  output.close();
+  boost::filesystem::path tmpPath(tmpTemplate);
+  if (boost::filesystem::exists(boost::filesystem::status(tmpPath))) {
+    LOG(2, "DEBUG: Removing " << tmpPath.string());
+    boost::filesystem::remove(tmpPath);
+  }
+  // close temporary file!
+  close(fd);
+
+  // obtain timing and place in FragmentResult
+  s->time_Work = Chronos::getInstance().getTime(WorkName);
+  LOG(1, "INFO: Work() required " << s->time_Work << " seconds to complete.");
+
+  // return result
+  return s;
+}
+
+/** Default function for result extraction is just copy.
+ *
+ * @param resultstring output of system command
+ * @return copy of \a resultstring
+ */
+FragmentResult::ptr SystemCommandJob::extractResult(const std::string &resultstring)
+{
+  return FragmentResult::ptr (new FragmentResult(getId(), resultstring) );
+}
+
+
+/** Comparator for class SystemCommandJob.
+ * \param other instance to compare to
+ * \return every member variable is the same, else - is not
+ */
+bool SystemCommandJob::operator==(const SystemCommandJob &other) const
+{
+  if (command != other.command) {
+    LOG(1, "INFO: command's of two SystemCommandJobs differ: " << command << " != " << other.command << ".");
+    return false;
+  }
+  if (outputfile != other.outputfile) {
+    LOG(1, "INFO: outputfile's of two SystemCommandJobs differ: " << outputfile << " != " << other.outputfile << ".");
+    return false;
+  }
+  return (dynamic_cast<const FragmentJob &>(*this) == dynamic_cast<const FragmentJob &>(other));
+}
+
+// we need to explicitly instantiate the serialization functions as
+// its is only serialized through its base class FragmentJob
+BOOST_CLASS_EXPORT_IMPLEMENT(SystemCommandJob)
Index: src/Jobs/JobMarket/SystemCommandJob.hpp
===================================================================
--- src/Jobs/JobMarket/SystemCommandJob.hpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
+++ src/Jobs/JobMarket/SystemCommandJob.hpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
@@ -0,0 +1,84 @@
+/*
+ * SystemCommandJob.hpp
+ *
+ * Originally taken from my JobMarket project at 1.1.4.
+ *
+ *  Created on: Feb 5, 2011
+ *      Author: heber
+ */
+
+#ifndef SYSTEMCOMMANDJOB_HPP_
+#define SYSTEMCOMMANDJOB_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <boost/serialization/export.hpp>
+
+#include <string>
+
+#ifdef HAVE_JOBMARKET
+#include "JobMarket/Jobs/FragmentJob.hpp"
+#else
+#include "Jobs/JobMarket/FragmentJob.hpp"
+#endif
+
+class SystemCommandJobTest;
+
+/** SystemCommandJob is an extension of FragmentJob that executes a system
+ * command operating onto a specific outputfile.
+ *
+ * Implement extractResult() to get the desired result from the captured
+ * output of the system command.
+ *
+ * Important is that this class is fully serializable such that it can be
+ * transfered to a scheduler (server) and be deserialized by the Worker.
+ */
+class SystemCommandJob : public FragmentJob
+{
+  //!> grant unit test access
+  friend class SystemCommandJobTest;
+public:
+  SystemCommandJob(const std::string &_command, const std::string &_outputfile, const JobId_t _JobId);
+  virtual ~SystemCommandJob();
+
+  FragmentResult::ptr Work();
+
+  bool operator==(const SystemCommandJob &other) const;
+
+  bool operator!=(const SystemCommandJob &other) const {
+    return !(*this == other);
+  }
+
+private:
+  virtual FragmentResult::ptr extractResult(const std::string &resultstring);
+
+  //!> string containing the command to launch the solver
+  std::string command;
+
+  //!> string containing the configuration file for the solver
+  std::string outputfile;
+
+protected:
+  //!> private default cstor for serialization only
+  SystemCommandJob();
+
+private:
+  friend class boost::serialization::access;
+  // serialization
+  template <typename Archive>
+  void serialize(Archive& ar, const unsigned int version)
+  {
+    ar & boost::serialization::base_object<FragmentJob>(*this);
+    ar & command;
+    ar & outputfile;
+  }
+};
+
+// we need to give this class a unique key for serialization
+// its is only serialized through its base class FragmentJob
+BOOST_CLASS_EXPORT_KEY(SystemCommandJob)
+
+#endif /* SYSTEMCOMMANDJOB_HPP_ */
Index: src/Jobs/JobMarket/types.hpp
===================================================================
--- src/Jobs/JobMarket/types.hpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
+++ src/Jobs/JobMarket/types.hpp	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
@@ -0,0 +1,21 @@
+/*
+ * types.hpp
+ *
+ * Originally taken from my JobMarket project at 1.1.4.
+ *
+ *  Created on: Oct 23, 2011
+ *      Author: heber
+ */
+
+#ifndef FRAGMENTATION_AUTOMATION_TYPES_HPP_
+#define FRAGMENTATION_AUTOMATION_TYPES_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+//!> type for ids of jobs
+typedef size_t JobId_t;
+
+#endif /* FRAGMENTATION_AUTOMATION_TYPES_HPP_ */
Index: src/Jobs/Makefile.am
===================================================================
--- src/Jobs/Makefile.am	(revision a498c1b15125817769fd9b27a366acd471b6b413)
+++ src/Jobs/Makefile.am	(revision c3de511c88d74c7dd3ee27b035ff60e0ecf0b720)
@@ -2,5 +2,14 @@
 # Also indentation by a single tab
 
-JOBSSOURCE = \
+JOBSSOURCE =
+if  CONDJOBMARKET
+else
+JOBSSOURCE += \
+	Jobs/JobMarket/FragmentJob.cpp \
+	Jobs/JobMarket/FragmentResult.cpp \
+	Jobs/JobMarket/JobId.cpp \
+	Jobs/JobMarket/SystemCommandJob.cpp
+endif
+JOBSSOURCE += \
 	Jobs/MPQCCommandJob.cpp \
 	Jobs/MPQCJob.cpp
@@ -14,5 +23,15 @@
 endif
 
-JOBSHEADER = \
+JOBSHEADER =
+if CONDJOBMARKET
+else
+JOBSHEADER += \
+	Jobs/JobMarket/FragmentJob.hpp \
+	Jobs/JobMarket/FragmentResult.hpp \
+	Jobs/JobMarket/JobId.hpp \
+	Jobs/JobMarket/SystemCommandJob.hpp \
+	Jobs/JobMarket/types.hpp
+endif
+JOBSHEADER += \
 	Jobs/MPQCCommandJob.hpp \
 	Jobs/MPQCCommandJob_binding.hpp \
