Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/Appointment.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/Appointment.cs	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/Appointment.cs	(revision 6369)
@@ -38,6 +38,4 @@
     [DataMember]
     public Guid ResourceId { get; set; }
-
-
   }
 }
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/HiveExperimentPermission.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/HiveExperimentPermission.cs	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/HiveExperimentPermission.cs	(revision 6369)
@@ -37,6 +37,4 @@
 
     public HiveExperimentPermission() { }
-
-
   }
 }
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/HiveItem.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/HiveItem.cs	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/HiveItem.cs	(revision 6369)
@@ -1,3 +1,24 @@
-﻿using System;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 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.Runtime.Serialization;
 
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/JobData.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/JobData.cs	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/JobData.cs	(revision 6369)
@@ -35,5 +35,4 @@
 
     public JobData() { }
-
   }
 }
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/HeuristicLab.Services.Hive.Common-3.4.csproj
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/HeuristicLab.Services.Hive.Common-3.4.csproj	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/HeuristicLab.Services.Hive.Common-3.4.csproj	(revision 6369)
@@ -129,7 +129,5 @@
     <None Include="HeuristicLab.snk" />
   </ItemGroup>
-  <ItemGroup>
-    <Folder Include="obj\" />
-  </ItemGroup>
+  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLab.Services.Hive.DataAccess-3.4.csproj
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLab.Services.Hive.DataAccess-3.4.csproj	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLab.Services.Hive.DataAccess-3.4.csproj	(revision 6369)
@@ -71,7 +71,4 @@
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="HeuristicLab.Clients.Common-3.3">
-      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Clients.Common-3.3.dll</HintPath>
-    </Reference>
     <Reference Include="HeuristicLab.Common-3.3">
       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Common-3.3.dll</HintPath>
@@ -118,5 +115,4 @@
       <DependentUpon>Settings.settings</DependentUpon>
     </Compile>
-    <Compile Include="Tools\CreateHiveDatabaseApplication.cs" />
     <Compile Include="TransactionManager.cs" />
   </ItemGroup>
@@ -151,5 +147,4 @@
   </ItemGroup>
   <ItemGroup>
-    <Content Include="Tools\cleanHiveDatabase.sql" />
     <Content Include="Tools\prepareHiveDatabase.sql" />
   </ItemGroup>
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLabServicesHiveDataAccessPlugin.cs.frame
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLabServicesHiveDataAccessPlugin.cs.frame	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLabServicesHiveDataAccessPlugin.cs.frame	(revision 6369)
@@ -8,5 +8,4 @@
   [Plugin("HeuristicLab.Services.Hive.DataAccess", "3.4.0.$WCREV$")]
   [PluginFile("HeuristicLab.Services.Hive.DataAccess-3.4.dll", PluginFileType.Assembly)]
-  [PluginDependency("HeuristicLab.Clients.Common", "3.3")]
   [PluginDependency("HeuristicLab.Common", "3.3")]
   [PluginDependency("HeuristicLab.Core", "3.3")]
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs	(revision 6369)
@@ -152,5 +152,4 @@
 
     #region JobData Methods
-
     public DT.JobData GetJobData(Guid id) {
       using (var db = CreateContext()) {
@@ -193,5 +192,4 @@
 
     #region StateLog Methods
-
     public DT.StateLog GetStateLog(Guid id) {
       using (var db = CreateContext()) {
@@ -285,5 +283,4 @@
 
     #region HiveExperimentPermission Methods
-
     public DT.HiveExperimentPermission GetHiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId) {
       using (var db = CreateContext()) {
@@ -322,5 +319,4 @@
       }
     }
-
     #endregion
 
@@ -366,5 +362,4 @@
 
     #region PluginData Methods
-
     public DT.PluginData GetPluginData(Guid id) {
       using (var db = CreateContext()) {
@@ -399,5 +394,5 @@
     public void DeletePluginData(Guid id) {
       using (var db = CreateContext()) {
-        var entity = db.PluginDatas.FirstOrDefault(x => x.PluginDataId == id); // todo: check if all the byte[] is loaded into memory here. otherwise work around to delete without loading it
+        var entity = db.PluginDatas.FirstOrDefault(x => x.PluginDataId == id);
         if (entity != null) db.PluginDatas.DeleteOnSubmit(entity);
         db.SubmitChanges();
@@ -611,5 +606,4 @@
       }
     }
-
     #endregion
 
@@ -682,5 +676,4 @@
       using (var db = CreateContext()) {
         return Convert.ToDto(db.Statistics.SingleOrDefault(x => x.StatisticsId == id));
-
       }
     }
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/HeuristicLab.Services.Hive-3.4.Tests.csproj
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/HeuristicLab.Services.Hive-3.4.Tests.csproj	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/HeuristicLab.Services.Hive-3.4.Tests.csproj	(revision 6369)
@@ -125,4 +125,8 @@
       <Name>HeuristicLab.Clients.Hive.Slave-3.4</Name>
     </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.Clients.Hive\3.4\HeuristicLab.Clients.Hive-3.4.csproj">
+      <Project>{B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}</Project>
+      <Name>HeuristicLab.Clients.Hive-3.4</Name>
+    </ProjectReference>
     <ProjectReference Include="..\HeuristicLab.Hive\3.4\HeuristicLab.Hive-3.4.csproj">
       <Project>{F98A1740-9AC9-4D36-A582-6A2D0D06978D}</Project>
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs	(revision 6369)
@@ -105,5 +105,5 @@
       job.HiveExperimentId = experiment.Id;
       job.Id = service.AddJob(job, jobData, new List<Guid> { slave.Id });
-      
+
       // test job
       DT.Job jobLoaded = service.GetJob(job.Id);
@@ -153,11 +153,32 @@
       Assert.AreEqual(1, jobsBySlave.Count());
       Assert.AreEqual(job.Id, jobsBySlave.Single().Id);
-      
+
       // set it to finished
       service.UpdateJobState(jobLoaded.Id, JobState.Finished, slave.Id, null, null);
 
-      // test if the job is returned for the resource
+      // test if the job is returned for the resource (it should not be)
       var jobsBySlave2 = service.GetJobsByResourceId(slave.Id);
       Assert.AreEqual(0, jobsBySlave2.Count());
+
+      // set job waiting again
+      service.UpdateJobState(job.Id, JobState.Waiting, null, null, string.Empty);
+
+      // get job again
+      actions = service.Heartbeat(new Heartbeat() { SlaveId = slave.Id, AssignJob = true, FreeCores = 4, FreeMemory = 1024, JobProgress = new Dictionary<Guid, TimeSpan>() });
+      Assert.AreEqual(1, actions.Count);
+      Assert.AreEqual(MessageContainer.MessageType.CalculateJob, actions[0].Message);
+      Assert.AreEqual(job.Id, actions[0].JobId);
+
+      // create appointment which should make slave unavailable for calculation
+      Guid appointmentId = service.AddAppointment(new Appointment { ResourceId = slave.Id, StartDate = DateTime.Now - TimeSpan.FromMinutes(1), EndDate = DateTime.Now + TimeSpan.FromMinutes(1), Recurring = false });
+
+      progress.Clear();
+      progress.Add(job.Id, new TimeSpan(1, 5, 10, 20, 30));
+      actions = service.Heartbeat(new Heartbeat() { SlaveId = slave.Id, AssignJob = true, FreeCores = 4, FreeMemory = 1024, JobProgress = new Dictionary<Guid, TimeSpan>() });
+      Assert.AreEqual(1, actions.Count);
+      Assert.AreEqual(MessageContainer.MessageType.PauseAll, actions[0].Message);
+      Assert.AreEqual(Guid.Empty, actions[0].JobId);
+
+      service.DeleteAppointment(appointmentId);
 
       // delete
@@ -177,6 +198,4 @@
     }
 
-    List<DT.Job> jobs = new List<DT.Job>();
-    
     [TestMethod]
     public void TestParentJobs() {
@@ -282,141 +301,4 @@
       service.DeleteSlave(slave.Id);
     }
-
-    //[TestMethod]
-    //public void TestHeartbeats() {
-    //  var service = GetLocalService();
-    //  // check if group already exists and delete
-    //  var existingSlaveGroup = service.GetSlaveGroups().SingleOrDefault(g => g.Name == "TestGroup");
-    //  if (existingSlaveGroup != null) {
-    //    var slavesToDelete = service.GetSlaves().Where(s => s.ParentResourceId == existingSlaveGroup.Id);
-    //    foreach (var slave in slavesToDelete) service.DeleteSlave(slave.Id);
-    //    service.DeleteSlaveGroup(existingSlaveGroup.Id);
-    //  }
-
-    //  Guid groupId = service.AddSlaveGroup(new SlaveGroup() { Name = "TestGroup", Description = "Used for unit tests" });
-
-    //  // create slaves
-    //  var slaves = new List<DT.Slave>();
-    //  for (int i = 0; i < 1; i++) {
-    //    DT.Slave slave = new DT.Slave() {
-    //      Cores = 2,
-    //      Memory = 4096,
-    //      Name = "Slave " + i,
-    //      IsAllowedToCalculate = true,
-    //      SlaveState = DT.SlaveState.Idle,
-    //      CpuSpeed = 2800,
-    //      FreeCores = 2,
-    //      FreeMemory = 3000
-    //    };
-    //    // check if slave with this name already exists and delete
-    //    var existingSlave = service.GetSlaves().Where(s => s.Name == slave.Name).SingleOrDefault();
-    //    if (existingSlave != null) service.DeleteSlave(existingSlave.Id);
-
-    //    slave.Id = service.AddSlave(slave);
-    //    service.AddResourceToGroup(groupId, slave.Id);
-    //    slaves.Add(slave);
-    //  }
-
-    //  // create jobs with different group, they should not be assigned
-    //  existingSlaveGroup = service.GetSlaveGroups().SingleOrDefault(g => g.Name == "DummyGroup");
-    //  if (existingSlaveGroup != null) service.DeleteSlaveGroup(existingSlaveGroup.Id);
-
-    //  Guid dummyGroupId = service.AddSlaveGroup(new SlaveGroup() { Name = "DummyGroup", Description = "Used for unit tests; jobs from this group shall not be calculated" });
-    //  // create dummy jobs
-    //  var dummyJobs = new List<Job>();
-    //  for (int i = 0; i < 2; i++) {
-    //    Job job = new Job() {
-    //      CoresNeeded = 1, MemoryNeeded = 0
-    //    };
-    //    JobData jobData = new JobData() { Data = PersistenceUtil.Serialize(new MockJob(500, false)) };
-    //    job.Id = service.AddJob(job, jobData, new List<Guid> { dummyGroupId });
-    //    dummyJobs.Add(job);
-    //  }
-
-    //  // create jobs
-    //  for (int i = 0; i < 2; i++) {
-    //    Job job = new Job() {
-    //      CoresNeeded = 1, MemoryNeeded = 0
-    //    };
-    //    JobData jobData = new JobData() { Data = PersistenceUtil.Serialize(new MockJob(500, false)) };
-    //    job.Id = service.AddJob(job, jobData, new List<Guid> { groupId });
-    //    jobs.Add(job);
-    //  }
-
-    //  // send heartbeats
-    //  foreach (var slave in slaves) {
-    //    new Thread(new ParameterizedThreadStart(RunSlaveThread)).Start(slave);
-    //  }
-
-    //  IEnumerable<LightweightJob> lightweightJobs;
-    //  do {
-    //    Thread.Sleep(500);
-    //    lightweightJobs = service.GetLightweightJobs(jobs.Select(x => x.Id));
-    //  } while (!lightweightJobs.All(x => x.State == JobState.Finished));
-
-    //  // delete slaves
-    //  foreach (var slave in slaves) {
-    //    service.DeleteSlave(slave.Id);
-    //    Assert.AreEqual(null, service.GetSlave(slave.Id));
-    //  }
-
-    //  // delete groups
-    //  service.DeleteSlaveGroup(groupId);
-    //  service.DeleteSlaveGroup(dummyGroupId);
-
-    //  // delete jobs
-    //  foreach (var job in jobs) {
-    //    service.DeleteJob(job.Id);
-    //  }
-
-    //  // delete dummy jobs
-    //  foreach (var job in dummyJobs) {
-    //    service.DeleteJob(job.Id);
-    //  }
-    //}
-
-    //public void RunSlaveThread(object slaveobj) {
-    //  try {
-    //    var service = GetLocalService();
-    //    Slave slave = (Slave)slaveobj;
-    //    int freeCores = slave.Cores.Value;
-
-    //    for (int i = 0; i < 10; i++) {
-
-    //      var messages = service.Heartbeat(new Heartbeat() { SlaveId = slave.Id, FreeMemory = 2423, FreeCores = freeCores, JobProgress = new Dictionary<Guid, TimeSpan>() });
-    //      if (messages.Count == 0) {
-    //        Debug.WriteLine("No job available");
-    //        return; // no more jobs
-    //      }
-
-    //      Debug.WriteLine("Messages: {0}", string.Join(", ", messages.Select(m => m.Message)));
-
-    //      Assert.IsTrue(messages.Where(x => x.Message == MessageContainer.MessageType.AbortJob).Count() == 0);
-    //      Assert.IsTrue(messages.Where(x => x.Message == MessageContainer.MessageType.SayHello).Count() == 0);
-    //      Assert.IsTrue(messages.Where(x => x.Message == MessageContainer.MessageType.PauseJob).Count() == 0);
-
-    //      var calculateJobMessage = messages.Where(x => x.Message == MessageContainer.MessageType.CalculateJob).SingleOrDefault();
-    //      if (calculateJobMessage != null) {
-    //        if (!jobs.Select(j => j.Id).Contains(calculateJobMessage.JobId))
-    //          Assert.Fail("Got job which was not assigned to the slavegroup");
-
-    //        Debug.WriteLine("Job available, calculating");
-    //        Job job = service.GetJob(calculateJobMessage.JobId);
-
-    //        JobData jobData = service.GetJobData(job.Id);
-    //        IJob deserializedJob = PersistenceUtil.Deserialize<IJob>(jobData.Data);
-    //        deserializedJob.Start();
-    //        job.SetState(JobState.Finished);
-    //        jobs.Where(x => x.Id == job.Id).Single().SetState(JobState.Finished);
-    //        jobData.Data = PersistenceUtil.Serialize(deserializedJob);
-    //        service.UpdateJobData(job, jobData);
-    //        Debug.WriteLine("finished calculating");
-    //      }
-    //    }
-    //  }
-    //  catch (Exception e) {
-    //    Assert.Fail(e.Message, e);
-    //  }
-    //}
   }
 }
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Web/Hive-3.4/Web.config
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Web/Hive-3.4/Web.config	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Web/Hive-3.4/Web.config	(revision 6369)
@@ -31,5 +31,4 @@
     <bindings>
       <wsHttpBinding>
-
         <binding name="WSHttpBinding_IHiveService"
 		             receiveTimeout="00:10:00"
@@ -76,9 +75,5 @@
 
   <system.webServer>
-    <!--<modules runAllManagedModulesForAllRequests="true">
-      <add name="HiveServerModule" type="HeuristicLab.Services.Hive.IISModules.HiveServerModule"/>
-    </modules>-->
-    <directoryBrowse enabled="true"/>
-    
+    <directoryBrowse enabled="true"/>    
   </system.webServer>
   
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/AuthorizationManager.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/AuthorizationManager.cs	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/AuthorizationManager.cs	(revision 6369)
@@ -34,18 +34,7 @@
     }
 
-    //public void AuthorizeJobs(params Guid[] jobIds) {
-    //  if (!IsAuthorizedForJobs(jobIds)) {
-    //    throw new SecurityException("User '" + Identity.UserName + "' is not authorized to access job (Id: " + string.Join(", ", jobIds.Select(x => x.ToString()).ToArray()) + ")");
-    //  }
-    //}
-
-    //private bool IsAuthorizedForJobs(params Guid[] jobIds) {
-    //  return ServiceLocator.Instance.HiveDao.IsUserAuthorizedForJobs(UserId, jobIds);
-    //}
-
     public void Authorize(Guid userId) {
-      if (userId != this.UserId) {
+      if (userId != this.UserId)
         throw new SecurityException("User '" + Identity.UserName + "' is not authorized to access object");
-      }
     }
   }
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeartbeatManager.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeartbeatManager.cs	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeartbeatManager.cs	(revision 6369)
@@ -31,5 +31,5 @@
         slave.FreeMemory = heartbeat.FreeMemory;
         slave.CpuUtilization = heartbeat.CpuUtilization;
-        slave.IsAllowedToCalculate = true; // Todo: look into calendar
+        slave.IsAllowedToCalculate = SlaveIsAllowedToCalculate(slave.Id);
         slave.SlaveState = (heartbeat.JobProgress != null && heartbeat.JobProgress.Count > 0) ? SlaveState.Calculating : SlaveState.Idle;
         slave.LastHeartbeat = DateTime.Now;
@@ -37,17 +37,14 @@
 
         // update job data
-        actions.AddRange(UpdateJobs(heartbeat));
+        actions.AddRange(UpdateJobs(heartbeat, slave.IsAllowedToCalculate));
 
         // assign new job
         if (heartbeat.AssignJob && slave.IsAllowedToCalculate && heartbeat.FreeCores > 0) {
-          // this part needs to be in a serializable transaction to avoid race conditions
-          //trans.UseTransaction(() => {
-            var availableJobs = dao.GetWaitingJobs(slave, 1);
-            if (availableJobs.Count() > 0) {
-              var job = availableJobs.First();
-              actions.Add(new MessageContainer(MessageContainer.MessageType.CalculateJob, job.Id));
-              AssignJob(slave, job);
-            }
-          //}, true);
+          var availableJobs = dao.GetWaitingJobs(slave, 1);
+          if (availableJobs.Count() > 0) {
+            var job = availableJobs.First();
+            actions.Add(new MessageContainer(MessageContainer.MessageType.CalculateJob, job.Id));
+            AssignJob(slave, job);
+          }
         }
       }
@@ -68,5 +65,5 @@
     /// Checks if all the jobs sent by heartbeat are supposed to be calculated by this slave
     /// </summary>
-    private IEnumerable<MessageContainer> UpdateJobs(Heartbeat heartbeat) {
+    private IEnumerable<MessageContainer> UpdateJobs(Heartbeat heartbeat, bool IsAllowedToCalculate) {
       List<MessageContainer> actions = new List<MessageContainer>();
 
@@ -74,36 +71,40 @@
         return actions;
 
-      // process the jobProgresses
-      foreach (var jobProgress in heartbeat.JobProgress) {
-        Job curJob = dao.GetJob(jobProgress.Key);
-        if (curJob == null) {
-          // job does not exist in db
-          actions.Add(new MessageContainer(MessageContainer.MessageType.AbortJob, jobProgress.Key));
-          LogFactory.GetLogger(this.GetType().Namespace).Log("Job does not exist in DB: " + jobProgress.Key);
-        } else {
-          if (curJob.CurrentStateLog.SlaveId == Guid.Empty || curJob.CurrentStateLog.SlaveId != heartbeat.SlaveId) {
-            // assigned slave does not match heartbeat
-            actions.Add(new MessageContainer(MessageContainer.MessageType.AbortJob, curJob.Id));
-            LogFactory.GetLogger(this.GetType().Namespace).Log("The slave " + heartbeat.SlaveId + " is not supposed to calculate Job: " + curJob);
-          } else if (!JobIsAllowedToBeCalculatedBySlave(heartbeat.SlaveId, curJob)) {
-            // assigned resources ids of job do not match with slaveId (and parent resourceGroupIds); this might happen when slave is moved to different group
-            actions.Add(new MessageContainer(MessageContainer.MessageType.PauseJob, curJob.Id));
+      if (!IsAllowedToCalculate) {
+        actions.Add(new MessageContainer(MessageContainer.MessageType.PauseAll));
+      } else {
+        // process the jobProgresses
+        foreach (var jobProgress in heartbeat.JobProgress) {
+          Job curJob = dao.GetJob(jobProgress.Key);
+          if (curJob == null) {
+            // job does not exist in db
+            actions.Add(new MessageContainer(MessageContainer.MessageType.AbortJob, jobProgress.Key));
+            LogFactory.GetLogger(this.GetType().Namespace).Log("Job does not exist in DB: " + jobProgress.Key);
           } else {
-            // save job execution time
-            curJob.ExecutionTime = jobProgress.Value;
-            curJob.LastHeartbeat = DateTime.Now;
+            if (curJob.CurrentStateLog.SlaveId == Guid.Empty || curJob.CurrentStateLog.SlaveId != heartbeat.SlaveId) {
+              // assigned slave does not match heartbeat
+              actions.Add(new MessageContainer(MessageContainer.MessageType.AbortJob, curJob.Id));
+              LogFactory.GetLogger(this.GetType().Namespace).Log("The slave " + heartbeat.SlaveId + " is not supposed to calculate Job: " + curJob);
+            } else if (!JobIsAllowedToBeCalculatedBySlave(heartbeat.SlaveId, curJob)) {
+              // assigned resources ids of job do not match with slaveId (and parent resourceGroupIds); this might happen when slave is moved to different group
+              actions.Add(new MessageContainer(MessageContainer.MessageType.PauseJob, curJob.Id));
+            } else {
+              // save job execution time
+              curJob.ExecutionTime = jobProgress.Value;
+              curJob.LastHeartbeat = DateTime.Now;
 
-            switch (curJob.Command) {
-              case Command.Stop:
-                actions.Add(new MessageContainer(MessageContainer.MessageType.StopJob, curJob.Id));
-                break;
-              case Command.Pause:
-                actions.Add(new MessageContainer(MessageContainer.MessageType.PauseJob, curJob.Id));
-                break;
-              case Command.Abort:
-                actions.Add(new MessageContainer(MessageContainer.MessageType.AbortJob, curJob.Id));
-                break;
+              switch (curJob.Command) {
+                case Command.Stop:
+                  actions.Add(new MessageContainer(MessageContainer.MessageType.StopJob, curJob.Id));
+                  break;
+                case Command.Pause:
+                  actions.Add(new MessageContainer(MessageContainer.MessageType.PauseJob, curJob.Id));
+                  break;
+                case Command.Abort:
+                  actions.Add(new MessageContainer(MessageContainer.MessageType.AbortJob, curJob.Id));
+                  break;
+              }
+              dao.UpdateJob(curJob);
             }
-            dao.UpdateJob(curJob);
           }
         }
@@ -117,4 +118,9 @@
       return assignedResourceIds.Any(x => slaveResourceIds.Contains(x));
     }
+
+    private bool SlaveIsAllowedToCalculate(Guid slaveId) {
+      // appointment==doNotCompute! the slave may only calculate if there is no appointment right now. this needs to be checked for every parent resource also
+      return dao.GetParentResources(slaveId).All(r => dao.GetAppointments(x => x.ResourceId == r.Id && (DateTime.Now >= x.StartDate) && (DateTime.Now <= x.EndDate)).Count() == 0);
+    }
   }
 }
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeuristicLab.Services.Hive-3.4.csproj
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeuristicLab.Services.Hive-3.4.csproj	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeuristicLab.Services.Hive-3.4.csproj	(revision 6369)
@@ -72,7 +72,4 @@
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="HeuristicLab.Clients.Common-3.3">
-      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Clients.Common-3.3.dll</HintPath>
-    </Reference>
     <Reference Include="HeuristicLab.Common-3.3">
       <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Common-3.3.dll</HintPath>
@@ -135,7 +132,5 @@
     <None Include="HeuristicLab.snk" />
   </ItemGroup>
-  <ItemGroup>
-    <Folder Include="Standalone\" />
-  </ItemGroup>
+  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <ProjectExtensions>
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeuristicLabServicesHivePlugin.cs.frame
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeuristicLabServicesHivePlugin.cs.frame	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeuristicLabServicesHivePlugin.cs.frame	(revision 6369)
@@ -8,5 +8,4 @@
   [Plugin("HeuristicLab.Services.Hive", "3.4.0.$WCREV$")]
   [PluginFile("HeuristicLab.Services.Hive-3.4.dll", PluginFileType.Assembly)]
-  [PluginDependency("HeuristicLab.Clients.Common", "3.3")]
   [PluginDependency("HeuristicLab.Common", "3.3")]
   [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveRoles.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveRoles.cs	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveRoles.cs	(revision 6369)
@@ -20,5 +20,4 @@
 #endregion
 
-
 namespace HeuristicLab.Services.Hive {
   public static class HiveRoles {
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs	(revision 6369)
@@ -317,10 +317,5 @@
       return trans.UseTransaction(() => {
         foreach (Guid guid in pluginIds) {
-          List<PluginData> pluginData = dao.GetPluginDatas(x => x.PluginId == guid).ToList();
-          if (pluginData != null) {
-            pluginDatas.AddRange(pluginData);
-          } else {
-            //ignore ? 
-          }
+          pluginDatas.AddRange(dao.GetPluginDatas(x => x.PluginId == guid).ToList());
         }
         return pluginDatas;
@@ -420,5 +415,5 @@
 
     public void TriggerLifecycle(bool force) {
-      // use a serializable transaction here to ensure not two threads execute this simultaniously (locking would not work since IIS may use multiple AppDomains)
+      // use a serializable transaction here to ensure not two threads execute this simultaniously (mutex-lock would not work since IIS may use multiple AppDomains)
       trans.UseTransaction(() => {
         DateTime lastCleanup = dao.GetLastCleanup();
@@ -444,8 +439,6 @@
 
       if (includeParent) jobs.Add(GetJob(parentJobId.Value));
-
       return jobs;
     }
-
     #endregion
 
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/IAuthorizationManager.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/IAuthorizationManager.cs	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/IAuthorizationManager.cs	(revision 6369)
@@ -29,11 +29,4 @@
 
     /// <summary>
-    /// Checks if the user is allowed to access all the jobs.
-    /// throws an exception if one of those jobs is inaccessible
-    /// </summary>
-    /// <exception cref="SecurityException">thrown when access denied</exception>
-    //void AuthorizeJobs(params Guid[] jobId);
-
-    /// <summary>
     /// Compares the current UserId with the given userId and takes appropriate actions if the mismatch
     /// </summary>
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/ILifecycleManager.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/ILifecycleManager.cs	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/ILifecycleManager.cs	(revision 6369)
@@ -1,3 +1,23 @@
-﻿
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 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
+
 namespace HeuristicLab.Services.Hive {
   /// <summary>
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/IServiceLocator.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/IServiceLocator.cs	(revision 6368)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/IServiceLocator.cs	(revision 6369)
@@ -1,3 +1,24 @@
-﻿using HeuristicLab.Services.Hive.DataAccess;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 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 HeuristicLab.Services.Hive.DataAccess;
 
 namespace HeuristicLab.Services.Hive {
