- Timestamp:
- 01/25/11 17:34:47 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs
r5155 r5375 2 2 using System.Collections.Generic; 3 3 using System.Linq; 4 using System.Text;5 4 using System.ServiceModel; 5 using HeuristicLab.Services.Hive.Common; 6 using HeuristicLab.Services.Hive.Common.DataTransfer; 6 7 using 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;13 8 14 9 namespace HeuristicLab.Services.Hive { … … 121 116 122 117 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 } 124 128 } 125 129 … … 173 177 #region Login Methods 174 178 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 } 180 201 } 181 202 #endregion … … 203 224 return dao.GetPlugins(x => true); 204 225 } 226 205 227 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 211 243 #endregion 212 244 … … 301 333 302 334 #endregion 303 335 304 336 } 305 337 }
Note: See TracChangeset
for help on using the changeset viewer.