Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6431


Ignore:
Timestamp:
06/16/11 14:20:48 (13 years ago)
Author:
cneumuel
Message:

#1233

  • changed Log to ThreadSafeLog
  • added license information to all files
  • added assembly descriptions
  • using blocks before namespace
  • made TransactionManager static
  • removed DaoException
  • removed TimeSpanExtensions
  • renamed prepareHiveDatabase.sql should be renamed to Prepare Hive Database.sql
  • created Initialize Hive Database.sql
Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
2 added
1 deleted
29 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/ConsoleTests/Program.cs

    r6367 r6431  
    2222      //TestThreadSafeLog(); return;
    2323      //TestThreadSafePersistence(); return;
     24      TestCappedLog(); return;
    2425      string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
    2526
     
    3132      var app = pm.Applications.Where(x => x.Name == "HeuristicLab.Clients.Hive.Slave.Tests").Single();
    3233      pm.Run(app);
     34    }
     35
     36    private static void TestCappedLog() {
     37      ILog log = new Log(); // maxMessageCount = -1
     38      Console.WriteLine("0=={0}", log.Messages.Count());
     39      log.LogMessage("asdf");
     40      Console.WriteLine("1=={0}", log.Messages.Count());
     41      log.LogMessage("asdf");
     42      log.LogMessage("asdf");
     43      Console.WriteLine("3=={0}", log.Messages.Count());
     44     
     45      ILog log0 = new Log(0);
     46      Console.WriteLine("0=={0}", log0.Messages.Count());
     47      log0.LogMessage("asdf");
     48      Console.WriteLine("0=={0}", log0.Messages.Count());
     49      log0.LogMessage("asdf");
     50      log0.LogMessage("asdf");
     51      log0.LogMessage("asdf");
     52      Console.WriteLine("0=={0}", log0.Messages.Count());
     53
     54      ILog log1 = new Log(1);
     55      log1.LogMessage("asdf 1");
     56      Console.WriteLine("1=={0}", log1.Messages.Count());
     57      log1.LogMessage("asdf 2");
     58      log1.LogMessage("asdf 3");
     59      Console.WriteLine("1=={0}", log1.Messages.Count());
     60      Console.WriteLine("asdf 3=={0}", log1.Messages.First());
    3361    }
    3462
     
    271299      PluginUtil.CollectDeclaringPlugins(plugins, types);
    272300      foreach (var plugin in plugins) {
    273         var p = PluginUtil.CreatePlugin(plugin, false);
     301        var p = PluginUtil.CreatePlugin(plugin);
    274302        p.Id = Guid.NewGuid();
    275303        lock (locker) {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HeuristicLab.Clients.Hive-3.4.csproj

    r6419 r6431  
    117117    <Compile Include="StateLogList.cs" />
    118118    <Compile Include="StateLogListList.cs" />
    119     <Compile Include="ThreadSafeLog.cs" />
    120119    <None Include="app_f005pc.config" />
    121120    <None Include="app_services.config" />
    122121    <None Include="app.config" />
     122    <None Include="ClassDiagram2.cd" />
    123123    <None Include="HeuristicLabClientsHivePlugin.cs.frame" />
    124124    <Compile Include="Exceptions\AddJobToHiveException.cs" />
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/RefreshableHiveExperiment.cs

    r6419 r6431  
    8282    }
    8383
    84     private ILog log;
     84    private ThreadSafeLog log;
    8585    public ILog Log {
    8686      get { return log; }
    87       set { log = value; }
    88     }
    89     private static object logLocker = new object();
     87    }
    9088
    9189    #region Constructors and Cloning
     
    9391      this.refreshAutomatically = true;
    9492      this.HiveExperiment = new HiveExperiment();
    95       this.log = new Log();
     93      this.log = new ThreadSafeLog(new Log());
    9694      this.jobDownloader = new ConcurrentJobDownloader<ItemJob>(2, 2);
    9795      this.jobDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobDownloader_ExceptionOccured);
     
    10098      this.refreshAutomatically = true;
    10199      this.HiveExperiment = hiveExperiment;
    102       this.log = new Log();
     100      this.log = new ThreadSafeLog(new Log());
    103101      this.jobDownloader = new ConcurrentJobDownloader<ItemJob>(2, 2);
    104102      this.jobDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobDownloader_ExceptionOccured);
     
    108106      this.HiveExperiment = original.HiveExperiment;
    109107      this.IsControllable = original.IsControllable;
    110       this.Log = cloner.Clone(original.Log);
     108      this.log = cloner.Clone(original.log);
    111109      this.RefreshAutomatically = false; // do not start results polling automatically
    112110      this.jobDownloader = new ConcurrentJobDownloader<ItemJob>(2, 2);
     
    180178
    181179          if (!hiveJob.IsFinishedJobDownloaded && !hiveJob.IsDownloading && hiveJob.Job.LastJobDataUpdate < lightweightJob.LastJobDataUpdate) {
    182             LogMessage(string.Format("Downloading job {0}", lightweightJob.Id));
     180            log.LogMessage(string.Format("Downloading job {0}", lightweightJob.Id));
    183181            hiveJob.IsDownloading = true;
    184182            jobDownloader.DownloadJob(hiveJob.Job, (localJob, itemJob) => {
    185               LogMessage(string.Format("Finished downloading job {0}", localJob.Id));
     183              log.LogMessage(string.Format("Finished downloading job {0}", localJob.Id));
    186184              HiveJob localHiveJob = GetHiveJobById(localJob.Id);
    187185
     
    222220    }
    223221
    224     // synchronized logging
    225     private void LogException(Exception exception) {
    226       lock (logLocker) {
    227         this.log.LogException(exception);
    228       }
    229     }
    230     // synchronized logging
    231     private void LogMessage(string message) {
    232       lock (logLocker) {
    233         this.log.LogMessage(message);
    234       }
    235     }
    236 
    237222    public HiveJob GetHiveJobById(Guid jobId) {
    238223      foreach (HiveJob job in hiveExperiment.HiveJobs) {
     
    356341    public event EventHandler<EventArgs<Exception>> ExceptionOccured;
    357342    private void OnExceptionOccured(Exception exception) {
    358       LogException(exception);
     343      log.LogException(exception);
    359344      var handler = ExceptionOccured;
    360345      if (handler != null) handler(this, new EventArgs<Exception>(exception));
     
    390375      get { return hiveExperiment.ItemVersion; }
    391376    }
    392 
    393 
     377   
    394378    #region IProgressReporter Members
    395379    public IProgress Progress {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/JobState.cs

    r6372 r6431  
    3434    /// </summary>
    3535    Waiting,
    36 
    37     ///// <summary>
    38     ///// The job is set to Finished when all child jobs are Finished.
    39     ///// </summary>
    40     //FinishOnChildJobsFinished,
    41 
    42     ///// <summary>
    43     ///// The job is paused and waits on the server to be sent back to a Slave when all of its child jobs are Finished.
    44     ///// </summary>
    45     //ResumeOnChildJobsFinished,
    4636
    4737    /// <summary>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/HeuristicLabServicesHiveCommonPlugin.cs.frame

    r5043 r6431  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324using System.Linq;
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/Logger.cs

    r5711 r6431  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Diagnostics;
    324using System.Security;
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/Properties/AssemblyInfo.cs.frame

    r6372 r6431  
    77// associated with an assembly.
    88[assembly: AssemblyTitle("HeuristicLab.Services.Hive.Common")]
    9 [assembly: AssemblyDescription("")]
     9[assembly: AssemblyDescription("Common classes for HeuristicLab.Hive services")]
    1010[assembly: AssemblyConfiguration("")]
    1111[assembly: AssemblyCompany("")]
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ServiceContracts/IHiveService.cs

    r6267 r6431  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324using System.Net.Security;
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLab.Services.Hive.DataAccess-3.4.csproj

    r6407 r6431  
    9696    <Compile Include="Convert.cs" />
    9797    <None Include="HeuristicLabServicesHiveDataAccessPlugin.cs.frame" />
    98     <Compile Include="Exceptions\DaoException.cs" />
    9998    <Compile Include="HeuristicLabServicesHiveDataAccessPlugin.cs" />
    10099    <Compile Include="HiveDao.cs" />
     
    148147  </ItemGroup>
    149148  <ItemGroup>
    150     <Content Include="Tools\prepareHiveDatabase.sql" />
     149    <Content Include="Tools\Initialize Hive Database.sql" />
     150    <Content Include="Tools\Prepare Hive Database.sql" />
    151151  </ItemGroup>
    152152  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLabServicesHiveDataAccessPlugin.cs.frame

    r6369 r6431  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324using System.Linq;
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs

    r6419 r6431  
    481481        if (entity != null) {
    482482          if (db.Resources.Where(r => r.ParentResourceId == id).Count() > 0) {
    483             throw new DaoException("Cannot delete SlaveGroup as long as there are Slaves in the group");
     483            throw new InvalidOperationException("Cannot delete SlaveGroup as long as there are Slaves in the group");
    484484          }
    485485          db.Resources.DeleteOnSubmit(entity);
     
    758758                                          select new {
    759759                                            UserId = g.Key,
    760                                             StartToEndTime = g.Select(x => x.StateLogs.OrderByDescending(sl => sl.DateTime).First().DateTime - x.StateLogs.OrderBy(sl => sl.DateTime).First().DateTime).Sum()
     760                                            StartToEndTime = new TimeSpan(g.Select(x => x.StateLogs.OrderByDescending(sl => sl.DateTime).First().DateTime - x.StateLogs.OrderBy(sl => sl.DateTime).First().DateTime).Sum(ts => ts.Ticks))
    761761                                          };
    762762        foreach (var item in startToEndTimesFinishedJobs) {
     
    801801    #endregion
    802802  }
    803 
    804   public static class TimeSpanExtensions {
    805     public static TimeSpan Sum(this IEnumerable<TimeSpan> ts) {
    806       return new TimeSpan(ts.Sum(r => r.Ticks));
    807     }
    808   }
    809803}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml

    r6426 r6431  
    1616      <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" />
    1717      <Column Name="DateCreated" Type="System.DateTime" DbType="DateTime" CanBeNull="false" />
    18       <Column Name="Hash" Type="System.Byte[]" DbType="VarBinary(20)" CanBeNull="true" />
     18      <Column Name="Hash" Type="System.Byte[]" DbType="VarBinary(20) NOT NULL" CanBeNull="false" />
    1919      <Association Name="Plugin_RequiredPlugin" Member="RequiredPlugins" ThisKey="PluginId" OtherKey="PluginId" Type="RequiredPlugin" />
    2020      <Association Name="Plugin_PluginData" Member="PluginData" ThisKey="PluginId" OtherKey="PluginId" Type="PluginData" />
     
    156156    <Type Name="DeletedJobStatistics">
    157157      <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
    158       <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float" CanBeNull="false" />
    159       <Column Name="ExecutionTimeMsFinishedJobs" Storage="_ExecutionTimeFinishedJobs" Type="System.Double" DbType="float" CanBeNull="false" />
    160       <Column Name="StartToEndTimeMs" Storage="_StartToEndTime" Type="System.Double" DbType="float" CanBeNull="false" />
     158      <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" />
     159      <Column Name="ExecutionTimeMsFinishedJobs" Storage="_ExecutionTimeFinishedJobs" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" />
     160      <Column Name="StartToEndTimeMs" Storage="_StartToEndTime" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" />
    161161      <Column Name="DeletedJobStatisticsId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
    162162    </Type>
     
    166166      <Column Name="StatisticsId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    167167      <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    168       <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float" CanBeNull="false" />
    169       <Column Name="UsedCores" Storage="_CoresUsed" Type="System.Int32" DbType="Int" CanBeNull="false" />
    170       <Column Name="ExecutionTimeMsFinishedJobs" Storage="_ExecutionTimeFinishedJobs" Type="System.Double" DbType="float" CanBeNull="false" />
    171       <Column Name="StartToEndTimeMs" Storage="_StartToEndTime" Type="System.Double" DbType="float" CanBeNull="false" />
     168      <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" />
     169      <Column Name="UsedCores" Storage="_CoresUsed" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
     170      <Column Name="ExecutionTimeMsFinishedJobs" Storage="_ExecutionTimeFinishedJobs" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" />
     171      <Column Name="StartToEndTimeMs" Storage="_StartToEndTime" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" />
    172172      <Association Name="Statistics_UserStatistics" Member="Statistics" ThisKey="StatisticsId" OtherKey="StatisticsId" Type="Statistics" IsForeignKey="true" />
    173173    </Type>
     
    177177      <Column Name="StatisticsId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    178178      <Column Name="SlaveId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    179       <Column Name="Cores" Type="System.Int32" DbType="Int" CanBeNull="false" />
    180       <Column Name="FreeCores" Type="System.Int32" DbType="Int" CanBeNull="false" />
    181       <Column Name="CpuUtilization" Type="System.Double" DbType="float" CanBeNull="false" />
    182       <Column Name="Memory" Type="System.Int32" DbType="Int" CanBeNull="false" />
    183       <Column Name="FreeMemory" Type="System.Int32" DbType="Int" CanBeNull="false" />
     179      <Column Name="Cores" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
     180      <Column Name="FreeCores" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
     181      <Column Name="CpuUtilization" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" />
     182      <Column Name="Memory" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
     183      <Column Name="FreeMemory" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
    184184      <Association Name="Statistics_SlaveStatistics" Member="Statistics" ThisKey="StatisticsId" OtherKey="StatisticsId" Type="Statistics" IsForeignKey="true" />
    185185    </Type>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout

    r6426 r6431  
    7676      </nodes>
    7777    </associationConnector>
    78     <associationConnector edgePoints="[(7.5 : 4.30930826822917); (7.5 : 4.84780160677083); (8.875 : 4.84780160677083)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     78    <associationConnector edgePoints="[(7.5 : 4.30930826822917); (7.5 : 4.84780160677083); (8.875 : 4.84780160677083)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    7979      <AssociationMoniker Name="/HiveDataContext/Job/Job_AssignedResource" />
    8080      <nodes>
     
    116116      </nestedChildShapes>
    117117    </classShape>
    118     <associationConnector edgePoints="[(10.875 : 6.28929768880208); (11.25 : 6.28929768880208)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     118    <associationConnector edgePoints="[(10.875 : 6.28929768880208); (11.25 : 6.28929768880208)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    119119      <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_PluginData" />
    120120      <nodes>
     
    130130      </nodes>
    131131    </associationConnector>
    132     <associationConnector edgePoints="[(8.875 : 6.19314697265625); (8.5 : 6.19314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     132    <associationConnector edgePoints="[(8.875 : 6.19314697265625); (8.5 : 6.19314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    133133      <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_RequiredPlugin" />
    134134      <nodes>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs

    r6426 r6431  
    573573    }
    574574   
    575     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Hash", DbType="VarBinary(20)")]
     575    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Hash", DbType="VarBinary(20) NOT NULL", CanBeNull=false)]
    576576    public byte[] Hash
    577577    {
     
    35053505    }
    35063506   
    3507     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float")]
     3507    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float NOT NULL")]
    35083508    public double ExecutionTimeMs
    35093509    {
     
    35253525    }
    35263526   
    3527     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="float")]
     3527    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="float NOT NULL")]
    35283528    public double ExecutionTimeMsFinishedJobs
    35293529    {
     
    35453545    }
    35463546   
    3547     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="float")]
     3547    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="float NOT NULL")]
    35483548    public double StartToEndTimeMs
    35493549    {
     
    36943694    }
    36953695   
    3696     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float")]
     3696    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float NOT NULL")]
    36973697    public double ExecutionTimeMs
    36983698    {
     
    37143714    }
    37153715   
    3716     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CoresUsed", DbType="Int")]
     3716    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CoresUsed", DbType="Int NOT NULL")]
    37173717    public int UsedCores
    37183718    {
     
    37343734    }
    37353735   
    3736     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="float")]
     3736    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="float NOT NULL")]
    37373737    public double ExecutionTimeMsFinishedJobs
    37383738    {
     
    37543754    }
    37553755   
    3756     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="float")]
     3756    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="float NOT NULL")]
    37573757    public double StartToEndTimeMs
    37583758    {
     
    39213921    }
    39223922   
    3923     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Cores", DbType="Int")]
     3923    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Cores", DbType="Int NOT NULL")]
    39243924    public int Cores
    39253925    {
     
    39413941    }
    39423942   
    3943     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FreeCores", DbType="Int")]
     3943    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FreeCores", DbType="Int NOT NULL")]
    39443944    public int FreeCores
    39453945    {
     
    39613961    }
    39623962   
    3963     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CpuUtilization", DbType="float")]
     3963    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CpuUtilization", DbType="float NOT NULL")]
    39643964    public double CpuUtilization
    39653965    {
     
    39813981    }
    39823982   
    3983     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Memory", DbType="Int")]
     3983    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Memory", DbType="Int NOT NULL")]
    39843984    public int Memory
    39853985    {
     
    40014001    }
    40024002   
    4003     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FreeMemory", DbType="Int")]
     4003    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FreeMemory", DbType="Int NOT NULL")]
    40044004    public int FreeMemory
    40054005    {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs

    r6267 r6431  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324using System.Linq.Expressions;
     25using HeuristicLab.Services.Hive.Common.DataTransfer;
     26using DT = HeuristicLab.Services.Hive.Common.DataTransfer;
    427
    528namespace HeuristicLab.Services.Hive.DataAccess {
    6   using HeuristicLab.Services.Hive.Common.DataTransfer;
    7   using DT = HeuristicLab.Services.Hive.Common.DataTransfer;
    8 
    929  public interface IHiveDao {
    1030    #region Job Methods
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Properties/AssemblyInfo.cs.frame

    r6372 r6431  
    77// associated with an assembly.
    88[assembly: AssemblyTitle("HeuristicLab.Services.Hive.Server.DataAccess")]
    9 [assembly: AssemblyDescription("")]
     9[assembly: AssemblyDescription("Data access layer for HeuristicLab.Hive database")]
    1010[assembly: AssemblyConfiguration("")]
    1111[assembly: AssemblyCompany("")]
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/CreateHiveDatabaseApplication.cs

    r5511 r6431  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2020#endregion
    2121
    22 using HeuristicLab.PluginInfrastructure;
    2322using System.IO;
    2423using System.Windows.Forms;
     24using HeuristicLab.PluginInfrastructure;
    2525
    2626namespace HeuristicLab.Services.Hive.DataAccess {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/TransactionManager.cs

    r6419 r6431  
    2525
    2626namespace HeuristicLab.Services.Hive.DataAccess {
    27   public class TransactionManager {
    28     public void UseTransaction(Action call, bool serializable = false, bool longRunning = false) {
     27  public static class TransactionManager {
     28    public static void UseTransaction(Action call, bool serializable = false, bool longRunning = false) {
    2929      TransactionScope transaction = CreateTransaction(serializable, longRunning);
    3030      try {
     
    3737    }
    3838
    39     public T UseTransaction<T>(Func<T> call, bool serializable = false, bool longRunning = false) {
     39    public static T UseTransaction<T>(Func<T> call, bool serializable = false, bool longRunning = false) {
    4040      TransactionScope transaction = CreateTransaction(serializable, longRunning);
    4141      try {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/DaoTests.cs

    r6267 r6431  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
     23using System.Collections.Generic;
    224using System.Linq;
     25using System.Threading;
    326using HeuristicLab.Services.Hive.Common.DataTransfer;
    427using HeuristicLab.Services.Hive.Common.ServiceContracts;
    528using HeuristicLab.Services.Hive.DataAccess;
    629using Microsoft.VisualStudio.TestTools.UnitTesting;
     30using DT = HeuristicLab.Services.Hive.Common.DataTransfer;
    731
    832namespace HeuristicLab.Services.Hive.Tests {
    9   using System.Collections.Generic;
    10   using System.Threading;
    11   using DT = HeuristicLab.Services.Hive.Common.DataTransfer;
    12 
    1333  [TestClass]
    1434  public class DaoTests {
     
    4969      plugin1.Version = new Version("1.0.0.0");
    5070      plugin1.UserId = Guid.Empty;
    51       plugin1.IsLocal = true;
    5271      plugin1.DateCreated = DateTime.Now;
    5372
     
    155174      DT.Plugin plugin1 = new DT.Plugin();
    156175      plugin1.DateCreated = DateTime.Now;
    157       plugin1.IsLocal = false;
    158176      plugin1.Name = "Tests.MyPlugin";
    159177      plugin1.Version = new Version("1.0.0.0");
     
    168186      Assert.AreEqual(plugin1.UserId, plugin1loaded.UserId);
    169187      Assert.AreEqual(plugin1.DateCreated.ToString(), plugin1loaded.DateCreated.ToString());
    170       Assert.AreEqual(plugin1.IsLocal, plugin1loaded.IsLocal);
    171188
    172189      DT.PluginData pluginData1 = new DT.PluginData();
     
    264281      Assert.IsTrue(Math.Abs((stats.TimeStamp - statsLoaded.TimeStamp).TotalSeconds) < 1);
    265282
    266       for (int i = 0; i  < slaveStats.Count; i ++) {
     283      for (int i = 0; i < slaveStats.Count; i++) {
    267284        Assert.AreEqual(slaveStats[i].Cores, statsLoaded.SlaveStatistics.Single(x => x.SlaveId == slaveStats[i].SlaveId).Cores);
    268285        Assert.AreEqual(slaveStats[i].FreeCores, statsLoaded.SlaveStatistics.Single(x => x.SlaveId == slaveStats[i].SlaveId).FreeCores);
     
    274291      for (int i = 0; i < userStats.Count; i++) {
    275292        Assert.AreEqual(userStats[i].ExecutionTime, statsLoaded.UserStatistics.Single(x => x.UserId == userStats[i].UserId).ExecutionTime);
    276         Assert.AreEqual(userStats[i].UsedCores, statsLoaded.UserStatistics.Single(x => x.UserId == userStats[i].UserId).UsedCores);       
     293        Assert.AreEqual(userStats[i].UsedCores, statsLoaded.UserStatistics.Single(x => x.UserId == userStats[i].UserId).UsedCores);
    277294      }
    278295
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Mocks/MockServiceLocator.cs

    r6372 r6431  
    4949    }
    5050
    51     public TransactionManager TransactionManager {
    52       get { return defaultServiceLocator.TransactionManager; }
    53     }
    54 
    5551    public HeartbeatManager HeartbeatManager {
    5652      get {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Properties/AssemblyInfo.cs

    r5078 r6431  
    11using System.Reflection;
    2 using System.Runtime.CompilerServices;
    32using System.Runtime.InteropServices;
    43
     
    76// associated with an assembly.
    87[assembly: AssemblyTitle("HeuristicLab.Services.Hive.Tests")]
    9 [assembly: AssemblyDescription("")]
     8[assembly: AssemblyDescription("Unit tests for HeuristicLab.Hive services")]
    109[assembly: AssemblyConfiguration("")]
    1110[assembly: AssemblyCompany("Microsoft")]
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs

    r6372 r6431  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Services.Hive.Common;
     26using HeuristicLab.Services.Hive.Common.DataTransfer;
     27using HeuristicLab.Services.Hive.Common.ServiceContracts;
    2528using Microsoft.VisualStudio.TestTools.UnitTesting;
     29using DT = HeuristicLab.Services.Hive.Common.DataTransfer;
    2630
    2731namespace HeuristicLab.Services.Hive.Tests {
    28 
    29   using HeuristicLab.Services.Hive.Common;
    30   using HeuristicLab.Services.Hive.Common.DataTransfer;
    31   using HeuristicLab.Services.Hive.Common.ServiceContracts;
    32   using DT = HeuristicLab.Services.Hive.Common.DataTransfer;
    33 
    3432  [TestClass]
    3533  public class ServiceTests {
     
    7371      plugin1.Version = new Version("1.0.0.0");
    7472      plugin1.UserId = Guid.Empty;
    75       plugin1.IsLocal = true;
    7673      plugin1.DateCreated = DateTime.Now;
    7774
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeartbeatManager.cs

    r6369 r6431  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324using System.Linq;
     
    930    private DataAccess.IHiveDao dao {
    1031      get { return ServiceLocator.Instance.HiveDao; }
    11     }
    12     private HeuristicLab.Services.Hive.DataAccess.TransactionManager trans {
    13       get { return ServiceLocator.Instance.TransactionManager; }
    1432    }
    1533    private IAuthorizationManager auth {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeuristicLabServicesHivePlugin.cs.frame

    r6369 r6431  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324using System.Linq;
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs

    r6426 r6431  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324using System.Linq;
     
    627using HeuristicLab.Services.Hive.Common.DataTransfer;
    728using HeuristicLab.Services.Hive.Common.ServiceContracts;
     29using DA = HeuristicLab.Services.Hive.DataAccess;
    830
    931namespace HeuristicLab.Services.Hive {
     
    1840      get { return ServiceLocator.Instance.HiveDao; }
    1941    }
    20     private HeuristicLab.Services.Hive.DataAccess.TransactionManager trans {
    21       get { return ServiceLocator.Instance.TransactionManager; }
    22     }
    2342    private IAuthenticationManager authen {
    2443      get { return ServiceLocator.Instance.AuthenticationManager; }
     
    3756    public Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> resourceIds) {
    3857      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    39       return trans.UseTransaction(() => {
     58      return DA.TransactionManager.UseTransaction(() => {
    4059        job.Id = dao.AddJob(job);
    4160        jobData.JobId = job.Id;
     
    5271    public Guid AddChildJob(Guid parentJobId, Job job, JobData jobData) {
    5372      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    54       return trans.UseTransaction(() => {
     73      return DA.TransactionManager.UseTransaction(() => {
    5574        job.ParentJobId = parentJobId;
    5675        return AddJob(job, jobData, dao.GetAssignedResources(parentJobId).Select(x => x.Id));
     
    90109    public void UpdateJob(Job job) {
    91110      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
    92       trans.UseTransaction(() => {
     111      DA.TransactionManager.UseTransaction(() => {
    93112        dao.UpdateJob(job);
    94113      });
     
    97116    public void UpdateJobData(Job job, JobData jobData) {
    98117      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
    99       //trans.UseTransaction(() => { // cneumuel: try without transaction
     118      //DA.TransactionManager.UseTransaction(() => { // cneumuel: try without transaction
    100119      jobData.LastUpdate = DateTime.Now;
    101120      dao.UpdateJob(job);
     
    106125    public void DeleteJob(Guid jobId) {
    107126      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
    108       trans.UseTransaction(() => {
     127      DA.TransactionManager.UseTransaction(() => {
    109128        dao.DeleteJob(jobId);
    110129      });
     
    113132    public void DeleteChildJobs(Guid parentJobId) {
    114133      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
    115       trans.UseTransaction(() => {
     134      DA.TransactionManager.UseTransaction(() => {
    116135        var jobs = GetChildJobs(parentJobId, true, false);
    117136        foreach (var job in jobs) {
     
    124143    public Job UpdateJobState(Guid jobId, JobState jobState, Guid? slaveId, Guid? userId, string exception) {
    125144      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
    126       return trans.UseTransaction(() => {
     145      return DA.TransactionManager.UseTransaction(() => {
    127146        Job job = dao.UpdateJobState(jobId, jobState, slaveId, userId, exception);
    128147
     
    147166    public void StopJob(Guid jobId) {
    148167      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
    149       trans.UseTransaction(() => {
     168      DA.TransactionManager.UseTransaction(() => {
    150169        var job = dao.GetJob(jobId);
    151170        if (job.State == JobState.Calculating || job.State == JobState.Transferring) {
     
    162181    public void PauseJob(Guid jobId) {
    163182      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
    164       trans.UseTransaction(() => {
     183      DA.TransactionManager.UseTransaction(() => {
    165184        var job = dao.GetJob(jobId);
    166185        if (job.State == JobState.Calculating || job.State == JobState.Transferring) {
     
    175194    public void RestartJob(Guid jobId) {
    176195      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
    177       trans.UseTransaction(() => {
     196      DA.TransactionManager.UseTransaction(() => {
    178197        Job job = dao.UpdateJobState(jobId, JobState.Waiting, null, author.UserId, string.Empty);
    179198        job.Command = null;
     
    204223    public Guid AddHiveExperiment(HiveExperiment hiveExperimentDto) {
    205224      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    206       return trans.UseTransaction(() => {
     225      return DA.TransactionManager.UseTransaction(() => {
    207226        hiveExperimentDto.OwnerUserId = author.UserId;
    208227        hiveExperimentDto.DateCreated = DateTime.Now;
     
    213232    public void UpdateHiveExperiment(HiveExperiment hiveExperimentDto) {
    214233      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    215       trans.UseTransaction(() => {
     234      DA.TransactionManager.UseTransaction(() => {
    216235        dao.UpdateHiveExperiment(hiveExperimentDto);
    217236      });
     
    220239    public void DeleteHiveExperiment(Guid hiveExperimentId) {
    221240      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    222       trans.UseTransaction(() => {
     241      DA.TransactionManager.UseTransaction(() => {
    223242        HiveExperiment he = dao.GetHiveExperiment(hiveExperimentId);
    224243        dao.DeleteHiveExperiment(hiveExperimentId); // child jobs will be deleted by db-trigger
     
    230249    public void Hello(Slave slaveInfo) {
    231250      authen.AuthenticateForAnyRole(HiveRoles.Slave);
    232       trans.UseTransaction(() => {
     251      DA.TransactionManager.UseTransaction(() => {
    233252        var slave = dao.GetSlave(slaveInfo.Id);
    234253
     
    261280    public void GoodBye(Guid slaveId) {
    262281      authen.AuthenticateForAnyRole(HiveRoles.Slave);
    263       trans.UseTransaction(() => {
     282      DA.TransactionManager.UseTransaction(() => {
    264283        var slave = dao.GetSlave(slaveId);
    265284        if (slave != null) {
     
    275294      authen.AuthenticateForAnyRole(HiveRoles.Slave);
    276295      TriggerLifecycle(false);
    277       return trans.UseTransaction(() => heartbeatManager.ProcessHeartbeat(heartbeat));
     296      return DA.TransactionManager.UseTransaction(() => heartbeatManager.ProcessHeartbeat(heartbeat));
    278297    }
    279298    #endregion
     
    282301    public Guid AddPlugin(Plugin plugin, List<PluginData> pluginDatas) {
    283302      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    284       return trans.UseTransaction(() => {
     303      return DA.TransactionManager.UseTransaction(() => {
    285304        plugin.UserId = author.UserId;
    286305        plugin.DateCreated = DateTime.Now;
     
    315334      List<PluginData> pluginDatas = new List<PluginData>();
    316335
    317       return trans.UseTransaction(() => {
     336      return DA.TransactionManager.UseTransaction(() => {
    318337        foreach (Guid guid in pluginIds) {
    319338          pluginDatas.AddRange(dao.GetPluginDatas(x => x.PluginId == guid).ToList());
     
    328347    public Guid AddSlave(Slave slave) {
    329348      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    330       return trans.UseTransaction(() => dao.AddSlave(slave));
     349      return DA.TransactionManager.UseTransaction(() => dao.AddSlave(slave));
    331350    }
    332351
    333352    public Guid AddSlaveGroup(SlaveGroup slaveGroup) {
    334353      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    335       return trans.UseTransaction(() => dao.AddSlaveGroup(slaveGroup));
     354      return DA.TransactionManager.UseTransaction(() => dao.AddSlaveGroup(slaveGroup));
    336355    }
    337356
     
    358377    public void UpdateSlave(Slave slave) {
    359378      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    360       trans.UseTransaction(() => {
     379      DA.TransactionManager.UseTransaction(() => {
    361380        dao.UpdateSlave(slave);
    362381      });
     
    365384    public void UpdateSlaveGroup(SlaveGroup slaveGroup) {
    366385      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    367       trans.UseTransaction(() => {
     386      DA.TransactionManager.UseTransaction(() => {
    368387        dao.UpdateSlaveGroup(slaveGroup);
    369388      });
     
    372391    public void DeleteSlave(Guid slaveId) {
    373392      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    374       trans.UseTransaction(() => {
     393      DA.TransactionManager.UseTransaction(() => {
    375394        dao.DeleteSlave(slaveId);
    376395      });
     
    379398    public void DeleteSlaveGroup(Guid slaveGroupId) {
    380399      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    381       trans.UseTransaction(() => {
     400      DA.TransactionManager.UseTransaction(() => {
    382401        dao.DeleteSlaveGroup(slaveGroupId);
    383402      });
     
    386405    public void AddResourceToGroup(Guid slaveGroupId, Guid resourceId) {
    387406      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    388       trans.UseTransaction(() => {
     407      DA.TransactionManager.UseTransaction(() => {
    389408        var resource = dao.GetResource(resourceId);
    390409        resource.ParentResourceId = slaveGroupId;
     
    395414    public void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId) {
    396415      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    397       trans.UseTransaction(() => {
     416      DA.TransactionManager.UseTransaction(() => {
    398417        var resource = dao.GetResource(resourceId);
    399418        resource.ParentResourceId = null;
     
    404423    public Guid GetResourceId(string resourceName) {
    405424      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    406       return trans.UseTransaction(() => {
     425      return DA.TransactionManager.UseTransaction(() => {
    407426        var resource = dao.GetResources(x => x.Name == resourceName).FirstOrDefault();
    408427        if (resource != null) {
     
    416435    public void TriggerLifecycle(bool force) {
    417436      // use a serializable transaction here to ensure not two threads execute this simultaniously (mutex-lock would not work since IIS may use multiple AppDomains)
    418       trans.UseTransaction(() => {
     437      DA.TransactionManager.UseTransaction(() => {
    419438        DateTime lastCleanup = dao.GetLastCleanup();
    420439        if (force || DateTime.Now - lastCleanup > TimeSpan.FromSeconds(59)) {
     
    446465    public Guid AddAppointment(Appointment appointment) {
    447466      authen.AuthenticateForAnyRole(HiveRoles.Administrator);
    448       return trans.UseTransaction(() => dao.AddAppointment(appointment));
     467      return DA.TransactionManager.UseTransaction(() => dao.AddAppointment(appointment));
    449468    }
    450469
    451470    public void DeleteAppointment(Guid appointmentId) {
    452471      authen.AuthenticateForAnyRole(HiveRoles.Administrator);
    453       trans.UseTransaction(() => {
     472      DA.TransactionManager.UseTransaction(() => {
    454473        dao.DeleteAppointment(appointmentId);
    455474      });
     
    458477    public void UpdateAppointment(Appointment appointment) {
    459478      authen.AuthenticateForAnyRole(HiveRoles.Administrator);
    460       trans.UseTransaction(() => {
     479      DA.TransactionManager.UseTransaction(() => {
    461480        dao.UpdateAppointment(appointment);
    462481      });
     
    465484    public IEnumerable<Appointment> GetScheduleForResource(Guid resourceId) {
    466485      authen.AuthenticateForAnyRole(HiveRoles.Administrator);
    467       return trans.UseTransaction(() => dao.GetAppointments(x => x.ResourceId == resourceId));
     486      return DA.TransactionManager.UseTransaction(() => dao.GetAppointments(x => x.ResourceId == resourceId));
    468487    }
    469488
    470489    public IEnumerable<Job> GetJobsByResourceId(Guid resourceId) {
    471490      authen.AuthenticateForAnyRole(HiveRoles.Administrator);
    472       return trans.UseTransaction(() => dao.GetJobsByResourceId(resourceId));
     491      return DA.TransactionManager.UseTransaction(() => dao.GetJobsByResourceId(resourceId));
    473492    }
    474493    #endregion
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/IServiceLocator.cs

    r6369 r6431  
    2828    IHiveDao HiveDao { get; }
    2929    ILifecycleManager LifecycleManager { get; }
    30     TransactionManager TransactionManager { get; }
    3130    HeartbeatManager HeartbeatManager { get; }
    3231  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/LifecycleManager.cs

    r6367 r6431  
    3333    private DataAccess.IHiveDao dao {
    3434      get { return ServiceLocator.Instance.HiveDao; }
    35     }
    36     private HeuristicLab.Services.Hive.DataAccess.TransactionManager trans {
    37       get { return ServiceLocator.Instance.TransactionManager; }
    3835    }
    3936    private IAuthorizationManager auth {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Properties/AssemblyInfo.cs.frame

    r6372 r6431  
    77// associated with an assembly.
    88[assembly: AssemblyTitle("HeuristicLab.Services.Hive")]
    9 [assembly: AssemblyDescription("")]
     9[assembly: AssemblyDescription("Business logic for HeuristicLab.Hive services")]
    1010[assembly: AssemblyConfiguration("")]
    1111[assembly: AssemblyCompany("")]
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/ServiceLocator.cs

    r6362 r6431  
    1 using HeuristicLab.Services.Hive.DataAccess;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using HeuristicLab.Services.Hive.DataAccess;
    223
    324namespace HeuristicLab.Services.Hive {
     
    1839        if (hiveDao == null) hiveDao = new HiveDao();
    1940        return hiveDao;
    20       }
    21     }
    22    
    23     private TransactionManager transactionManager;
    24     public TransactionManager TransactionManager {
    25       get {
    26         if (transactionManager == null) transactionManager = new TransactionManager();
    27         return transactionManager;
    2841      }
    2942    }
Note: See TracChangeset for help on using the changeset viewer.