From 04a53cb2d1be3ae9cfd5d17254def0a62b128031 Mon Sep 17 00:00:00 2001 From: Louis DeJardin Date: Sun, 16 May 2010 13:35:35 -0700 Subject: [PATCH] Moving media, appdata, and vpp services into Orchard.FileSystems namespace --HG-- branch : dev --- .../Media}/AzureBlobStorageProviderTests.cs | 6 ++--- .../Orchard.Azure.Tests.csproj | 2 +- src/Orchard.Azure/AzureFileSystem.cs | 2 +- .../AppData}/AzureAppDataFolder.cs | 5 ++-- .../Media}/AzureBlobStorageProvider.cs | 9 +++----- .../Orchard.Azure.Web/Config/Host.config | 8 +++---- src/Orchard.Azure/Orchard.Azure.csproj | 4 ++-- src/Orchard.Tests/Caching/CacheScopeTests.cs | 5 ++-- .../Configuration/AppDataFolderTests.cs | 2 +- .../DefaultTenantManagerTests.cs | 2 +- .../Environment/DefaultOrchardHostTests.cs | 2 +- .../DefaultShellDescriptorCacheTests.cs | 2 +- .../Storage/FileSystemStorageProviderTests.cs | 2 +- .../Orchard.Media/Services/MediaService.cs | 2 +- .../Controllers/SetupController.cs | 2 +- src/Orchard.sln | 23 +++++++++++++++++++ src/Orchard/Data/SessionFactoryHolder.cs | 2 +- .../Configuration/ShellSettingsManager.cs | 2 +- .../Extensions/Folders/AreaFolders.cs | 6 ++--- .../Extensions/Folders/ExtensionFolders.cs | 16 ++++++------- .../Extensions/Folders/ModuleFolders.cs | 6 ++--- .../Extensions/Folders/ThemeFolders.cs | 6 ++--- .../FileSystems/IVirtualPathProvider.cs | 11 --------- src/Orchard/Environment/OrchardStarter.cs | 5 ++-- .../Topology/ShellDescriptorCache.cs | 2 +- .../AppData}/AppDataFolder.cs | 2 +- .../AppData}/IAppDataFolder.cs | 2 +- .../Media}/FileSystemStorageProvider.cs | 16 ++++++------- .../Media}/IStorageFile.cs | 4 ++-- .../Media}/IStorageFolder.cs | 4 ++-- .../Media}/IStorageProvider.cs | 4 ++-- .../FileSystems/WebSite/IWebSiteFolder.cs | 11 +++++++++ .../WebSite/WebSiteFolder.cs} | 16 ++++++------- src/Orchard/Orchard.Framework.csproj | 16 ++++++------- 34 files changed, 116 insertions(+), 93 deletions(-) rename src/Orchard.Azure.Tests/{Storage => FileSystems/Media}/AzureBlobStorageProviderTests.cs (96%) rename src/Orchard.Azure/{Environment/Configuration => FileSystems/AppData}/AzureAppDataFolder.cs (92%) rename src/Orchard.Azure/{Storage => FileSystems/Media}/AzureBlobStorageProvider.cs (85%) delete mode 100644 src/Orchard/Environment/FileSystems/IVirtualPathProvider.cs rename src/Orchard/{Environment/FileSystems => FileSystems/AppData}/AppDataFolder.cs (95%) rename src/Orchard/{Environment/FileSystems => FileSystems/AppData}/IAppDataFolder.cs (92%) rename src/Orchard/{Storage => FileSystems/Media}/FileSystemStorageProvider.cs (92%) rename src/Orchard/{Storage => FileSystems/Media}/IStorageFile.cs (88%) rename src/Orchard/{Storage => FileSystems/Media}/IStorageFolder.cs (81%) rename src/Orchard/{Storage => FileSystems/Media}/IStorageProvider.cs (91%) create mode 100644 src/Orchard/FileSystems/WebSite/IWebSiteFolder.cs rename src/Orchard/{Environment/FileSystems/DefaultVirtualPathProvider.cs => FileSystems/WebSite/WebSiteFolder.cs} (85%) diff --git a/src/Orchard.Azure.Tests/Storage/AzureBlobStorageProviderTests.cs b/src/Orchard.Azure.Tests/FileSystems/Media/AzureBlobStorageProviderTests.cs similarity index 96% rename from src/Orchard.Azure.Tests/Storage/AzureBlobStorageProviderTests.cs rename to src/Orchard.Azure.Tests/FileSystems/Media/AzureBlobStorageProviderTests.cs index 6d7053e26..2b2c5baab 100644 --- a/src/Orchard.Azure.Tests/Storage/AzureBlobStorageProviderTests.cs +++ b/src/Orchard.Azure.Tests/FileSystems/Media/AzureBlobStorageProviderTests.cs @@ -1,12 +1,12 @@ using System; using System.IO; using NUnit.Framework; -using Orchard.Azure.Storage; +using Orchard.Azure.FileSystems.Media; using Microsoft.WindowsAzure; using System.Linq; using Orchard.Environment.Configuration; -namespace Orchard.Azure.Tests.Storage { +namespace Orchard.Azure.Tests.FileSystems.Media { [TestFixture] public class AzureBlobStorageProviderTests : AzureVirtualEnvironmentTest { @@ -151,4 +151,4 @@ namespace Orchard.Azure.Tests.Storage { Assert.AreEqual(teststring, content); } } -} +} \ No newline at end of file diff --git a/src/Orchard.Azure.Tests/Orchard.Azure.Tests.csproj b/src/Orchard.Azure.Tests/Orchard.Azure.Tests.csproj index 393e8b820..1c50810df 100644 --- a/src/Orchard.Azure.Tests/Orchard.Azure.Tests.csproj +++ b/src/Orchard.Azure.Tests/Orchard.Azure.Tests.csproj @@ -56,7 +56,7 @@ - + diff --git a/src/Orchard.Azure/AzureFileSystem.cs b/src/Orchard.Azure/AzureFileSystem.cs index 97d7eab96..c2c16eded 100644 --- a/src/Orchard.Azure/AzureFileSystem.cs +++ b/src/Orchard.Azure/AzureFileSystem.cs @@ -4,7 +4,7 @@ using System.Linq; using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.StorageClient; using System.IO; -using Orchard.Storage; +using Orchard.FileSystems.Media; namespace Orchard.Azure { public class AzureFileSystem { diff --git a/src/Orchard.Azure/Environment/Configuration/AzureAppDataFolder.cs b/src/Orchard.Azure/FileSystems/AppData/AzureAppDataFolder.cs similarity index 92% rename from src/Orchard.Azure/Environment/Configuration/AzureAppDataFolder.cs rename to src/Orchard.Azure/FileSystems/AppData/AzureAppDataFolder.cs index 540ba18ec..ee4a5b190 100644 --- a/src/Orchard.Azure/Environment/Configuration/AzureAppDataFolder.cs +++ b/src/Orchard.Azure/FileSystems/AppData/AzureAppDataFolder.cs @@ -3,8 +3,9 @@ using System.Collections.Generic; using System.IO; using System.Linq; using Orchard.Environment.Configuration; +using Orchard.FileSystems.AppData; -namespace Orchard.Azure.Environment.Configuration { +namespace Orchard.Azure.FileSystems.AppData { public class AzureAppDataFolder : IAppDataFolder { private readonly AzureFileSystem _fs; @@ -62,4 +63,4 @@ namespace Orchard.Azure.Environment.Configuration { throw new NotImplementedException(); } } -} +} \ No newline at end of file diff --git a/src/Orchard.Azure/Storage/AzureBlobStorageProvider.cs b/src/Orchard.Azure/FileSystems/Media/AzureBlobStorageProvider.cs similarity index 85% rename from src/Orchard.Azure/Storage/AzureBlobStorageProvider.cs rename to src/Orchard.Azure/FileSystems/Media/AzureBlobStorageProvider.cs index 39c805c4b..e6fe9acac 100644 --- a/src/Orchard.Azure/Storage/AzureBlobStorageProvider.cs +++ b/src/Orchard.Azure/FileSystems/Media/AzureBlobStorageProvider.cs @@ -1,9 +1,8 @@ using Microsoft.WindowsAzure; using Orchard.Environment.Configuration; -using Orchard.Storage; - -namespace Orchard.Azure.Storage { +using Orchard.FileSystems.Media; +namespace Orchard.Azure.FileSystems.Media { public class AzureBlobStorageProvider : AzureFileSystem, IStorageProvider { public AzureBlobStorageProvider(ShellSettings shellSettings) @@ -12,6 +11,4 @@ namespace Orchard.Azure.Storage { public AzureBlobStorageProvider(ShellSettings shellSettings, CloudStorageAccount storageAccount) : base("media", shellSettings.Name, false, storageAccount) { } } -} - - +} \ No newline at end of file diff --git a/src/Orchard.Azure/Orchard.Azure.Web/Config/Host.config b/src/Orchard.Azure/Orchard.Azure.Web/Config/Host.config index f18679d61..1a081a020 100644 --- a/src/Orchard.Azure/Orchard.Azure.Web/Config/Host.config +++ b/src/Orchard.Azure/Orchard.Azure.Web/Config/Host.config @@ -14,13 +14,13 @@ + type="Orchard.Azure.FileSystems.Media.AzureBlobStorageProvider, Orchard.Azure" + service="Orchard.FileSystems.Media.IStorageProvider"> + type="Orchard.Azure.FileSystems.AppData.AzureAppDataFolder, Orchard.Azure" + service="Orchard.FileSystems.AppData.IAppDataFolder"> diff --git a/src/Orchard.Azure/Orchard.Azure.csproj b/src/Orchard.Azure/Orchard.Azure.csproj index 21becee28..bdd1d9fc8 100644 --- a/src/Orchard.Azure/Orchard.Azure.csproj +++ b/src/Orchard.Azure/Orchard.Azure.csproj @@ -51,9 +51,9 @@ - + - + diff --git a/src/Orchard.Tests/Caching/CacheScopeTests.cs b/src/Orchard.Tests/Caching/CacheScopeTests.cs index 56342e914..569bd63e6 100644 --- a/src/Orchard.Tests/Caching/CacheScopeTests.cs +++ b/src/Orchard.Tests/Caching/CacheScopeTests.cs @@ -6,7 +6,8 @@ using NUnit.Framework; using Orchard.Caching; using Orchard.Environment; using Autofac; -using Orchard.Environment.FileSystems; +using Orchard.FileSystems.AppData; +using Orchard.FileSystems.WebSite; using Orchard.Services; namespace Orchard.Tests.Caching { @@ -38,7 +39,7 @@ namespace Orchard.Tests.Caching { [Test] public void HostLevelHasAccessToGlobalVolatileProviders() { - Assert.That(_hostContainer.Resolve(), Is.Not.Null); + Assert.That(_hostContainer.Resolve(), Is.Not.Null); Assert.That(_hostContainer.Resolve(), Is.Not.Null); Assert.That(_hostContainer.Resolve(), Is.Not.Null); } diff --git a/src/Orchard.Tests/Environment/Configuration/AppDataFolderTests.cs b/src/Orchard.Tests/Environment/Configuration/AppDataFolderTests.cs index cffe3dcab..fe37edc8c 100644 --- a/src/Orchard.Tests/Environment/Configuration/AppDataFolderTests.cs +++ b/src/Orchard.Tests/Environment/Configuration/AppDataFolderTests.cs @@ -1,7 +1,7 @@ using System.IO; using System.Linq; using NUnit.Framework; -using Orchard.Environment.FileSystems; +using Orchard.FileSystems.AppData; namespace Orchard.Tests.Environment.Configuration { [TestFixture] diff --git a/src/Orchard.Tests/Environment/Configuration/DefaultTenantManagerTests.cs b/src/Orchard.Tests/Environment/Configuration/DefaultTenantManagerTests.cs index 39309fce4..e33c5ed42 100644 --- a/src/Orchard.Tests/Environment/Configuration/DefaultTenantManagerTests.cs +++ b/src/Orchard.Tests/Environment/Configuration/DefaultTenantManagerTests.cs @@ -3,7 +3,7 @@ using System.Linq; using Moq; using NUnit.Framework; using Orchard.Environment.Configuration; -using Orchard.Environment.FileSystems; +using Orchard.FileSystems.AppData; namespace Orchard.Tests.Environment.Configuration { [TestFixture] diff --git a/src/Orchard.Tests/Environment/DefaultOrchardHostTests.cs b/src/Orchard.Tests/Environment/DefaultOrchardHostTests.cs index 9fda5a2e5..9f1677811 100644 --- a/src/Orchard.Tests/Environment/DefaultOrchardHostTests.cs +++ b/src/Orchard.Tests/Environment/DefaultOrchardHostTests.cs @@ -15,10 +15,10 @@ using Orchard.Environment.Configuration; using Orchard.Environment.Extensions; using Orchard.Environment.Extensions.Folders; using Orchard.Environment.Extensions.Models; -using Orchard.Environment.FileSystems; using Orchard.Environment.ShellBuilders; using Orchard.Environment.Topology; using Orchard.Environment.Topology.Models; +using Orchard.FileSystems.AppData; using Orchard.Mvc; using Orchard.Mvc.ModelBinders; using Orchard.Mvc.Routes; diff --git a/src/Orchard.Tests/Environment/Topology/DefaultShellDescriptorCacheTests.cs b/src/Orchard.Tests/Environment/Topology/DefaultShellDescriptorCacheTests.cs index 4d1d7e4aa..67ac3ffe9 100644 --- a/src/Orchard.Tests/Environment/Topology/DefaultShellDescriptorCacheTests.cs +++ b/src/Orchard.Tests/Environment/Topology/DefaultShellDescriptorCacheTests.cs @@ -3,9 +3,9 @@ using System.Runtime.Serialization; using System.Xml; using Autofac; using NUnit.Framework; -using Orchard.Environment.FileSystems; using Orchard.Environment.Topology; using Orchard.Environment.Topology.Models; +using Orchard.FileSystems.AppData; namespace Orchard.Tests.Environment.Topology { [TestFixture] diff --git a/src/Orchard.Tests/Storage/FileSystemStorageProviderTests.cs b/src/Orchard.Tests/Storage/FileSystemStorageProviderTests.cs index fb87bbcb2..df7e4d10a 100644 --- a/src/Orchard.Tests/Storage/FileSystemStorageProviderTests.cs +++ b/src/Orchard.Tests/Storage/FileSystemStorageProviderTests.cs @@ -4,7 +4,7 @@ using System.Linq; using NUnit.Framework; using System; using Orchard.Environment.Configuration; -using Orchard.Storage; +using Orchard.FileSystems.Media; namespace Orchard.Tests.Storage { [TestFixture] diff --git a/src/Orchard.Web/Modules/Orchard.Media/Services/MediaService.cs b/src/Orchard.Web/Modules/Orchard.Media/Services/MediaService.cs index 7ca491cda..ebce331e2 100644 --- a/src/Orchard.Web/Modules/Orchard.Media/Services/MediaService.cs +++ b/src/Orchard.Web/Modules/Orchard.Media/Services/MediaService.cs @@ -5,8 +5,8 @@ using System.Text; using System.Web; using ICSharpCode.SharpZipLib.Zip; using JetBrains.Annotations; +using Orchard.FileSystems.Media; using Orchard.Logging; -using Orchard.Storage; using Orchard.Media.Models; namespace Orchard.Media.Services { diff --git a/src/Orchard.Web/Modules/Orchard.Setup/Controllers/SetupController.cs b/src/Orchard.Web/Modules/Orchard.Setup/Controllers/SetupController.cs index f651f689e..1722cfa98 100644 --- a/src/Orchard.Web/Modules/Orchard.Setup/Controllers/SetupController.cs +++ b/src/Orchard.Web/Modules/Orchard.Setup/Controllers/SetupController.cs @@ -9,10 +9,10 @@ using Orchard.Core.Settings.Models; using Orchard.Data; using Orchard.Environment; using Orchard.Environment.Extensions; -using Orchard.Environment.FileSystems; using Orchard.Environment.ShellBuilders; using Orchard.Environment.Topology; using Orchard.Environment.Topology.Models; +using Orchard.FileSystems.AppData; using Orchard.Security; using Orchard.Settings; using Orchard.Setup.Services; diff --git a/src/Orchard.sln b/src/Orchard.sln index 6a548748d..19b55394d 100644 --- a/src/Orchard.sln +++ b/src/Orchard.sln @@ -63,6 +63,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Modules", "Orchard. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Profile", "Orchard.Profile\Orchard.Profile.csproj", "{94E694A2-D140-468D-A277-C5FCE1D13E9B}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Azure", "Azure", "{55E8934A-9C5B-4647-8DE0-50E48B423339}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Azure", "Orchard.Azure\Orchard.Azure.csproj", "{2505AA84-65A6-43D0-9C27-4F44FD576284}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Azure.Web", "Orchard.Azure\Orchard.Azure.Web\Orchard.Azure.Web.csproj", "{0DF8F426-9F30-4918-8F64-A5B40BA12D10}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Azure.Tests", "Orchard.Azure.Tests\Orchard.Azure.Tests.csproj", "{1CC62F45-E6FF-43D5-84BF-509A1085D994}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -177,6 +185,18 @@ Global {94E694A2-D140-468D-A277-C5FCE1D13E9B}.Debug|Any CPU.Build.0 = Debug|Any CPU {94E694A2-D140-468D-A277-C5FCE1D13E9B}.Release|Any CPU.ActiveCfg = Release|Any CPU {94E694A2-D140-468D-A277-C5FCE1D13E9B}.Release|Any CPU.Build.0 = Release|Any CPU + {2505AA84-65A6-43D0-9C27-4F44FD576284}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2505AA84-65A6-43D0-9C27-4F44FD576284}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2505AA84-65A6-43D0-9C27-4F44FD576284}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2505AA84-65A6-43D0-9C27-4F44FD576284}.Release|Any CPU.Build.0 = Release|Any CPU + {0DF8F426-9F30-4918-8F64-A5B40BA12D10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0DF8F426-9F30-4918-8F64-A5B40BA12D10}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0DF8F426-9F30-4918-8F64-A5B40BA12D10}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0DF8F426-9F30-4918-8F64-A5B40BA12D10}.Release|Any CPU.Build.0 = Release|Any CPU + {1CC62F45-E6FF-43D5-84BF-509A1085D994}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1CC62F45-E6FF-43D5-84BF-509A1085D994}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1CC62F45-E6FF-43D5-84BF-509A1085D994}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1CC62F45-E6FF-43D5-84BF-509A1085D994}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -206,5 +226,8 @@ Global {4AB4B5B6-277E-4FF6-B69B-7AE9E16D2A56} = {383DBA32-4A3E-48D1-AAC3-75377A694452} {33B1BC8D-E292-4972-A363-22056B207156} = {383DBA32-4A3E-48D1-AAC3-75377A694452} {E65E5633-C0FF-453C-A906-481C14F969D6} = {E75A4CE4-CAA6-41E4-B951-33ACC60DC77C} + {2505AA84-65A6-43D0-9C27-4F44FD576284} = {55E8934A-9C5B-4647-8DE0-50E48B423339} + {0DF8F426-9F30-4918-8F64-A5B40BA12D10} = {55E8934A-9C5B-4647-8DE0-50E48B423339} + {1CC62F45-E6FF-43D5-84BF-509A1085D994} = {55E8934A-9C5B-4647-8DE0-50E48B423339} EndGlobalSection EndGlobal diff --git a/src/Orchard/Data/SessionFactoryHolder.cs b/src/Orchard/Data/SessionFactoryHolder.cs index cfbe60c30..8c37274b7 100644 --- a/src/Orchard/Data/SessionFactoryHolder.cs +++ b/src/Orchard/Data/SessionFactoryHolder.cs @@ -3,9 +3,9 @@ using System.IO; using NHibernate; using Orchard.Data.Builders; using Orchard.Environment.Configuration; -using Orchard.Environment.FileSystems; using Orchard.Environment.Topology; using Orchard.Environment.Topology.Models; +using Orchard.FileSystems.AppData; using Orchard.Logging; namespace Orchard.Data { diff --git a/src/Orchard/Environment/Configuration/ShellSettingsManager.cs b/src/Orchard/Environment/Configuration/ShellSettingsManager.cs index 245138823..85927d370 100644 --- a/src/Orchard/Environment/Configuration/ShellSettingsManager.cs +++ b/src/Orchard/Environment/Configuration/ShellSettingsManager.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Yaml.Serialization; -using Orchard.Environment.FileSystems; +using Orchard.FileSystems.AppData; using Orchard.Localization; namespace Orchard.Environment.Configuration { diff --git a/src/Orchard/Environment/Extensions/Folders/AreaFolders.cs b/src/Orchard/Environment/Extensions/Folders/AreaFolders.cs index 58b1bd7d7..7571343b1 100644 --- a/src/Orchard/Environment/Extensions/Folders/AreaFolders.cs +++ b/src/Orchard/Environment/Extensions/Folders/AreaFolders.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; using Orchard.Caching; -using Orchard.Environment.FileSystems; +using Orchard.FileSystems.WebSite; namespace Orchard.Environment.Extensions.Folders { public class AreaFolders : ExtensionFolders { - public AreaFolders(IEnumerable paths, ICacheManager cacheManager, IVirtualPathProvider virtualPathProvider) : - base(paths, "Module.txt", true/*isManifestOptional*/, cacheManager, virtualPathProvider) { + public AreaFolders(IEnumerable paths, ICacheManager cacheManager, IWebSiteFolder webSiteFolder) : + base(paths, "Module.txt", true/*isManifestOptional*/, cacheManager, webSiteFolder) { } } } \ No newline at end of file diff --git a/src/Orchard/Environment/Extensions/Folders/ExtensionFolders.cs b/src/Orchard/Environment/Extensions/Folders/ExtensionFolders.cs index f59992c25..cac09fef5 100644 --- a/src/Orchard/Environment/Extensions/Folders/ExtensionFolders.cs +++ b/src/Orchard/Environment/Extensions/Folders/ExtensionFolders.cs @@ -6,7 +6,7 @@ using System.Web.Hosting; using Orchard.Caching; using Orchard.Environment.Extensions.Helpers; using Orchard.Environment.Extensions.Models; -using Orchard.Environment.FileSystems; +using Orchard.FileSystems.WebSite; using Yaml.Grammar; namespace Orchard.Environment.Extensions.Folders { @@ -22,28 +22,28 @@ namespace Orchard.Environment.Extensions.Folders { private readonly string _extensionType; private readonly bool _manifestIsOptional; private readonly ICacheManager _cacheManager; - private readonly IVirtualPathProvider _virtualPathProvider; + private readonly IWebSiteFolder _webSiteFolder; protected ExtensionFolders( IEnumerable paths, string manifestName, bool manifestIsOptional, ICacheManager cacheManager, - IVirtualPathProvider virtualPathProvider) { + IWebSiteFolder webSiteFolder) { _paths = paths; _manifestName = manifestName; _extensionType = manifestName == "Theme.txt" ? "Theme" : "Module"; _manifestIsOptional = manifestIsOptional; _cacheManager = cacheManager; - _virtualPathProvider = virtualPathProvider; + _webSiteFolder = webSiteFolder; } public IEnumerable AvailableExtensions() { var list = new List(); foreach (var locationPath in _paths) { var subfolderPaths = _cacheManager.Get(locationPath, ctx => { - ctx.Monitor(_virtualPathProvider.WhenPathChanges(ctx.Key)); - return _virtualPathProvider.GetSubfolderPaths(ctx.Key); + ctx.Monitor(_webSiteFolder.WhenPathChanges(ctx.Key)); + return _webSiteFolder.ListDirectories(ctx.Key); }); foreach (var subfolderPath in subfolderPaths) { var extensionName = Path.GetFileName(subfolderPath.TrimEnd('/', '\\')); @@ -59,9 +59,9 @@ namespace Orchard.Environment.Extensions.Folders { ExtensionDescriptor GetExtensionDescriptor(string locationPath, string extensionName, string manifestPath) { return _cacheManager.Get(manifestPath, context => { - context.Monitor(_virtualPathProvider.WhenPathChanges(manifestPath)); + context.Monitor(_webSiteFolder.WhenPathChanges(manifestPath)); - var manifestText = _virtualPathProvider.ReadAllText(manifestPath); + var manifestText = _webSiteFolder.ReadFile(manifestPath); if (manifestText == null) { if (_manifestIsOptional) { manifestText = string.Format("name: {0}", extensionName); diff --git a/src/Orchard/Environment/Extensions/Folders/ModuleFolders.cs b/src/Orchard/Environment/Extensions/Folders/ModuleFolders.cs index 82f065982..dd8569f41 100644 --- a/src/Orchard/Environment/Extensions/Folders/ModuleFolders.cs +++ b/src/Orchard/Environment/Extensions/Folders/ModuleFolders.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; using Orchard.Caching; -using Orchard.Environment.FileSystems; +using Orchard.FileSystems.WebSite; namespace Orchard.Environment.Extensions.Folders { public class ModuleFolders : ExtensionFolders { - public ModuleFolders(IEnumerable paths, ICacheManager cacheManager, IVirtualPathProvider virtualPathProvider) : - base(paths, "Module.txt", false/*isManifestOptional*/, cacheManager, virtualPathProvider) { + public ModuleFolders(IEnumerable paths, ICacheManager cacheManager, IWebSiteFolder webSiteFolder) : + base(paths, "Module.txt", false/*isManifestOptional*/, cacheManager, webSiteFolder) { } } } \ No newline at end of file diff --git a/src/Orchard/Environment/Extensions/Folders/ThemeFolders.cs b/src/Orchard/Environment/Extensions/Folders/ThemeFolders.cs index 9ebc50e3a..b832514ad 100644 --- a/src/Orchard/Environment/Extensions/Folders/ThemeFolders.cs +++ b/src/Orchard/Environment/Extensions/Folders/ThemeFolders.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; using Orchard.Caching; -using Orchard.Environment.FileSystems; +using Orchard.FileSystems.WebSite; namespace Orchard.Environment.Extensions.Folders { public class ThemeFolders : ExtensionFolders { - public ThemeFolders(IEnumerable paths, ICacheManager cacheManager, IVirtualPathProvider virtualPathProvider) : - base(paths, "Theme.txt", false/*manifestIsOptional*/, cacheManager, virtualPathProvider) { + public ThemeFolders(IEnumerable paths, ICacheManager cacheManager, IWebSiteFolder webSiteFolder) : + base(paths, "Theme.txt", false/*manifestIsOptional*/, cacheManager, webSiteFolder) { } } } \ No newline at end of file diff --git a/src/Orchard/Environment/FileSystems/IVirtualPathProvider.cs b/src/Orchard/Environment/FileSystems/IVirtualPathProvider.cs deleted file mode 100644 index 94278b83c..000000000 --- a/src/Orchard/Environment/FileSystems/IVirtualPathProvider.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections.Generic; -using Orchard.Caching; - -namespace Orchard.Environment.FileSystems { - public interface IVirtualPathProvider : IVolatileProvider { - IEnumerable GetSubfolderPaths(string virtualPath); - string ReadAllText(string virtualPath); - - IVolatileToken WhenPathChanges(string path); - } -} diff --git a/src/Orchard/Environment/OrchardStarter.cs b/src/Orchard/Environment/OrchardStarter.cs index b33369422..3d43bd9ad 100644 --- a/src/Orchard/Environment/OrchardStarter.cs +++ b/src/Orchard/Environment/OrchardStarter.cs @@ -11,10 +11,11 @@ using Orchard.Environment.Configuration; using Orchard.Environment.Extensions; using Orchard.Environment.Extensions.Folders; using Orchard.Environment.Extensions.Loaders; -using Orchard.Environment.FileSystems; using Orchard.Environment.ShellBuilders; using Orchard.Environment.Topology; using Orchard.Events; +using Orchard.FileSystems.AppData; +using Orchard.FileSystems.WebSite; using Orchard.Logging; using Orchard.Services; @@ -30,7 +31,7 @@ namespace Orchard.Environment { builder.RegisterType().As().SingleInstance(); builder.RegisterType().As().SingleInstance(); - RegisterVolatileProvider(builder); + RegisterVolatileProvider(builder); RegisterVolatileProvider(builder); RegisterVolatileProvider(builder); diff --git a/src/Orchard/Environment/Topology/ShellDescriptorCache.cs b/src/Orchard/Environment/Topology/ShellDescriptorCache.cs index 3daf77a8d..5b9dda423 100644 --- a/src/Orchard/Environment/Topology/ShellDescriptorCache.cs +++ b/src/Orchard/Environment/Topology/ShellDescriptorCache.cs @@ -2,8 +2,8 @@ using System.IO; using System.Runtime.Serialization; using System.Xml; -using Orchard.Environment.FileSystems; using Orchard.Environment.Topology.Models; +using Orchard.FileSystems.AppData; using Orchard.Localization; using Orchard.Logging; diff --git a/src/Orchard/Environment/FileSystems/AppDataFolder.cs b/src/Orchard/FileSystems/AppData/AppDataFolder.cs similarity index 95% rename from src/Orchard/Environment/FileSystems/AppDataFolder.cs rename to src/Orchard/FileSystems/AppData/AppDataFolder.cs index c7a012bf9..a0537ad76 100644 --- a/src/Orchard/Environment/FileSystems/AppDataFolder.cs +++ b/src/Orchard/FileSystems/AppData/AppDataFolder.cs @@ -3,7 +3,7 @@ using System.IO; using System.Linq; using System.Web.Hosting; -namespace Orchard.Environment.FileSystems { +namespace Orchard.FileSystems.AppData { public class AppDataFolder : IAppDataFolder { protected string _basePath; diff --git a/src/Orchard/Environment/FileSystems/IAppDataFolder.cs b/src/Orchard/FileSystems/AppData/IAppDataFolder.cs similarity index 92% rename from src/Orchard/Environment/FileSystems/IAppDataFolder.cs rename to src/Orchard/FileSystems/AppData/IAppDataFolder.cs index 369b455c1..3dde70238 100644 --- a/src/Orchard/Environment/FileSystems/IAppDataFolder.cs +++ b/src/Orchard/FileSystems/AppData/IAppDataFolder.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using Orchard.Caching; -namespace Orchard.Environment.FileSystems { +namespace Orchard.FileSystems.AppData { /// /// Abstraction of App_Data folder /// Expected to work on physical filesystem, but decouples core diff --git a/src/Orchard/Storage/FileSystemStorageProvider.cs b/src/Orchard/FileSystems/Media/FileSystemStorageProvider.cs similarity index 92% rename from src/Orchard/Storage/FileSystemStorageProvider.cs rename to src/Orchard/FileSystems/Media/FileSystemStorageProvider.cs index 32522a8a9..7f0817619 100644 --- a/src/Orchard/Storage/FileSystemStorageProvider.cs +++ b/src/Orchard/FileSystems/Media/FileSystemStorageProvider.cs @@ -5,15 +5,15 @@ using System.Linq; using System.Web.Hosting; using Orchard.Environment.Configuration; -namespace Orchard.Storage { +namespace Orchard.FileSystems.Media { public class FileSystemStorageProvider : IStorageProvider { private readonly string _storagePath; private readonly string _publicPath; public FileSystemStorageProvider(ShellSettings settings) { var mediaPath = HostingEnvironment.IsHosted - ? HostingEnvironment.MapPath("~/Media/") ?? "" - : Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Media"); + ? HostingEnvironment.MapPath("~/Media/") ?? "" + : Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Media"); _storagePath = Path.Combine(mediaPath, settings.Name); @@ -35,10 +35,10 @@ namespace Orchard.Storage { static string Fix(string path) { return string.IsNullOrEmpty(path) - ? "" - : Path.DirectorySeparatorChar != '/' - ? path.Replace('/', Path.DirectorySeparatorChar) - : path; + ? "" + : Path.DirectorySeparatorChar != '/' + ? path.Replace('/', Path.DirectorySeparatorChar) + : path; } #region Implementation of IStorageProvider @@ -248,4 +248,4 @@ namespace Orchard.Storage { } } -} +} \ No newline at end of file diff --git a/src/Orchard/Storage/IStorageFile.cs b/src/Orchard/FileSystems/Media/IStorageFile.cs similarity index 88% rename from src/Orchard/Storage/IStorageFile.cs rename to src/Orchard/FileSystems/Media/IStorageFile.cs index bd7177bd4..1f33ed907 100644 --- a/src/Orchard/Storage/IStorageFile.cs +++ b/src/Orchard/FileSystems/Media/IStorageFile.cs @@ -1,7 +1,7 @@ using System; using System.IO; -namespace Orchard.Storage { +namespace Orchard.FileSystems.Media { public interface IStorageFile { string GetPath(); string GetName(); @@ -19,4 +19,4 @@ namespace Orchard.Storage { /// Stream OpenWrite(); } -} +} \ No newline at end of file diff --git a/src/Orchard/Storage/IStorageFolder.cs b/src/Orchard/FileSystems/Media/IStorageFolder.cs similarity index 81% rename from src/Orchard/Storage/IStorageFolder.cs rename to src/Orchard/FileSystems/Media/IStorageFolder.cs index a31b0a0e9..ea416ff32 100644 --- a/src/Orchard/Storage/IStorageFolder.cs +++ b/src/Orchard/FileSystems/Media/IStorageFolder.cs @@ -1,6 +1,6 @@ using System; -namespace Orchard.Storage { +namespace Orchard.FileSystems.Media { public interface IStorageFolder { string GetPath(); string GetName(); @@ -8,4 +8,4 @@ namespace Orchard.Storage { DateTime GetLastUpdated(); IStorageFolder GetParent(); } -} +} \ No newline at end of file diff --git a/src/Orchard/Storage/IStorageProvider.cs b/src/Orchard/FileSystems/Media/IStorageProvider.cs similarity index 91% rename from src/Orchard/Storage/IStorageProvider.cs rename to src/Orchard/FileSystems/Media/IStorageProvider.cs index da5b7bbce..b2e47c034 100644 --- a/src/Orchard/Storage/IStorageProvider.cs +++ b/src/Orchard/FileSystems/Media/IStorageProvider.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Orchard.Storage { +namespace Orchard.FileSystems.Media { public interface IStorageProvider : IDependency { string GetPublicUrl(string path); IStorageFile GetFile(string path); @@ -13,4 +13,4 @@ namespace Orchard.Storage { void RenameFile(string path, string newPath); IStorageFile CreateFile(string path); } -} +} \ No newline at end of file diff --git a/src/Orchard/FileSystems/WebSite/IWebSiteFolder.cs b/src/Orchard/FileSystems/WebSite/IWebSiteFolder.cs new file mode 100644 index 000000000..a7dc73925 --- /dev/null +++ b/src/Orchard/FileSystems/WebSite/IWebSiteFolder.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using Orchard.Caching; + +namespace Orchard.FileSystems.WebSite { + public interface IWebSiteFolder : IVolatileProvider { + IEnumerable ListDirectories(string path); + string ReadFile(string path); + + IVolatileToken WhenPathChanges(string path); + } +} \ No newline at end of file diff --git a/src/Orchard/Environment/FileSystems/DefaultVirtualPathProvider.cs b/src/Orchard/FileSystems/WebSite/WebSiteFolder.cs similarity index 85% rename from src/Orchard/Environment/FileSystems/DefaultVirtualPathProvider.cs rename to src/Orchard/FileSystems/WebSite/WebSiteFolder.cs index 8ca8c3f00..14543853f 100644 --- a/src/Orchard/Environment/FileSystems/DefaultVirtualPathProvider.cs +++ b/src/Orchard/FileSystems/WebSite/WebSiteFolder.cs @@ -7,20 +7,20 @@ using System.Web.Hosting; using Orchard.Caching; using Orchard.Services; -namespace Orchard.Environment.FileSystems { - public class DefaultVirtualPathProvider : IVirtualPathProvider { +namespace Orchard.FileSystems.WebSite { + public class WebSiteFolder : IWebSiteFolder { private readonly IClock _clock; private readonly Thunk _thunk; private readonly string _prefix = Guid.NewGuid().ToString("n"); private readonly IDictionary> _tokens = new Dictionary>(); - public DefaultVirtualPathProvider(IClock clock) { + public WebSiteFolder(IClock clock) { _clock = clock; _thunk = new Thunk(this); } - public IEnumerable GetSubfolderPaths(string virtualPath) { + public IEnumerable ListDirectories(string virtualPath) { if (!HostingEnvironment.VirtualPathProvider.DirectoryExists(virtualPath)) return Enumerable.Empty(); @@ -31,7 +31,7 @@ namespace Orchard.Environment.FileSystems { .ToArray(); } - public string ReadAllText(string virtualPath) { + public string ReadFile(string virtualPath) { if (!HostingEnvironment.VirtualPathProvider.FileExists(virtualPath)) return null; @@ -111,10 +111,10 @@ namespace Orchard.Environment.FileSystems { } class Thunk { - private readonly Weak _weak; + private readonly Weak _weak; - public Thunk(DefaultVirtualPathProvider provider) { - _weak = new Weak(provider); + public Thunk(WebSiteFolder provider) { + _weak = new Weak(provider); } public void Signal(string key, object value, CacheItemRemovedReason reason) { diff --git a/src/Orchard/Orchard.Framework.csproj b/src/Orchard/Orchard.Framework.csproj index 1c36e467c..9e3adff40 100644 --- a/src/Orchard/Orchard.Framework.csproj +++ b/src/Orchard/Orchard.Framework.csproj @@ -150,9 +150,9 @@ - - - + + + @@ -194,7 +194,7 @@ - + @@ -436,10 +436,10 @@ - - - - + + + +