Last change
on this file since 16796 was
9215,
checked in by fschoepp, 12 years ago
|
#1888:
- Janitor is now working as expected in Windows Azure
- Added basic support for experiments (draggable experiments)
- Added methods to save/read experiments from TableStorage
- The job status can now be retrieved by using the GetTasks/GetTaskData methods
- Added a class to convert JSON-objects to Algorithm instances
- Web page: Added experiment button to navigation
|
File size:
1.4 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Web;
|
---|
5 | using System.Web.Mvc;
|
---|
6 | using HeuristicLab.Services.Optimization.ControllerService.General;
|
---|
7 | using HeuristicLab.Services.Optimization.ControllerService;
|
---|
8 | using System.ServiceModel;
|
---|
9 | using System.Web.Security;
|
---|
10 | using System.ServiceModel.Description;
|
---|
11 |
|
---|
12 | namespace HeuristicLab.Services.Optimization.Web.Helpers
|
---|
13 | {
|
---|
14 | public class ControllerServiceHelper
|
---|
15 | {
|
---|
16 | public static readonly string DEFAULT_CONTROLLER_ENDPOINT = Configuration.ControllerEndpointName;
|
---|
17 |
|
---|
18 | public delegate T ControllerServiceDelegate<T>(IControllerService service);
|
---|
19 |
|
---|
20 | private string pw;
|
---|
21 |
|
---|
22 | public ControllerServiceHelper(string pw) {
|
---|
23 | this.pw = pw;
|
---|
24 | }
|
---|
25 |
|
---|
26 | public bool Valid { get { return pw != null; } }
|
---|
27 |
|
---|
28 | public T withControllerService<T>(ControllerServiceDelegate<T> del) {
|
---|
29 | if (!Valid)
|
---|
30 | return default(T);
|
---|
31 |
|
---|
32 | using (var cf = new ChannelFactory<IControllerService>(DEFAULT_CONTROLLER_ENDPOINT)) {
|
---|
33 | var credentialBehaviour = cf.Endpoint.Behaviors.Find<ClientCredentials>();
|
---|
34 | credentialBehaviour.UserName.UserName = Membership.GetUser().UserName;
|
---|
35 | credentialBehaviour.UserName.Password = pw;
|
---|
36 | var controllerProxy = cf.CreateChannel();
|
---|
37 | return del(controllerProxy);
|
---|
38 | }
|
---|
39 | }
|
---|
40 | }
|
---|
41 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.