Index: src/Fragmentation/Automation/controller.cpp
===================================================================
--- src/Fragmentation/Automation/controller.cpp	(revision d920b9e35d1332c01a14e561aa60b85bbe881b3b)
+++ src/Fragmentation/Automation/controller.cpp	(revision ff60cfa6d1a9d5d02c5383a60a027b1843d6e0b6)
@@ -27,7 +27,10 @@
 #include "CodePatterns/MemDebug.hpp"
 
+#include <fstream>
 #include <iostream>
+#include <map>
+#include <sstream>
+#include <streambuf>
 #include <vector>
-#include <map>
 
 #include "atexit.hpp"
@@ -39,4 +42,6 @@
 #include "Controller/Commands/SendResultsOperation.hpp"
 #include "Controller/Commands/ShutdownOperation.hpp"
+#include "GlobalJobId.hpp"
+#include "Jobs/MPQCCommandJob.hpp"
 #include "Jobs/SystemCommandJob.hpp"
 #include "Results/FragmentResult.hpp"
@@ -44,16 +49,33 @@
 enum CommandIndices {
   UnknownCommandIndex = 0,
-  SendJobsIndex = 1,
-  CheckResultsIndex = 2,
-  ReceiveResultsIndex = 3,
-  ShutdownIndex = 4
+  AddJobsIndex = 1,
+  CreateJobsIndex = 2,
+  CheckResultsIndex = 3,
+  ReceiveResultsIndex = 4,
+  ShutdownIndex = 5
 };
 
+// TODO: replace this instance by a IdPool owned by controller.
+GlobalJobId globalId;
+
 void createjobs(std::vector<FragmentJob::ptr> &jobs)
 {
-  FragmentJob::ptr testJob( new SystemCommandJob( std::string("cat"), std::string("Nothing"), 1) );
-  FragmentJob::ptr othertestJob( new SystemCommandJob( std::string("cat"), std::string("Nothing"), 2) );
+  FragmentJob::ptr testJob( new SystemCommandJob( std::string("cat"), std::string("Nothing"), globalId.getNextId()) );
+  FragmentJob::ptr othertestJob( new SystemCommandJob( std::string("cat"), std::string("Nothing"), globalId.getNextId()) );
   jobs.push_back(testJob);
   jobs.push_back(othertestJob);
+}
+
+void parsejob(std::vector<FragmentJob::ptr> &jobs, const std::string &filename)
+{
+  std::ifstream file;
+  file.open(filename.c_str());
+  ASSERT( file.good(), "parsejob() - file "+filename+" does not exist.");
+  std::string output((std::istreambuf_iterator<char>(file)),
+      std::istreambuf_iterator<char>());
+  FragmentJob::ptr testJob( new MPQCCommandJob(output, globalId.getNextId()) );
+  jobs.push_back(testJob);
+  file.close();
+  LOG(1, "INFO: Added MPQCCommandJob from file "+filename+".");
 }
 
@@ -136,6 +158,8 @@
 
   size_t Exitflag = 0;
-  std::map<std::string, CommandIndices> CommandsMap;
-  CommandsMap.insert( std::make_pair("sendjobs", SendJobsIndex) );
+  typedef std::map<std::string, CommandIndices> CommandsMap_t;
+  CommandsMap_t CommandsMap;
+  CommandsMap.insert( std::make_pair("addjobs", AddJobsIndex) );
+  CommandsMap.insert( std::make_pair("createjobs", CreateJobsIndex) );
   CommandsMap.insert( std::make_pair("checkresults", CheckResultsIndex) );
   CommandsMap.insert( std::make_pair("receiveresults", ReceiveResultsIndex) );
@@ -144,7 +168,12 @@
   {
     // Check command line arguments.
-    if (argc != 4)
+    if (argc < 4)
     {
-      std::cerr << "Usage: " << argv[0] << " <host> <port> <command>" << std::endl;
+      std::cerr << "Usage: " << argv[0] << " <host> <port> <command> [options to command]" << std::endl;
+      std::cerr << "List of available commands:" << std::endl;
+      for(CommandsMap_t::const_iterator iter = CommandsMap.begin();
+          iter != CommandsMap.end(); ++iter) {
+        std::cerr << "\t" << iter->first << std::endl;
+      }
       return 1;
     }
@@ -154,5 +183,20 @@
 
     switch(getCommandIndex(CommandsMap, argv[3])) {
-      case SendJobsIndex:
+      case AddJobsIndex:
+      {
+        std::vector<FragmentJob::ptr> jobs;
+        if (argc == 4) {
+          ELOG(1, "Please add a filename for the MPQCCommandJob.");
+        } else {
+          for (int argcount = 4; argcount < argc; ++argcount) {
+            LOG(1, "INFO: Parsing job for file " << argv[argcount] << ".");
+            parsejob(jobs, argv[argcount]);
+          }
+          addjobs(controller, jobs);
+          sendjobs(controller, argv[1], argv[2]);
+        }
+        break;
+      }
+      case CreateJobsIndex:
       {
         std::vector<FragmentJob::ptr> jobs;
@@ -189,5 +233,6 @@
 
     switch(getCommandIndex(CommandsMap, argv[3])) {
-      case SendJobsIndex:
+      case AddJobsIndex:
+      case CreateJobsIndex:
         break;
       case CheckResultsIndex:
