- Timestamp:
- 04/16/13 08:57:22 (12 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.