Changeset 9362
- Timestamp:
- 04/16/13 08:57:22 (12 years ago)
- Location:
- branches/OaaS
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Azure/DAL.cs
r9324 r9362 17 17 public static readonly string EXPERIMENT_TABLE = "Experiment"; 18 18 public static readonly string EXPERIMENT_BLOB_CONTAINER = "experiment"; 19 public static readonly string VISUAL_BLOB_CONTAINER = "visualextensions"; 19 20 public static readonly string CLOUD_SETTINGS_KEY = "Cloudia.WindowsAzure.Storage"; 20 21 … … 289 290 return AlgorithmConverter.ConvertJsonToExperiment(blob.DownloadText()); 290 291 } 291 292 } 293 294 public class VisualExtensionDao : IVisualExtensionDao { 295 public CloudBlobClient BlobClient { get; set; } 296 297 public bool Add(string algorithmId, string script) { 298 CloudBlobContainer container = BlobClient.GetContainerReference(AzureConstants.VISUAL_BLOB_CONTAINER); 299 container.CreateIfNotExist(); 300 var blob = container.GetBlobReference(algorithmId); 301 blob.UploadText(script); 302 return true; 303 } 304 305 public bool DeleteById(string algorithmId) { 306 CloudBlobContainer container = BlobClient.GetContainerReference(AzureConstants.VISUAL_BLOB_CONTAINER); 307 container.CreateIfNotExist(); 308 var blob = container.GetBlobReference(algorithmId); 309 return blob.DeleteIfExists(); 310 } 311 312 public string FindById(string algorithmId) { 313 CloudBlobContainer container = BlobClient.GetContainerReference(AzureConstants.VISUAL_BLOB_CONTAINER); 314 container.CreateIfNotExist(); 315 var blob = container.GetBlobReference(algorithmId); 316 return blob.DownloadText(); 317 } 292 318 } 293 319 … … 296 322 private IBlobDao blobDao; 297 323 private IExperimentDao expDao; 324 private IVisualExtensionDao visualDao; 298 325 299 326 private CloudStorageAccount storageAccount; … … 340 367 } 341 368 } 369 370 371 public IVisualExtensionDao VisualExtensionDao { 372 get { 373 if (visualDao == null) { 374 visualDao = new VisualExtensionDao() { BlobClient = StorageAccount.CreateCloudBlobClient() }; 375 } 376 return visualDao; 377 } 378 } 342 379 } 343 380 } -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/HL/HiveScenarioManager.cs
r9350 r9362 294 294 Model.Run taskRun = new Model.Run(); 295 295 taskRun.Id = taskRun.Name = run.Name; 296 taskRun.AlgorithmName = run.Algorithm.Name; 296 297 IList<Parameter> resultValues = new List<Model.Parameter>(); 297 298 foreach (var key in run.Results.Keys) { … … 611 612 return dal.ExperimentDao.GetExperimentById(user, nodeId); 612 613 } 614 615 616 public string GetVisualExtension(string algorithmId) { 617 return dal.VisualExtensionDao.FindById(algorithmId); 618 } 613 619 } 614 620 } -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/DAL.cs
r9350 r9362 36 36 } 37 37 38 39 public interface IVisualExtensionDao { 40 bool Add(string algorithmId, string script); 41 bool DeleteById(string algorithmId); 42 string FindById(string algorithmId); 43 } 44 38 45 public interface IDataAccessLayer { 39 46 IScenarioDao ScenarioDao { get; } 40 47 IBlobDao BlobDao { get; } 41 48 IExperimentDao ExperimentDao { get; } 49 IVisualExtensionDao VisualExtensionDao { get; } 42 50 } 51 43 52 44 53 public static class DataAccessLayerProvider { -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IControllerService.cs
r9324 r9362 66 66 [OperationContract] 67 67 Experiment GetExperimentById(User u, string nodeId); 68 69 [OperationContract] 70 string GetVisualExtension(string algorithmId); 71 72 [OperationContract] 73 bool AddVisualExtension(string algorithmId, string script); 74 75 [OperationContract] 76 bool DeleteVisualExtension(string algorithmId); 68 77 } 69 78 } -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IScenarioManager.cs
r9324 r9362 28 28 29 29 bool DispatchExperiment(User user, Experiment exp, JobExecutionDetails details); 30 31 string GetVisualExtension(string algorithmId); 30 32 } 31 33 } -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/Model/ControllerModel.cs
r9350 r9362 483 483 [DataMember] 484 484 public IList<Parameter> InputParameters { get; set; } 485 486 public string AlgorithmName { get; set; } 485 487 } 486 488 -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Mockup/MockupDAL.cs
r9350 r9362 253 253 } 254 254 } 255 256 257 public IVisualExtensionDao VisualExtensionDao { 258 get { throw new NotImplementedException(); } 259 } 255 260 } 256 261 } -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Mockup/MockupScenarioManager.cs
r9324 r9362 286 286 throw new NotImplementedException(); 287 287 } 288 289 290 public string GetVisualExtension(string algorithmId) { 291 throw new NotImplementedException(); 292 } 288 293 } 289 294 } -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Parsers/AlgorithmConverter.cs
r9350 r9362 190 190 jrun["results"] = ConvertParametersToJson(run.Results); 191 191 jrun["params"] = ConvertParametersToJson(run.InputParameters); 192 jrun["algorithmName"] = run.AlgorithmName; 192 193 return jrun; 193 194 } -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/PlaceholderControllerService.cs
r9324 r9362 192 192 return hiveManager.GetExperimentById(u, nodeId); 193 193 } 194 195 196 public string GetVisualExtension(string algorithmId) { 197 return hiveManager.GetVisualExtension(algorithmId); 198 } 199 200 201 public bool AddVisualExtension(string algorithmId, string script) { 202 return hiveManager.AddVisualExtension(algorithmId, script); 203 } 204 205 public bool DeleteVisualExtension(string algorithmId) { 206 return hiveManager.DeleteVisualExtension(algorithmId); 207 } 194 208 } 195 209 } -
branches/OaaS/HeuristicLab.Services.Optimization.Web/Content/job.model.js
r9350 r9362 61 61 id: null, 62 62 name: null, 63 results: null 63 results: null, 64 inputs: null, 65 algorithmName: null 64 66 } 65 67 }); -
branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/JobController.cs
r9324 r9362 57 57 return Content(AlgorithmConverter.ConvertRunsToJson(runs).ToString(), "application/json", System.Text.Encoding.UTF8); 58 58 } 59 60 [HttpGet] 61 public ActionResult VisualExtension(string algorithmId) { 62 var script = ControllerService.withControllerService<string>((service) => { 63 User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string }; 64 return service.GetVisualExtension(algorithmId); 65 }); 66 return Content(script, "text/javascript", System.Text.Encoding.UTF8); 67 } 59 68 } 60 69 } -
branches/OaaS/HeuristicLab.Services.Optimization.Web/Models/AdminModels.cs
r8958 r9362 23 23 } 24 24 25 private HttpPostedFileBase scenarioJs; 26 27 public HttpPostedFileBase ScenarioJs { 28 get { return scenarioJs; } 29 set { scenarioJs = value; } 30 } 31 25 32 } 26 33 } -
branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Admin/Index.cshtml
r8958 r9362 13 13 <label for="scenarioMapper">Scenario XML</label> 14 14 <input type="file" name="scenarioXml" id="scenarioXml" /> 15 <input type="submit" value="Upload scenario" /> 15 <label for="scenarioMapper">Visual extension (JavaScript) for Scenario</label> 16 <input type="file" name="scenarioJs" id="scenarioJs" /> 17 <input type="submit" value="Upload scenario" /> 16 18 </fieldset> 17 19 }
Note: See TracChangeset
for help on using the changeset viewer.