Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8251 for branches


Ignore:
Timestamp:
07/06/12 13:31:40 (12 years ago)
Author:
spimming
Message:

#1888:

  • Change hive server from service configuration file
  • Created service configuration settings for server address and certificate
  • Added HeuristicLab.Clients.Hive-3.3 project to solution
Location:
branches/OaaS
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS/HeuristicLab 3.3 Hive.Slave.sln

    r8242 r8251  
    2121EndProject
    2222Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Clients.Hive.Slave.AzureClient-3.3", "HeuristicLab.Clients.Hive.Slave.AzureClient\3.3\HeuristicLab.Clients.Hive.Slave.AzureClient-3.3.csproj", "{D0DDC7C9-9215-4325-AA2F-0C4ABF809321}"
     23EndProject
     24Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Clients.Hive-3.3", "HeuristicLab.Clients.Hive\3.3\HeuristicLab.Clients.Hive-3.3.csproj", "{B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}"
    2325EndProject
    2426Global
     
    144146    {D0DDC7C9-9215-4325-AA2F-0C4ABF809321}.Release|x64.ActiveCfg = Release|Any CPU
    145147    {D0DDC7C9-9215-4325-AA2F-0C4ABF809321}.Release|x86.ActiveCfg = Release|Any CPU
     148    {B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     149    {B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
     150    {B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}.Debug|x64.ActiveCfg = Debug|x64
     151    {B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}.Debug|x64.Build.0 = Debug|x64
     152    {B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}.Debug|x86.ActiveCfg = Debug|x86
     153    {B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}.Debug|x86.Build.0 = Debug|x86
     154    {B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
     155    {B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}.Release|Any CPU.Build.0 = Release|Any CPU
     156    {B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}.Release|x64.ActiveCfg = Release|x64
     157    {B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}.Release|x64.Build.0 = Release|x64
     158    {B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}.Release|x86.ActiveCfg = Release|x86
     159    {B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}.Release|x86.Build.0 = Release|x86
    146160  EndGlobalSection
    147161  GlobalSection(SolutionProperties) = preSolution
  • branches/OaaS/HeuristicLab.Clients.Hive.Slave.Azure/ServiceConfiguration.Cloud.cscfg

    r8242 r8251  
    55    <ConfigurationSettings>
    66      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
     7      <Setting name="HiveServerAddress" value="" />
     8      <Setting name="HiveServerCertifcateEncodedValue" value="" />
    79    </ConfigurationSettings>
    810  </Role>
  • branches/OaaS/HeuristicLab.Clients.Hive.Slave.Azure/ServiceConfiguration.Local.cscfg

    r8242 r8251  
    55    <ConfigurationSettings>
    66      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
     7      <Setting name="HiveServerAddress" value="" />
     8      <Setting name="HiveServerCertifcateEncodedValue" value="" />
    79    </ConfigurationSettings>
    810  </Role>
  • branches/OaaS/HeuristicLab.Clients.Hive.Slave.Azure/ServiceDefinition.build.csdef

    r8242 r8251  
    1414      <Import moduleName="Diagnostics" />
    1515    </Imports>
     16    <ConfigurationSettings>
     17      <Setting name="HiveServerAddress" />
     18      <Setting name="HiveServerCertifcateEncodedValue" />
     19    </ConfigurationSettings>
    1620  </WorkerRole>
    1721</ServiceDefinition>
  • branches/OaaS/HeuristicLab.Clients.Hive.Slave.Azure/ServiceDefinition.csdef

    r8242 r8251  
    55      <Import moduleName="Diagnostics" />
    66    </Imports>
     7    <ConfigurationSettings>
     8      <Setting name="HiveServerAddress" />
     9      <Setting name="HiveServerCertifcateEncodedValue" />
     10    </ConfigurationSettings>
    711  </WorkerRole>
    812</ServiceDefinition>
  • branches/OaaS/HeuristicLab.Clients.Hive.Slave.AzureClient/3.3/WorkerRole.cs

    r8242 r8251  
    3232    private Thread coreThread;
    3333
     34    private const string HiveServerAddressSetting = "HiveServerAddress";
     35    private const string HiveServerCertificateSetting = "HiveServerCertifcateEncodedValue";
     36
    3437    public override void Run() {
    3538      core = new Core(false);
     39
     40      string hiveServerAddress = RoleEnvironment.GetConfigurationSettingValue(HiveServerAddressSetting);
     41      string hiveServerCertificate = RoleEnvironment.GetConfigurationSettingValue(HiveServerCertificateSetting);
     42
     43      // values are empty, settings from app.config are used
     44      if (!string.IsNullOrEmpty(hiveServerAddress) && !string.IsNullOrEmpty(hiveServerCertificate)) {
     45        core.SetNewHiveServer(hiveServerAddress, hiveServerCertificate);
     46      }
     47
    3648      coreThread = new Thread(core.Start);
    3749      coreThread.Start();
     
    5971      }
    6072
     73      RoleEnvironment.Changed += RoleEnvironmentChanged;
     74
    6175      return base.OnStart();
    6276    }
     
    6680      base.OnStop();
    6781    }
     82
     83    private void RoleEnvironmentChanged(object sender, RoleEnvironmentChangedEventArgs e) {
     84    }
    6885  }
    6986}
  • branches/OaaS/HeuristicLab.Clients.Hive.Slave/3.3/Core.cs

    r8242 r8251  
    500500    }
    501501    #endregion
     502
     503    public void SetNewHiveServer(string remote, string identity) {
     504      SlaveClientCom.Instance.LogMessage("Set new hive server address and identity");
     505      HiveServiceLocator.Instance.RemoteAddress = remote;
     506      HiveServiceLocator.Instance.IdentityCertificate = identity;
     507    }
     508
     509    public void ChangeHiveServerAndRestart(string remote, string identity) {
     510      SlaveClientCom.Instance.LogMessage("Change hive server");
     511      ShutdownCore();
     512      SetNewHiveServer(remote, identity);
     513      Start();
     514    }
    502515  }
    503516}
  • branches/OaaS/HeuristicLab.Clients.Hive/3.3/HiveServiceLocator.cs

    r7259 r8251  
    2121
    2222using System;
     23using System.Security.Cryptography.X509Certificates;
     24using System.ServiceModel;
    2325using HeuristicLab.Clients.Common;
    2426
     
    4749    }
    4850
     51    private string remoteAddress;
     52    public string RemoteAddress {
     53      get { return remoteAddress; }
     54      set { remoteAddress = value; }
     55    }
     56
     57    private string identityCertificate;
     58    public string IdentityCertificate {
     59      get { return identityCertificate; }
     60      set { identityCertificate = value; }
     61    }
     62
    4963    private HiveServiceClient NewServiceClient() {
    5064      HiveServiceClient cl;
    5165      if (string.IsNullOrEmpty(username) && string.IsNullOrEmpty(password))
    5266        cl = ClientFactory.CreateClient<HiveServiceClient, IHiveService>();
    53       else
     67      else {
    5468        cl = ClientFactory.CreateClient<HiveServiceClient, IHiveService>(null, null, username, password);
     69      }
     70
     71      if (!string.IsNullOrEmpty(remoteAddress) && !string.IsNullOrEmpty(identityCertificate)) {
     72
     73        X509Certificate2Collection supportingCertificates = new X509Certificate2Collection();
     74        supportingCertificates.Import(Convert.FromBase64String(identityCertificate));
     75
     76        X509Certificate2 primaryCertificate = supportingCertificates[0];
     77        supportingCertificates.RemoveAt(0);
     78        EndpointIdentity ei = EndpointIdentity.CreateX509CertificateIdentity(primaryCertificate, supportingCertificates);
     79
     80        cl.Endpoint.Address = new EndpointAddress(new Uri(remoteAddress), ei);
     81      }
    5582
    5683      return cl;
  • branches/OaaS/HeuristicLab.Clients.Hive/3.3/IHiveServiceLocator.cs

    r7259 r8251  
    2626    string Username { get; set; }
    2727    string Password { get; set; }
     28    string RemoteAddress { get; set; }
     29    string IdentityCertificate { get; set; }
    2830    void CallHiveService(Action<IHiveService> call);
    2931    T CallHiveService<T>(Func<IHiveService, T> call);
Note: See TracChangeset for help on using the changeset viewer.