Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5375


Ignore:
Timestamp:
01/25/11 17:34:47 (13 years ago)
Author:
ascheibe
Message:

#1233

  • added various bits to the Hive Server
  • adjusted data model
Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4/HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4.csproj

    r5158 r5375  
    7878  </ItemGroup>
    7979  <ItemGroup>
    80     <None Include="app.config" />
     80    <None Include="app.config">
     81      <SubType>Designer</SubType>
     82    </None>
    8183  </ItemGroup>
    8284  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4/Program.cs

    r5314 r5375  
    2222using System;
    2323using System.Threading;
    24 using HeuristicLab.Clients.Hive.Slave;
    2524using HeuristicLab.Clients.Hive.Slave.Tests;
    2625
     
    3029    static void Main(string[] args) {
    3130      //mock the hive service for testing purposes
    32       ServiceLocator.Instance = new MockServiceLocator();
     31      //ServiceLocator.Instance = new MockServiceLocator();
     32
    3333      //slave part
    3434      Core core = new Core();
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4/app.config

    r5280 r5375  
    2323
    2424   <client>
    25     <endpoint address="http://localhost:9000/Hive-3.4"
     25     <!--http://localhost:9000/Hive-3.4-->
     26    <endpoint address="http://localhost:80/Service.svc"
    2627              binding="wsHttpBinding"
    2728              bindingConfiguration="wsHttpBinding"
    2829              contract="HeuristicLab.Services.Hive.Common.ServiceContracts.IHiveService"
    2930              name="wsHttpBinding_IHiveService">
    30       <identity>
    31         <certificate encodedValue="AwAAAAEAAAAUAAAAfEKvcVixnJay+q4hCPFuO0JL5TQgAAAAAQAAAPIBAAAwggHuMIIBW6ADAgECAhCNN5wrUcXMmE/9xwp4TYa9MAkGBSsOAwIdBQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEwMTAxOTEwNTMxNVoXDTM5MTIzMTIzNTk1OVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXwC5TGcAffd/0oAWHtm0s6YXVXEgXgb1AYmBkkkhkKIFJG/e/Z0KSYbJepmSJD44W3oOAVm+x1DAsZxU79HahDYgWCuHLMm1TLpwSmYOQ0kV3pGHWHhiWV7h7oGLds/eqZ2EOpaNGryfEPnrA4VmxY91vV5/2BTeVSWG6F8lRKQIDAQABo0kwRzBFBgNVHQEEPjA8gBAR7kBnMRHO5gzThEqda0wWoRYwFDESMBAGA1UEAxMJbG9jYWxob3N0ghCNN5wrUcXMmE/9xwp4TYa9MAkGBSsOAwIdBQADgYEAoPwEG4QTDXhlxERNDfsZmM2IhEpV42ppz1kEah2oYKDa/ElIMVtvqLv6flVtg18ENN/mEJWiHZ3NyP3qr2Pip+sh+/2WBiSbOaukES/CM7OJn9kJCImH7M/xqM8pxqY8IfgM6iBVrVj9uHqj3j2BBck+cYY8fKyh3CFifMIp6ac="/>
    32       </identity>
     31              <identity>
     32                <certificate encodedValue="AwAAAAEAAAAUAAAAiQt8DnyaI8rYHhLNyW62i58+eG8gAAAAAQAAAPIBAAAwggHuMIIBW6ADAgECAhAFNFYz6Srdmk3PZJ/mka5sMAkGBSsOAwIdBQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEwMTIwNjE0MTc0M1oXDTM5MTIzMTIzNTk1OVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCueTMWJzOZ1IBacG40aWdr3qDWijEO4VwhgtNr+WNFsRG+qW2rTZZFtaC0U028aj3MX13mr+pzpcPJMes2rr38PuxhN6BhdzgRfyEy/eHk4iKqZztuJSXgNAyfyjhovTchLitT2lilddTRFj2PlLYv+PUu+QhQNTm2iW4UDljS9wIDAQABo0kwRzBFBgNVHQEEPjA8gBBeipmIklE3kPz7i+AdKqAgoRYwFDESMBAGA1UEAxMJbG9jYWxob3N0ghAFNFYz6Srdmk3PZJ/mka5sMAkGBSsOAwIdBQADgYEAGnxEaFT8QKKk1DtJ8/+TOBxSo0UkBlNiTY0HKkA3w/2DOPZKybhslm8gqJic8ZPsk5YgEibrdQqB0AnNG983RAlFqgGvsAbQAMXTDJ5GoTgHaxk/T+7a7Sk4xJALUL/vWuPGbA354RVoKA4gV3gJzU+Fj3/fLACf0+D/nR9B5nw=" />
     33              </identity>
     34
    3335    </endpoint>
    3436   </client>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Tests/Mocks/MockHiveService.cs

    r5266 r5375  
    219219    }
    220220
    221     public void GoodBye() {
    222       // do nothing
     221    public void GoodBye(Guid id) {
     222      // do nothing     
    223223    }
    224224
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/HeartbeatManager.cs

    r5314 r5375  
    9191
    9292              Heartbeat heartBeatData = new Heartbeat {
    93                 SlaveId = info.Id,
     93                SlaveId = info.Id, /*Settings.Default.Guid*/
    9494                FreeCores = info.Cores.HasValue ? info.Cores.Value - ConfigManager.Instance.GetUsedCores() : 0,
    9595                FreeMemory = GetFreeMemory(),
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/WcfService.cs

    r5314 r5375  
    7979          ConnState = NetworkEnum.WcfConnState.Connected;
    8080          ConnectedSince = DateTime.Now;
    81           service.Obj.Hello(Settings.Default.Guid, slaveInfo.Name, slaveInfo.Cores.Value, slaveInfo.Memory.Value);
     81          service.Obj.Hello(slaveInfo.Id/*Settings.Default.Guid*/, slaveInfo.Name, slaveInfo.Cores.Value, slaveInfo.Memory.Value);
    8282          OnConnected();
    8383        }
     
    9494      using (Disposable<IHiveService> service = ServiceLocator.Instance.GetService()) {
    9595        try {
    96           service.Obj.GoodBye();
     96          service.Obj.GoodBye(ConfigManager.Instance.GetClientInfo().Id);
    9797          ConnState = NetworkEnum.WcfConnState.Disconnected;
    9898        }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceLocator.cs

    r5055 r5375  
    2020#endregion
    2121
     22using HeuristicLab.Clients.Common;
    2223using HeuristicLab.Services.Hive.Common.ServiceContracts;
    23 using HeuristicLab.Clients.Hive.Properties;
    24 using HeuristicLab.Clients.Common;
    2524
    2625namespace HeuristicLab.Clients.Hive {
     
    4039
    4140    public Disposable<IHiveService> GetService() {
    42         return ClientFactory.CreateClient<IHiveService>("wsHttpBinding_IHiveService");
     41      //TODO: move user config to app.config!
     42      return ClientFactory.CreateClient<IHiveService>("wsHttpBinding_IHiveService", null, "ascheibe", "ascheibe$4");
    4343    }
    4444  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Hive 3.4.sln

    r5364 r5375  
    4949    Release.AspNetCompiler.FixedNames = "false"
    5050    Release.AspNetCompiler.Debug = "False"
    51     VWDPort = "49227"
     51    VWDPort = "49885"
    5252    DefaultWebSiteLanguage = "Visual C#"
    5353  EndProjectSection
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/PluginData.cs

    r5266 r5375  
    2929  public class PluginData : HiveItemBase {
    3030    [DataMember]
     31    public int PluginDataId { get; set; }
     32    [DataMember]
    3133    public Guid PluginId { get; set; }
    3234    [DataMember]
     
    4345      Array.Copy(original.Data, this.Data, original.Data.Length);
    4446      this.FileName = original.FileName;
     47      this.PluginDataId = original.PluginDataId;
     48      this.PluginId = original.PluginId;
    4549    }
    4650    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ServiceContracts/IHiveService.cs

    r5155 r5375  
    11using System;
    22using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
     3using System.Net.Security;
    54using System.ServiceModel;
    6 using System.IO;
    75using HeuristicLab.Services.Hive.Common.DataTransfer;
    8 using System.Net.Security;
    96
    107namespace HeuristicLab.Services.Hive.Common.ServiceContracts {
     
    8582
    8683    [OperationContract]
    87     void GoodBye();
     84    void GoodBye(Guid slaveId);
    8885    #endregion
    8986
     
    10198    IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds);
    10299    #endregion
    103    
     100
    104101    #region Slave Methods
    105102    [OperationContract]
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs

    r5266 r5375  
    126126    public static DT.PluginData ToDto(PluginData source) {
    127127      if (source == null) return null;
    128       return new DT.PluginData { PluginId = source.PluginId, Data = source.Data.ToArray(), FileName = source.FileName };
     128      return new DT.PluginData { PluginId = source.PluginId, Data = source.Data.ToArray(), FileName = source.FileName, PluginDataId = source.PluginDataId };
    129129    }
    130130    public static PluginData ToEntity(DT.PluginData source) {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs

    r5156 r5375  
    9090                    orderby ar.Job.Priority descending
    9191                    select Convert.ToDto(ar.Job);
    92         return query;
     92        return query.ToArray();
    9393      }
    9494    }
     
    100100                    orderby j.Priority descending
    101101                    select Convert.ToDto(j);
    102         return query.Union(GetWaitingParentJobs(slave.Id)).OrderByDescending(x => x.Priority).ToArray();
     102        var waitingJobs = query.ToArray();
     103        var waitingParentJobs = GetWaitingParentJobs(slave.Id);
     104        return waitingJobs.Union(waitingParentJobs).OrderByDescending(x => x.Priority);
    103105      }
    104106    }
     
    322324    public Guid AddSlaveGroup(DT.SlaveGroup dto) {
    323325      using (var db = CreateContext()) {
     326        if (dto.Id == Guid.Empty)
     327          dto.Id = Guid.NewGuid();
    324328        var entity = Convert.ToEntity(dto);
    325329        db.Resources.InsertOnSubmit(entity);
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml

    r5266 r5375  
    1515      <Column Name="Version" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" />
    1616      <Association Name="Plugin_RequiredPlugin" Member="RequiredPlugins" ThisKey="PluginId" OtherKey="PluginId" Type="RequiredPlugin" />
    17       <Association Name="Plugin_PluginData" Member="PluginData" ThisKey="PluginId" OtherKey="PluginId" Type="PluginData" Cardinality="One" />
     17      <Association Name="Plugin_PluginData" Member="PluginData" ThisKey="PluginId" OtherKey="PluginId" Type="PluginData" />
    1818    </Type>
    1919  </Table>
     
    2929  <Table Name="dbo.Resource" Member="Resources">
    3030    <Type Name="Resource" InheritanceCode="RESOURCE">
    31       <Column Name="ResourceId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
     31      <Column Name="ResourceId" AutoSync="OnInsert" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    3232      <Column Name="Name" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" />
    3333      <Column Name="ResourceType" Type="System.String" CanBeNull="false" IsDiscriminator="true" />
     
    112112      <Column Name="Data" Type="System.Data.Linq.Binary" DbType="VarBinary(MAX) NOT NULL" CanBeNull="false" UpdateCheck="Never" />
    113113      <Column Name="FileName" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" />
     114      <Column Name="PluginDataId" Type="System.Int32" DbType="Int IDENTITY(1,1)" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
    114115      <Association Name="Plugin_PluginData" Member="Plugin" ThisKey="PluginId" OtherKey="PluginId" Type="Plugin" IsForeignKey="true" />
    115116    </Type>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout

    r5266 r5375  
    124124      </nestedChildShapes>
    125125    </classShape>
    126     <classShape Id="ad25bd0f-80e8-4a06-abd8-190eb678eec7" absoluteBounds="11.375, 5.5, 2, 1.3862939453124996">
     126    <classShape Id="ad25bd0f-80e8-4a06-abd8-190eb678eec7" absoluteBounds="11.625, 5.5, 2, 1.5785953776041666">
    127127      <DataClassMoniker Name="/HiveDataContext/PluginData" />
    128128      <nestedChildShapes>
    129         <elementListCompartment Id="acddb513-7de6-4bb4-8335-d6982fb2ef35" absoluteBounds="11.39, 5.9600000000000009, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     129        <elementListCompartment Id="acddb513-7de6-4bb4-8335-d6982fb2ef35" absoluteBounds="11.64, 5.9600000000000009, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    130130      </nestedChildShapes>
    131131    </classShape>
    132     <associationConnector edgePoints="[(11 : 6.19314697265625); (11.375 : 6.19314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     132    <associationConnector edgePoints="[(11 : 6.19314697265625); (11.625 : 6.19314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    133133      <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_PluginData" />
    134134      <nodes>
     
    137137      </nodes>
    138138    </associationConnector>
    139     <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     139    <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    140140      <AssociationMoniker Name="/HiveDataContext/Job/Job_JobData" />
    141141      <nodes>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs

    r5266 r5375  
    5555    partial void UpdateJobData(JobData instance);
    5656    partial void DeleteJobData(JobData instance);
     57    partial void InsertPluginData(PluginData instance);
     58    partial void UpdatePluginData(PluginData instance);
     59    partial void DeletePluginData(PluginData instance);
    5760    #endregion
    5861   
     
    360363    private EntitySet<RequiredPlugin> _RequiredPlugins;
    361364   
     365    private EntitySet<PluginData> _PluginData;
     366   
    362367    #region Extensibility Method Definitions
    363368    partial void OnLoaded();
     
    375380    {
    376381      this._RequiredPlugins = new EntitySet<RequiredPlugin>(new Action<RequiredPlugin>(this.attach_RequiredPlugins), new Action<RequiredPlugin>(this.detach_RequiredPlugins));
     382      this._PluginData = new EntitySet<PluginData>(new Action<PluginData>(this.attach_PluginData), new Action<PluginData>(this.detach_PluginData));
    377383      OnCreated();
    378384    }
     
    451457    }
    452458   
     459    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Plugin_PluginData", Storage="_PluginData", ThisKey="PluginId", OtherKey="PluginId")]
     460    public EntitySet<PluginData> PluginData
     461    {
     462      get
     463      {
     464        return this._PluginData;
     465      }
     466      set
     467      {
     468        this._PluginData.Assign(value);
     469      }
     470    }
     471   
    453472    public event PropertyChangingEventHandler PropertyChanging;
    454473   
     
    478497   
    479498    private void detach_RequiredPlugins(RequiredPlugin entity)
     499    {
     500      this.SendPropertyChanging();
     501      entity.Plugin = null;
     502    }
     503   
     504    private void attach_PluginData(PluginData entity)
     505    {
     506      this.SendPropertyChanging();
     507      entity.Plugin = this;
     508    }
     509   
     510    private void detach_PluginData(PluginData entity)
    480511    {
    481512      this.SendPropertyChanging();
     
    724755    }
    725756   
    726     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
     757    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
    727758    public System.Guid ResourceId
    728759    {
     
    23862417 
    23872418  [global::System.Data.Linq.Mapping.TableAttribute(Name="")]
    2388   public partial class PluginData
     2419  public partial class PluginData : INotifyPropertyChanging, INotifyPropertyChanged
    23892420  {
    23902421   
     2422    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
     2423   
    23912424    private System.Guid _PluginId;
    23922425   
     
    23952428    private string _FileName;
    23962429   
     2430    private int _PluginDataId;
     2431   
     2432    private EntityRef<Plugin> _Plugin;
     2433   
     2434    #region Extensibility Method Definitions
     2435    partial void OnLoaded();
     2436    partial void OnValidate(System.Data.Linq.ChangeAction action);
     2437    partial void OnCreated();
     2438    partial void OnPluginIdChanging(System.Guid value);
     2439    partial void OnPluginIdChanged();
     2440    partial void OnDataChanging(System.Data.Linq.Binary value);
     2441    partial void OnDataChanged();
     2442    partial void OnFileNameChanging(string value);
     2443    partial void OnFileNameChanged();
     2444    partial void OnPluginDataIdChanging(int value);
     2445    partial void OnPluginDataIdChanged();
     2446    #endregion
     2447   
    23972448    public PluginData()
    23982449    {
     2450      this._Plugin = default(EntityRef<Plugin>);
     2451      OnCreated();
    23992452    }
    24002453   
     
    24102463        if ((this._PluginId != value))
    24112464        {
     2465          if (this._Plugin.HasLoadedOrAssignedValue)
     2466          {
     2467            throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
     2468          }
     2469          this.OnPluginIdChanging(value);
     2470          this.SendPropertyChanging();
    24122471          this._PluginId = value;
     2472          this.SendPropertyChanged("PluginId");
     2473          this.OnPluginIdChanged();
    24132474        }
    24142475      }
     
    24262487        if ((this._Data != value))
    24272488        {
     2489          this.OnDataChanging(value);
     2490          this.SendPropertyChanging();
    24282491          this._Data = value;
     2492          this.SendPropertyChanged("Data");
     2493          this.OnDataChanged();
    24292494        }
    24302495      }
     
    24422507        if ((this._FileName != value))
    24432508        {
     2509          this.OnFileNameChanging(value);
     2510          this.SendPropertyChanging();
    24442511          this._FileName = value;
    2445         }
     2512          this.SendPropertyChanged("FileName");
     2513          this.OnFileNameChanged();
     2514        }
     2515      }
     2516    }
     2517   
     2518    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PluginDataId", AutoSync=AutoSync.OnInsert, DbType="Int IDENTITY(1,1)", IsPrimaryKey=true, IsDbGenerated=true)]
     2519    public int PluginDataId
     2520    {
     2521      get
     2522      {
     2523        return this._PluginDataId;
     2524      }
     2525      set
     2526      {
     2527        if ((this._PluginDataId != value))
     2528        {
     2529          this.OnPluginDataIdChanging(value);
     2530          this.SendPropertyChanging();
     2531          this._PluginDataId = value;
     2532          this.SendPropertyChanged("PluginDataId");
     2533          this.OnPluginDataIdChanged();
     2534        }
     2535      }
     2536    }
     2537   
     2538    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Plugin_PluginData", Storage="_Plugin", ThisKey="PluginId", OtherKey="PluginId", IsForeignKey=true)]
     2539    public Plugin Plugin
     2540    {
     2541      get
     2542      {
     2543        return this._Plugin.Entity;
     2544      }
     2545      set
     2546      {
     2547        Plugin previousValue = this._Plugin.Entity;
     2548        if (((previousValue != value)
     2549              || (this._Plugin.HasLoadedOrAssignedValue == false)))
     2550        {
     2551          this.SendPropertyChanging();
     2552          if ((previousValue != null))
     2553          {
     2554            this._Plugin.Entity = null;
     2555            previousValue.PluginData.Remove(this);
     2556          }
     2557          this._Plugin.Entity = value;
     2558          if ((value != null))
     2559          {
     2560            value.PluginData.Add(this);
     2561            this._PluginId = value.PluginId;
     2562          }
     2563          else
     2564          {
     2565            this._PluginId = default(System.Guid);
     2566          }
     2567          this.SendPropertyChanged("Plugin");
     2568        }
     2569      }
     2570    }
     2571   
     2572    public event PropertyChangingEventHandler PropertyChanging;
     2573   
     2574    public event PropertyChangedEventHandler PropertyChanged;
     2575   
     2576    protected virtual void SendPropertyChanging()
     2577    {
     2578      if ((this.PropertyChanging != null))
     2579      {
     2580        this.PropertyChanging(this, emptyChangingEventArgs);
     2581      }
     2582    }
     2583   
     2584    protected virtual void SendPropertyChanged(String propertyName)
     2585    {
     2586      if ((this.PropertyChanged != null))
     2587      {
     2588        this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    24462589      }
    24472590    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Web/Hive-3.4/App_Code/HiveServerModule.cs

    r5364 r5375  
    3535
    3636    public void Init(HttpApplication context) {
    37       if (hiveService == null)
    38         hiveService = new HiveService();
    39 
    4037      if (lifecycleManager == null)
    4138        lifecycleManager = new LifecycleManager();
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs

    r5155 r5375  
    22using System.Collections.Generic;
    33using System.Linq;
    4 using System.Text;
    54using System.ServiceModel;
     5using HeuristicLab.Services.Hive.Common;
     6using HeuristicLab.Services.Hive.Common.DataTransfer;
    67using HeuristicLab.Services.Hive.Common.ServiceContracts;
    7 using HeuristicLab.Services.Hive.Common.DataTransfer;
    8 using System.IO;
    9 using System.Security.Permissions;
    10 using System.Data.Linq;
    11 using HeuristicLab.Services.Hive.Common;
    12 using System.Transactions;
    138
    149namespace HeuristicLab.Services.Hive {
     
    121116
    122117    public PluginData GetConfigurationFile() {
    123       throw new NotImplementedException();
     118      using (trans.OpenTransaction()) {
     119        //TODO: move filename to app.config
     120        PluginData configFile = dao.GetPluginDatas(x => x.FileName == "HeuristicLab 3.3.exe.config").SingleOrDefault();
     121        if (configFile == null) {
     122          //TODO: error handling
     123          return null;
     124        } else {
     125          return configFile;
     126        }
     127      }
    124128    }
    125129
     
    173177    #region Login Methods
    174178    public void Hello(Guid slaveId, string name, int cores, int memory) {
    175       throw new NotImplementedException();
    176     }
    177 
    178     public void GoodBye() {
    179       throw new NotImplementedException();
     179      using (trans.OpenTransaction()) {
     180        var slave = dao.GetSlave(slaveId);
     181
     182        if (slave == null) {
     183          slave = new Slave { Id = slaveId, Name = name, Cores = cores, Memory = memory };
     184          slave.IsAllowedToCalculate = true; //a little bit to optimistic?
     185          slave.SlaveState = SlaveState.Idle;
     186          dao.AddSlave(slave);
     187        } else {
     188          //TODO: error handling?
     189        }
     190      }
     191    }
     192
     193    public void GoodBye(Guid slaveId) {
     194      using (trans.OpenTransaction()) {
     195        var slave = dao.GetSlave(slaveId);
     196        if (slave != null) {
     197          slave.SlaveState = SlaveState.Offline;
     198          dao.UpdateSlave(slave);
     199        }
     200      }
    180201    }
    181202    #endregion
     
    203224      return dao.GetPlugins(x => true);
    204225    }
     226
    205227    public IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds) {
    206       throw new NotImplementedException();
    207     }
    208     public Stream GetStreamedPluginDatas(List<Guid> pluginIds) {
    209       throw new NotImplementedException();
    210     }
     228      List<PluginData> pluginDatas = new List<PluginData>();
     229
     230      using (trans.OpenTransaction()) {
     231        foreach (Guid guid in pluginIds) {
     232          List<PluginData> pluginData = dao.GetPluginDatas(x => x.PluginId == guid).ToList();
     233          if (pluginData != null) {
     234            pluginDatas.AddRange(pluginData);
     235          } else {
     236            //ignore ?
     237          }
     238        }
     239        return pluginDatas;
     240      }
     241    }
     242
    211243    #endregion
    212244
     
    301333
    302334    #endregion
    303  
     335
    304336  }
    305337}
Note: See TracChangeset for help on using the changeset viewer.