diff --git a/src/Orchard.Web/Config/Host.config b/src/Orchard.Web/Config/Host.config
index 8b886b694..f1344c8c0 100644
--- a/src/Orchard.Web/Config/Host.config
+++ b/src/Orchard.Web/Config/Host.config
@@ -8,6 +8,7 @@
+
diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Services/Environment/Configuration/AzureBlobShellSettingsManager.cs b/src/Orchard.Web/Modules/Orchard.Azure/Services/Environment/Configuration/AzureBlobShellSettingsManager.cs
index c35f01bb8..0e97198d2 100644
--- a/src/Orchard.Web/Modules/Orchard.Azure/Services/Environment/Configuration/AzureBlobShellSettingsManager.cs
+++ b/src/Orchard.Web/Modules/Orchard.Azure/Services/Environment/Configuration/AzureBlobShellSettingsManager.cs
@@ -14,12 +14,7 @@ namespace Orchard.Azure.Services.Environment.Configuration {
/// Provides an IShellSettingsManager implementation that uses Microsoft Azure Blob Storage as the
/// underlying storage system.
///
- ///
- /// Additionally, this class handles role configuration change events when running in a Microsoft Azure Cloud
- /// Service to ensure all Orchard tenents are notified whenever a role configuration setting is changed
- /// through the management portal or API.
- ///
- public class AzureBlobShellSettingsManager : Component, IShellSettingsManager {
+ public class AzureBlobShellSettingsManager : IShellSettingsManager {
private readonly AzureFileSystem _fileSystem;
private readonly IShellSettingsManagerEventHandler _events;
@@ -27,8 +22,11 @@ namespace Orchard.Azure.Services.Environment.Configuration {
public AzureBlobShellSettingsManager(IMimeTypeProvider mimeTypeProvider, IShellSettingsManagerEventHandler events) {
_fileSystem = new AzureFileSystem(CloudConfigurationManager.GetSetting(Constants.ShellSettingsStorageConnectionStringSettingName), Constants.ShellSettingsContainerName, String.Empty, true, mimeTypeProvider);
_events = events;
+ Logger = NullLogger.Instance;
}
+ public ILogger Logger { get; set; }
+
public virtual IEnumerable LoadSettings() {
Logger.Debug("Reading ShellSettings...");
var settingsList = LoadSettingsInternal().ToArray();
diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Services/TaskLease/AzureMachineNameProvider.cs b/src/Orchard.Web/Modules/Orchard.Azure/Services/TaskLease/AzureMachineNameProvider.cs
index 57d260bc8..537e3d517 100644
--- a/src/Orchard.Web/Modules/Orchard.Azure/Services/TaskLease/AzureMachineNameProvider.cs
+++ b/src/Orchard.Web/Modules/Orchard.Azure/Services/TaskLease/AzureMachineNameProvider.cs
@@ -2,15 +2,13 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.WindowsAzure.ServiceRuntime;
+using Orchard.Environment.Extensions;
using Orchard.TaskLease.Services;
-namespace Orchard.Azure.Services.TaskLease
-{
- public class AzureMachineNameProvider : IMachineNameProvider
- {
- public string GetMachineName()
- {
- return RoleEnvironment.CurrentRoleInstance.Id;
- }
- }
+namespace Orchard.Azure.Services.TaskLease {
+ public class AzureMachineNameProvider : IMachineNameProvider {
+ public string GetMachineName() {
+ return RoleEnvironment.CurrentRoleInstance.Id;
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.TaskLease/Services/IMachineNameProvider.cs b/src/Orchard.Web/Modules/Orchard.TaskLease/Services/IMachineNameProvider.cs
index 9a7a173e3..4235d1aa9 100644
--- a/src/Orchard.Web/Modules/Orchard.TaskLease/Services/IMachineNameProvider.cs
+++ b/src/Orchard.Web/Modules/Orchard.TaskLease/Services/IMachineNameProvider.cs
@@ -1,15 +1,12 @@
-namespace Orchard.TaskLease.Services
-{
+namespace Orchard.TaskLease.Services {
+
///
- /// Describes a service which returns a name for the machine running the application.
+ /// Describes a service which the name of the machine running the application.
///
- ///
- /// Should be delocalized to IHostEnvironment in a leter version
- ///
- public interface IMachineNameProvider : IDependency
- {
+ public interface IMachineNameProvider {
+
///
- /// Returns the current machine's name
+ /// Returns the name of the machine running the application.
///
string GetMachineName();
}
diff --git a/src/Orchard.Web/Modules/Orchard.TaskLease/Services/ITaskLeaseService.cs b/src/Orchard.Web/Modules/Orchard.TaskLease/Services/ITaskLeaseService.cs
index b539bced1..bf3abfb2c 100644
--- a/src/Orchard.Web/Modules/Orchard.TaskLease/Services/ITaskLeaseService.cs
+++ b/src/Orchard.Web/Modules/Orchard.TaskLease/Services/ITaskLeaseService.cs
@@ -1,14 +1,14 @@
using System;
using Orchard.TaskLease.Models;
-namespace Orchard.TaskLease.Services
-{
+namespace Orchard.TaskLease.Services {
+
///
/// Describes a service to save and acquire task leases. A task lease can't be acquired by two different machines,
/// for a specific amount of time. Optionnally a State can be saved along with the lease.
///
- public interface ITaskLeaseService : IDependency
- {
+ public interface ITaskLeaseService : IDependency {
+
///
/// Acquires a lease for the specified task name, and amount of time.
///
diff --git a/src/Orchard.Web/Modules/Orchard.TaskLease/Services/MachineNameProvider.cs b/src/Orchard.Web/Modules/Orchard.TaskLease/Services/MachineNameProvider.cs
index 11c5a18ef..81c8393d3 100644
--- a/src/Orchard.Web/Modules/Orchard.TaskLease/Services/MachineNameProvider.cs
+++ b/src/Orchard.Web/Modules/Orchard.TaskLease/Services/MachineNameProvider.cs
@@ -1,9 +1,6 @@
-namespace Orchard.TaskLease.Services
-{
- public class MachineNameProvider : IMachineNameProvider
- {
- public string GetMachineName()
- {
+namespace Orchard.TaskLease.Services {
+ public class MachineNameProvider : IMachineNameProvider {
+ public string GetMachineName() {
return System.Environment.MachineName;
}
}
diff --git a/src/Orchard.Web/Modules/Orchard.TaskLease/Services/TaskLeaseService.cs b/src/Orchard.Web/Modules/Orchard.TaskLease/Services/TaskLeaseService.cs
index 23bbe658c..20f987493 100644
--- a/src/Orchard.Web/Modules/Orchard.TaskLease/Services/TaskLeaseService.cs
+++ b/src/Orchard.Web/Modules/Orchard.TaskLease/Services/TaskLeaseService.cs
@@ -3,44 +3,42 @@ using Orchard.Data;
using Orchard.Services;
using Orchard.TaskLease.Models;
-namespace Orchard.TaskLease.Services
-{
+namespace Orchard.TaskLease.Services {
+
///
/// Provides a database driven implementation of
///
- public class TaskLeaseService : ITaskLeaseService
- {
+ public class TaskLeaseService : ITaskLeaseService {
+
private readonly IRepository _repository;
private readonly IClock _clock;
private readonly IMachineNameProvider _machineNameProvider;
public TaskLeaseService(
- IRepository repository,
+ IRepository repository,
IClock clock,
- IMachineNameProvider machineNameProvider)
- {
+ IMachineNameProvider machineNameProvider) {
+
_repository = repository;
_clock = clock;
_machineNameProvider = machineNameProvider;
}
- public string Acquire(string taskName, DateTime expiredUtc)
- {
+ public string Acquire(string taskName, DateTime expiredUtc) {
var machineName = _machineNameProvider.GetMachineName();
// retrieve current lease for the specified task
var taskLease = _repository.Get(x => x.TaskName == taskName);
// create a new lease if there is no current lease for this task
- if (taskLease == null)
- {
+ if (taskLease == null) {
taskLease = new TaskLeaseRecord {
- TaskName = taskName,
- MachineName = machineName,
- State = String.Empty,
- UpdatedUtc = _clock.UtcNow,
- ExpiredUtc = expiredUtc
- };
+ TaskName = taskName,
+ MachineName = machineName,
+ State = String.Empty,
+ UpdatedUtc = _clock.UtcNow,
+ ExpiredUtc = expiredUtc
+ };
_repository.Create(taskLease);
_repository.Flush();
@@ -49,8 +47,7 @@ namespace Orchard.TaskLease.Services
}
// lease can't be aquired only if for a different machine and it has not expired
- if (taskLease.MachineName != machineName && taskLease.ExpiredUtc >= _clock.UtcNow)
- {
+ if (taskLease.MachineName != machineName && taskLease.ExpiredUtc >= _clock.UtcNow) {
return null;
}
@@ -64,15 +61,13 @@ namespace Orchard.TaskLease.Services
return taskLease.State;
}
- public void Update(string taskName, string state)
- {
+ public void Update(string taskName, string state) {
var machineName = _machineNameProvider.GetMachineName();
// retrieve current lease for the specified task
var taskLease = _repository.Get(x => x.TaskName == taskName && x.MachineName == machineName);
- if(taskLease == null)
- {
+ if (taskLease == null) {
return;
}
@@ -80,15 +75,13 @@ namespace Orchard.TaskLease.Services
_repository.Flush();
}
- public void Update(string taskName, string state, DateTime expiredUtc)
- {
+ public void Update(string taskName, string state, DateTime expiredUtc) {
var machineName = _machineNameProvider.GetMachineName();
// retrieve current lease for the specified task
var taskLease = _repository.Get(x => x.TaskName == taskName && x.MachineName == machineName);
- if (taskLease == null)
- {
+ if (taskLease == null) {
return;
}