Free cookie consent management tool by TermsFeed Policy Generator

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

#1233

  • added various bits to the Hive Server
  • adjusted data model
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.