Index: trunk/sources/HeuristicLab.Hive.Client.Common/HeuristicLab.Hive.Client.Common.csproj
===================================================================
--- trunk/sources/HeuristicLab.Hive.Client.Common/HeuristicLab.Hive.Client.Common.csproj	(revision 778)
+++ trunk/sources/HeuristicLab.Hive.Client.Common/HeuristicLab.Hive.Client.Common.csproj	(revision 779)
@@ -66,4 +66,5 @@
   <ItemGroup>
     <Compile Include="CommonPlugin.cs" />
+    <Compile Include="Interfaces\IJob.cs" />
     <Compile Include="JobBase.cs" />
     <Compile Include="Logging.cs" />
Index: trunk/sources/HeuristicLab.Hive.Client.Common/Interfaces/IJob.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Client.Common/Interfaces/IJob.cs	(revision 779)
+++ trunk/sources/HeuristicLab.Hive.Client.Common/Interfaces/IJob.cs	(revision 779)
@@ -0,0 +1,13 @@
+﻿using System;
+namespace HeuristicLab.Hive.Client.Common {
+  public interface IJob {
+    System.Xml.XmlNode GetXmlNode();
+    event EventHandler JobStopped;
+    long JobId { get; set; }
+    int Progress { get; set; }
+    void Run();
+    bool Running { get; set; }
+    void Start();
+    void Stop();
+  }
+}
Index: trunk/sources/HeuristicLab.Hive.Client.Common/JobBase.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Client.Common/JobBase.cs	(revision 778)
+++ trunk/sources/HeuristicLab.Hive.Client.Common/JobBase.cs	(revision 779)
@@ -27,8 +27,11 @@
 using System.Xml;
 using HeuristicLab.Core;
+using HeuristicLab.Hive.Client.Common;
 
 namespace HeuristicLab.Hive.Client.Common {
   [Serializable]
-  abstract public class JobBase {
+  abstract public class JobBase : IJob {
+
+    public long JobId { get; set; }
 
     private Thread thread = null;
Index: trunk/sources/HeuristicLab.Hive.Client.Common/TestJob.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Client.Common/TestJob.cs	(revision 778)
+++ trunk/sources/HeuristicLab.Hive.Client.Common/TestJob.cs	(revision 779)
@@ -24,4 +24,5 @@
 using System.Linq;
 using System.Text;
+using System.Diagnostics;
 
 namespace HeuristicLab.Hive.Client.Common {
@@ -33,9 +34,9 @@
         if (abort == true) {
           Logging.getInstance().Info(this.ToString(), "Job Processing aborted");
-          //Console.WriteLine("Job Abort Processing");
+          Debug.WriteLine("Job Abort Processing");
           break;
         }
         Logging.getInstance().Info(this.ToString(), "Iteration " + x + " done");
-        //Console.WriteLine("Iteration " + x + " done");
+        Debug.WriteLine("Iteration " + x + " done");
       }      
       OnJobStopped();
Index: trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs	(revision 778)
+++ trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs	(revision 779)
@@ -58,9 +58,5 @@
     }
 
-    public void Start() {
-      Logging.getInstance().Info(this.ToString(), "Info Message");
-      //Logging.getInstance().Error(this.ToString(), "Error Message");
-      //Logging.getInstance().Error(this.ToString(), "Exception Message", new Exception("Exception"));      
-
+    public void Start() {      
       Heartbeat beat = new Heartbeat();
       beat.Interval = 5000;
@@ -68,33 +64,11 @@
 
       MessageQueue queue = MessageQueue.GetInstance();
-      
-      TestJob job = new TestJob();
-
-      AppDomain appDomain = CreateNewAppDomain(false);
-      
-      //This is a HACK. remove static directory ASAP
-      //Executor engine = (Executor)appDomain.CreateInstanceFromAndUnwrap(@"C:\Program Files\HeuristicLab 3.0\plugins\HeuristicLab.Hive.Client.ExecutionEngine-3.2.dll", "HeuristicLab.Hive.Client.ExecutionEngine.Executor");
-      
-      Executor engine = (Executor)appDomain.CreateInstanceAndUnwrap(typeof(Executor).Assembly.GetName().Name, typeof(Executor).FullName);
-      //ExecutionEngine.Executor engine = new ExecutionEngine.Executor();
-      engine.Job = job;
-      engine.JobId = 1L;
-      engine.Queue = queue;      
-      engine.Start();
-      engines.Add(engine.JobId, engine);
-
-      Thread.Sleep(15000);
-      engine.RequestSnapshot();
+      queue.AddMessage(MessageContainer.MessageType.FetchJob);     
       while (true) {
         MessageContainer container = queue.GetMessage();
+        Debug.WriteLine("Main loop received this message: " + container.Message.ToString());
         Logging.getInstance().Info(this.ToString(), container.Message.ToString()); 
         DetermineAction(container);
-
-        
       }
-    }
-
-    Assembly appDomain_TypeResolve(object sender, ResolveEventArgs args) {
-      throw new NotImplementedException();
     }
 
@@ -116,15 +90,55 @@
 
     private void DetermineAction(MessageContainer container) {
-      if(container.Message == MessageContainer.MessageType.AbortJob)
-        engines[container.JobId].Abort();
-      else if (container.Message == MessageContainer.MessageType.JobAborted)
-        //kill appdomain
-        Console.WriteLine("tmp");
-      else if (container.Message == MessageContainer.MessageType.RequestSnapshot)
-        engines[container.JobId].RequestSnapshot();
-      else if (container.Message == MessageContainer.MessageType.SnapshotReady)
-        // must be async!
-        engines[container.JobId].GetSnapshot();
-    }        
+      switch (container.Message) {
+        case MessageContainer.MessageType.AbortJob:
+          engines[container.JobId].Abort();
+          break;
+        case MessageContainer.MessageType.JobAborted:
+          Debug.WriteLine("-- Job Aborted Message received");
+          break;
+        
+        
+        case MessageContainer.MessageType.RequestSnapshot:
+          engines[container.JobId].RequestSnapshot();
+          break;
+        case MessageContainer.MessageType.SnapshotReady:
+          engines[container.JobId].GetSnapshot();
+          break;
+        
+        
+        case MessageContainer.MessageType.FetchJob:
+          IJob job = CreateNewJob();
+          
+          AppDomain appDomain = CreateNewAppDomain(false);
+          appDomains.Add(job.JobId, appDomain);
+          
+          Executor engine = (Executor)appDomain.CreateInstanceAndUnwrap(typeof(Executor).Assembly.GetName().Name, typeof(Executor).FullName);
+          engine.Job = job;
+          engine.JobId = job.JobId;
+          engine.Queue = MessageQueue.GetInstance();
+          engine.Start();
+          engines.Add(engine.JobId, engine);
+          break;
+
+        case MessageContainer.MessageType.FinishedJob:
+          engines[container.JobId].GetFinishedJob();
+          AppDomain.Unload(appDomains[container.JobId]);
+          appDomains.Remove(container.JobId);
+          engines.Remove(container.JobId);
+          break;
+
+      }
+    }
+    
+    /// <summary>
+    /// Simulator Class for new Jobs. will be replaced with fetching Jobs from the Interface
+    /// </summary>
+    /// <returns></returns>
+    private IJob CreateNewJob() {
+      Random random = new Random();
+      IJob job = new TestJob();
+      job.JobId = random.Next();
+      return job;
+    }
   }
 }
Index: trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/Executor.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/Executor.cs	(revision 778)
+++ trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/Executor.cs	(revision 779)
@@ -32,5 +32,5 @@
   public class Executor: MarshalByRefObject {
     public long JobId { get; set; }
-    public TestJob Job { get; set; }
+    public IJob Job { get; set; }
     public MessageContainer.MessageType CurrentMessage { get; set; }
     public MessageQueue Queue { get; set; }
@@ -55,5 +55,5 @@
     }
 
-    public XmlNode GetSnapshot() {
+    public String GetSnapshot() {
       //if the job is still running, something went VERY bad.
       if (Job.Running) {
@@ -63,19 +63,18 @@
         CurrentMessage = MessageContainer.MessageType.NoMessage;
         // Pack the whole job inside an xml document
-        String job = SerializeJobObject();
-        XmlNode node = Job.GetXmlNode();        
+        String job = SerializeJobObject();        
         // Restart the job
         Job.Start();
         // Return the Snapshot
-        return node;
+        return job;
       }
     }
 
-    public XmlNode GetFinishedJob() {
+    public String GetFinishedJob() {
       //Job isn't finished!
       if (Job.Running) {
         return null;
       } else {
-        return Job.GetXmlNode();
+        return SerializeJobObject();
       }
     }
