Index: trunk/sources/HeuristicLab.Hive.Engine/HeuristicLab.Hive.Engine.csproj
===================================================================
--- trunk/sources/HeuristicLab.Hive.Engine/HeuristicLab.Hive.Engine.csproj	(revision 1432)
+++ trunk/sources/HeuristicLab.Hive.Engine/HeuristicLab.Hive.Engine.csproj	(revision 1440)
@@ -31,4 +31,20 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
@@ -37,4 +53,7 @@
     </Reference>
     <Reference Include="System.Drawing" />
+    <Reference Include="System.ServiceModel">
+      <RequiredTargetFramework>3.0</RequiredTargetFramework>
+    </Reference>
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml.Linq">
@@ -48,11 +67,15 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Job.cs" />
     <Compile Include="HeuristicLabHiveEnginePlugin.cs" />
     <Compile Include="HiveEngine.cs" />
     <Compile Include="HiveEngineEditor.cs">
+      <SubType>UserControl</SubType>
     </Compile>
     <Compile Include="HiveEngineEditor.Designer.cs">
       <DependentUpon>HiveEngineEditor.cs</DependentUpon>
     </Compile>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="ServiceLocator.cs" />
   </ItemGroup>
   <ItemGroup>
@@ -60,4 +83,12 @@
       <Project>{F43B59AB-2B8C-4570-BC1E-15592086517C}</Project>
       <Name>HeuristicLab.Core</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.DataAccess\HeuristicLab.DataAccess.csproj">
+      <Project>{9076697B-C151-46CD-95BC-1D059492B478}</Project>
+      <Name>HeuristicLab.DataAccess</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.Hive.Contracts\HeuristicLab.Hive.Contracts.csproj">
+      <Project>{134F93D7-E7C8-4ECD-9923-7F63259A60D8}</Project>
+      <Name>HeuristicLab.Hive.Contracts</Name>
     </ProjectReference>
     <ProjectReference Include="..\HeuristicLab.Hive.JobBase\HeuristicLab.Hive.JobBase.csproj">
@@ -68,4 +99,8 @@
       <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
       <Name>HeuristicLab.PluginInfrastructure</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.SequentialEngine\HeuristicLab.SequentialEngine.csproj">
+      <Project>{B4BE8E53-BA06-4237-9A01-24255F880201}</Project>
+      <Name>HeuristicLab.SequentialEngine</Name>
     </ProjectReference>
   </ItemGroup>
@@ -86,3 +121,11 @@
   </Target>
   -->
+  <PropertyGroup>
+    <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd</PreBuildEvent>
+  </PropertyGroup>
 </Project>
Index: trunk/sources/HeuristicLab.Hive.Engine/HiveEngine.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Engine/HiveEngine.cs	(revision 1432)
+++ trunk/sources/HeuristicLab.Hive.Engine/HiveEngine.cs	(revision 1440)
@@ -25,4 +25,6 @@
 using HeuristicLab.Core;
 using System.Threading;
+using HeuristicLab.Hive.JobBase;
+using HeuristicLab.Hive.Contracts.Interfaces;
 
 namespace HeuristicLab.Hive.Engine {
@@ -31,66 +33,88 @@
   /// in parallel.
   /// </summary>
-  public class HiveEngine : EngineBase, IEditable {
-    private IOperator currentOperator;
+  public class HiveEngine : ItemBase, IEngine, IEditable {
+    private Job job;
+    public string HiveServerUrl { get; set; }
 
-    /// <summary>
-    /// Creates a new instance of <see cref="HiveEngineEditor"/>.
-    /// </summary>
-    /// <returns>The created view as <see cref="HiveEngineEditor"/>.</returns>
+    public HiveEngine() {
+      job = new Job();
+    }
+
+
+    #region IEngine Members
+
+    public IOperatorGraph OperatorGraph {
+      get { return job.Engine.OperatorGraph; }
+    }
+
+    public IScope GlobalScope {
+      get { return job.Engine.GlobalScope; }
+    }
+
+    public TimeSpan ExecutionTime {
+      get { return job.Engine.ExecutionTime; }
+    }
+
+    public bool Running {
+      get { return job.Engine.Running; }
+    }
+
+    public bool Canceled {
+      get { return job.Engine.Canceled; }
+    }
+
+    public bool Terminated {
+      get { return job.Engine.Terminated; }
+    }
+
+    public void Execute() {
+      IExecutionEngineFacade executionEngineFacade = ServiceLocator.CreateExecutionEngineFacade(HiveServerUrl);
+      HeuristicLab.Hive.Contracts.BusinessObjects.Job jobObj = new HeuristicLab.Hive.Contracts.BusinessObjects.Job();
+      jobObj.SerializedJob = PersistenceManager.SaveToGZip(job);
+      executionEngineFacade.AddJob(jobObj);
+    }
+
+    public void ExecuteStep() {
+      throw new NotSupportedException();
+    }
+
+    public void ExecuteSteps(int steps) {
+      throw new NotSupportedException();
+    }
+
+    public void Abort() {
+      throw new NotImplementedException();
+    }
+
+    public void Reset() {
+      throw new NotImplementedException();
+    }
+
+    public event EventHandler Initialized;
+
+    public event EventHandler<OperationEventArgs> OperationExecuted;
+
+    public event EventHandler<ExceptionEventArgs> ExceptionOccurred;
+
+    public event EventHandler ExecutionTimeChanged;
+
+    public event EventHandler Finished;
+
+    #endregion
+
+    public void RequestSnapshot() {
+      throw new NotImplementedException();
+    }
+
     public override IView CreateView() {
       return new HiveEngineEditor(this);
     }
 
-    /// <summary>
-    /// Creates a new instance of <see cref="HiveEngineEditor"/>.
-    /// </summary>
-    /// <returns>The created editor as <see cref="HiveEngineEditor"/>.</returns>
-    public virtual IEditor CreateEditor() {
+    #region IEditable Members
+
+    public IEditor CreateEditor() {
       return new HiveEngineEditor(this);
     }
-
-    /// <summary>
-    /// Aborts the current operator.
-    /// </summary>
-    /// <remarks>Calls <see cref="EngineBase.Abort"/> of base class <see cref="EngineBase"/> and
-    /// <see cref="IOperator.Abort"/> of the current <see cref="IOperator"/>.</remarks>
-    public override void Abort() {
-      base.Abort();
-      if (currentOperator != null)
-        currentOperator.Abort();
-    }
-
-    /// <summary>
-    /// Deals with the next operation, if it is an <see cref="AtomicOperation"/> it is executed,
-    /// if it is a <see cref="CompositeOperation"/> its single operations are pushed on the execution stack.
-    /// </summary>
-    /// <remarks>If an error occurs during the execution the operation is aborted and the operation
-    /// is pushed on the stack again.<br/>
-    /// If the execution was successful <see cref="EngineBase.OnOperationExecuted"/> is called.</remarks>
-    protected override void ProcessNextOperation() {
-      IOperation operation = myExecutionStack.Pop();
-      if (operation is AtomicOperation) {
-        AtomicOperation atomicOperation = (AtomicOperation)operation;
-        IOperation next = null;
-        try {
-          currentOperator = atomicOperation.Operator;
-          next = atomicOperation.Operator.Execute(atomicOperation.Scope);
-        }
-        catch (Exception ex) {
-          // push operation on stack again
-          myExecutionStack.Push(atomicOperation);
-          Abort();
-          ThreadPool.QueueUserWorkItem(delegate(object state) { OnExceptionOccurred(ex);});
-        }
-        if (next != null)
-          myExecutionStack.Push(next);
-        OnOperationExecuted(atomicOperation);
-        if (atomicOperation.Operator.Breakpoint) Abort();
-      } else if (operation is CompositeOperation) {
-        CompositeOperation compositeOperation = (CompositeOperation)operation;
-        for (int i = compositeOperation.Operations.Count - 1; i >= 0; i--)
-          myExecutionStack.Push(compositeOperation.Operations[i]);
-      }
-    }
+    #endregion
   }
 }
Index: trunk/sources/HeuristicLab.Hive.Engine/HiveEngineEditor.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Engine/HiveEngineEditor.cs	(revision 1432)
+++ trunk/sources/HeuristicLab.Hive.Engine/HiveEngineEditor.cs	(revision 1440)
@@ -41,5 +41,8 @@
     public HiveEngine HiveEngine {
       get { return (HiveEngine)Engine; }
-      set { base.Engine = value; }
+      set {
+        base.Engine = value;
+        SetDataBinding();
+      }
     }
 
@@ -59,4 +62,8 @@
       HiveEngine = hiveEngine;
     }
+
+    private void SetDataBinding() {
+      urlTextBox.DataBindings.Add("Text", HiveEngine, "HiveServerUrl");
+    }
   }
 }
Index: trunk/sources/HeuristicLab.Hive.Engine/Job.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Engine/Job.cs	(revision 1440)
+++ trunk/sources/HeuristicLab.Hive.Engine/Job.cs	(revision 1440)
@@ -0,0 +1,108 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab 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 HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using System.Threading;
+using HeuristicLab.Hive.JobBase;
+using System.Xml;
+
+namespace HeuristicLab.Hive.Engine {
+  /// <summary>
+  /// Represents an job that wraps an engine that should be executed in the hive.
+  /// </summary>
+  public class Job : StorableBase, IJob {
+    private IEngine engine;
+    public IEngine Engine {
+      get { return engine; }
+    }
+
+    public Job()
+      : base() {
+      engine = new SequentialEngine.SequentialEngine();
+      RegisterEvents();
+    }
+
+    private void RegisterEvents() {
+      engine.Finished += new EventHandler(engine_Finished);
+    }
+
+    private void DeregisterEvents() {
+      engine.Finished -= new EventHandler(engine_Finished);
+    }
+
+    void engine_Finished(object sender, EventArgs e) {
+      if (JobStopped != null)
+        JobStopped(this, new EventArgs());
+    }
+
+    #region IJob Members
+
+    public event EventHandler JobStopped;
+
+    public long JobId {
+      get;
+      set;
+    }
+
+    public double Progress {
+      get { return 0.0; }
+      set { throw new NotSupportedException(); }
+    }
+
+    public bool Running {
+      get {
+        return Engine.Running;
+      }
+      set {
+        throw new NotSupportedException();
+      }
+    }
+
+    public void Run() {
+      throw new NotSupportedException();
+    }
+
+    public void Start() {
+      Engine.Execute();
+    }
+
+    public void Stop() {
+      Engine.Abort();
+    }
+
+    #endregion
+
+    public override System.Xml.XmlNode GetXmlNode(string name, System.Xml.XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
+      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
+      node.AppendChild(PersistenceManager.Persist("Engine", Engine, document, persistedObjects));
+      return node;
+    }
+    public override void Populate(System.Xml.XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
+      base.Populate(node, restoredObjects);
+      DeregisterEvents();
+      engine = (SequentialEngine.SequentialEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects);
+      RegisterEvents();
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Hive.Engine/ServiceLocator.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Engine/ServiceLocator.cs	(revision 1440)
+++ trunk/sources/HeuristicLab.Hive.Engine/ServiceLocator.cs	(revision 1440)
@@ -0,0 +1,45 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab 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 HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using HeuristicLab.Hive.Contracts.Interfaces;
+using System.ServiceModel;
+
+namespace HeuristicLab.Hive.Engine {
+  internal class ServiceLocator {
+    internal static IExecutionEngineFacade CreateExecutionEngineFacade(string url) {
+      NetTcpBinding binding =
+           new NetTcpBinding();
+
+      binding.MaxReceivedMessageSize = 5000000;
+
+      ChannelFactory<IExecutionEngineFacade> factory =
+        new ChannelFactory<IExecutionEngineFacade>(
+          binding,
+          new EndpointAddress(url));
+
+      return factory.CreateChannel();
+    }
+  }
+}
