Moving media, appdata, and vpp services into Orchard.FileSystems namespace

--HG--
branch : dev
This commit is contained in:
Louis DeJardin
2010-05-16 13:35:35 -07:00
parent d46d94f1ee
commit 04a53cb2d1
34 changed files with 116 additions and 93 deletions

View File

@@ -1,12 +1,12 @@
using System; using System;
using System.IO; using System.IO;
using NUnit.Framework; using NUnit.Framework;
using Orchard.Azure.Storage; using Orchard.Azure.FileSystems.Media;
using Microsoft.WindowsAzure; using Microsoft.WindowsAzure;
using System.Linq; using System.Linq;
using Orchard.Environment.Configuration; using Orchard.Environment.Configuration;
namespace Orchard.Azure.Tests.Storage { namespace Orchard.Azure.Tests.FileSystems.Media {
[TestFixture] [TestFixture]
public class AzureBlobStorageProviderTests : AzureVirtualEnvironmentTest { public class AzureBlobStorageProviderTests : AzureVirtualEnvironmentTest {

View File

@@ -56,7 +56,7 @@
<Compile Include="AzureVirtualEnvironmentTest.cs" /> <Compile Include="AzureVirtualEnvironmentTest.cs" />
<Compile Include="Environment\Configuration\AzureShellSettingsManagerTests.cs" /> <Compile Include="Environment\Configuration\AzureShellSettingsManagerTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Storage\AzureBlobStorageProviderTests.cs" /> <Compile Include="FileSystems\Media\AzureBlobStorageProviderTests.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Orchard.Azure\Orchard.Azure.csproj"> <ProjectReference Include="..\Orchard.Azure\Orchard.Azure.csproj">

View File

@@ -4,7 +4,7 @@ using System.Linq;
using Microsoft.WindowsAzure; using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient; using Microsoft.WindowsAzure.StorageClient;
using System.IO; using System.IO;
using Orchard.Storage; using Orchard.FileSystems.Media;
namespace Orchard.Azure { namespace Orchard.Azure {
public class AzureFileSystem { public class AzureFileSystem {

View File

@@ -3,8 +3,9 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Orchard.Environment.Configuration; using Orchard.Environment.Configuration;
using Orchard.FileSystems.AppData;
namespace Orchard.Azure.Environment.Configuration { namespace Orchard.Azure.FileSystems.AppData {
public class AzureAppDataFolder : IAppDataFolder { public class AzureAppDataFolder : IAppDataFolder {
private readonly AzureFileSystem _fs; private readonly AzureFileSystem _fs;

View File

@@ -1,9 +1,8 @@
using Microsoft.WindowsAzure; using Microsoft.WindowsAzure;
using Orchard.Environment.Configuration; using Orchard.Environment.Configuration;
using Orchard.Storage; using Orchard.FileSystems.Media;
namespace Orchard.Azure.Storage {
namespace Orchard.Azure.FileSystems.Media {
public class AzureBlobStorageProvider : AzureFileSystem, IStorageProvider { public class AzureBlobStorageProvider : AzureFileSystem, IStorageProvider {
public AzureBlobStorageProvider(ShellSettings shellSettings) public AzureBlobStorageProvider(ShellSettings shellSettings)
@@ -13,5 +12,3 @@ namespace Orchard.Azure.Storage {
public AzureBlobStorageProvider(ShellSettings shellSettings, CloudStorageAccount storageAccount) : base("media", shellSettings.Name, false, storageAccount) { } public AzureBlobStorageProvider(ShellSettings shellSettings, CloudStorageAccount storageAccount) : base("media", shellSettings.Name, false, storageAccount) { }
} }
} }

View File

@@ -14,13 +14,13 @@
</component> </component>
<component instance-scope="single-instance" <component instance-scope="single-instance"
type="Orchard.Azure.Storage.AzureBlobStorageProvider, Orchard.Azure" type="Orchard.Azure.FileSystems.Media.AzureBlobStorageProvider, Orchard.Azure"
service="Orchard.Storage.IStorageProvider"> service="Orchard.FileSystems.Media.IStorageProvider">
</component> </component>
<component instance-scope="single-instance" <component instance-scope="single-instance"
type="Orchard.Azure.Environment.Configuration.AzureAppDataFolder, Orchard.Azure" type="Orchard.Azure.FileSystems.AppData.AzureAppDataFolder, Orchard.Azure"
service="Orchard.Environment.Configuration.IAppDataFolder"> service="Orchard.FileSystems.AppData.IAppDataFolder">
</component> </component>

View File

@@ -51,9 +51,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="CloudBlobContainerExtensions.cs" /> <Compile Include="CloudBlobContainerExtensions.cs" />
<Compile Include="Environment\Configuration\AzureAppDataFolder.cs" /> <Compile Include="FileSystems\AppData\AzureAppDataFolder.cs" />
<Compile Include="Environment\Configuration\AzureShellSettingsManager.cs" /> <Compile Include="Environment\Configuration\AzureShellSettingsManager.cs" />
<Compile Include="Storage\AzureBlobStorageProvider.cs" /> <Compile Include="FileSystems\Media\AzureBlobStorageProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="AzureFileSystem.cs" /> <Compile Include="AzureFileSystem.cs" />
</ItemGroup> </ItemGroup>

View File

@@ -6,7 +6,8 @@ using NUnit.Framework;
using Orchard.Caching; using Orchard.Caching;
using Orchard.Environment; using Orchard.Environment;
using Autofac; using Autofac;
using Orchard.Environment.FileSystems; using Orchard.FileSystems.AppData;
using Orchard.FileSystems.WebSite;
using Orchard.Services; using Orchard.Services;
namespace Orchard.Tests.Caching { namespace Orchard.Tests.Caching {
@@ -38,7 +39,7 @@ namespace Orchard.Tests.Caching {
[Test] [Test]
public void HostLevelHasAccessToGlobalVolatileProviders() { public void HostLevelHasAccessToGlobalVolatileProviders() {
Assert.That(_hostContainer.Resolve<IVirtualPathProvider>(), Is.Not.Null); Assert.That(_hostContainer.Resolve<IWebSiteFolder>(), Is.Not.Null);
Assert.That(_hostContainer.Resolve<IAppDataFolder>(), Is.Not.Null); Assert.That(_hostContainer.Resolve<IAppDataFolder>(), Is.Not.Null);
Assert.That(_hostContainer.Resolve<IClock>(), Is.Not.Null); Assert.That(_hostContainer.Resolve<IClock>(), Is.Not.Null);
} }

View File

@@ -1,7 +1,7 @@
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using Orchard.Environment.FileSystems; using Orchard.FileSystems.AppData;
namespace Orchard.Tests.Environment.Configuration { namespace Orchard.Tests.Environment.Configuration {
[TestFixture] [TestFixture]

View File

@@ -3,7 +3,7 @@ using System.Linq;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using Orchard.Environment.Configuration; using Orchard.Environment.Configuration;
using Orchard.Environment.FileSystems; using Orchard.FileSystems.AppData;
namespace Orchard.Tests.Environment.Configuration { namespace Orchard.Tests.Environment.Configuration {
[TestFixture] [TestFixture]

View File

@@ -15,10 +15,10 @@ using Orchard.Environment.Configuration;
using Orchard.Environment.Extensions; using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Folders; using Orchard.Environment.Extensions.Folders;
using Orchard.Environment.Extensions.Models; using Orchard.Environment.Extensions.Models;
using Orchard.Environment.FileSystems;
using Orchard.Environment.ShellBuilders; using Orchard.Environment.ShellBuilders;
using Orchard.Environment.Topology; using Orchard.Environment.Topology;
using Orchard.Environment.Topology.Models; using Orchard.Environment.Topology.Models;
using Orchard.FileSystems.AppData;
using Orchard.Mvc; using Orchard.Mvc;
using Orchard.Mvc.ModelBinders; using Orchard.Mvc.ModelBinders;
using Orchard.Mvc.Routes; using Orchard.Mvc.Routes;

View File

@@ -3,9 +3,9 @@ using System.Runtime.Serialization;
using System.Xml; using System.Xml;
using Autofac; using Autofac;
using NUnit.Framework; using NUnit.Framework;
using Orchard.Environment.FileSystems;
using Orchard.Environment.Topology; using Orchard.Environment.Topology;
using Orchard.Environment.Topology.Models; using Orchard.Environment.Topology.Models;
using Orchard.FileSystems.AppData;
namespace Orchard.Tests.Environment.Topology { namespace Orchard.Tests.Environment.Topology {
[TestFixture] [TestFixture]

View File

@@ -4,7 +4,7 @@ using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using System; using System;
using Orchard.Environment.Configuration; using Orchard.Environment.Configuration;
using Orchard.Storage; using Orchard.FileSystems.Media;
namespace Orchard.Tests.Storage { namespace Orchard.Tests.Storage {
[TestFixture] [TestFixture]

View File

@@ -5,8 +5,8 @@ using System.Text;
using System.Web; using System.Web;
using ICSharpCode.SharpZipLib.Zip; using ICSharpCode.SharpZipLib.Zip;
using JetBrains.Annotations; using JetBrains.Annotations;
using Orchard.FileSystems.Media;
using Orchard.Logging; using Orchard.Logging;
using Orchard.Storage;
using Orchard.Media.Models; using Orchard.Media.Models;
namespace Orchard.Media.Services { namespace Orchard.Media.Services {

View File

@@ -9,10 +9,10 @@ using Orchard.Core.Settings.Models;
using Orchard.Data; using Orchard.Data;
using Orchard.Environment; using Orchard.Environment;
using Orchard.Environment.Extensions; using Orchard.Environment.Extensions;
using Orchard.Environment.FileSystems;
using Orchard.Environment.ShellBuilders; using Orchard.Environment.ShellBuilders;
using Orchard.Environment.Topology; using Orchard.Environment.Topology;
using Orchard.Environment.Topology.Models; using Orchard.Environment.Topology.Models;
using Orchard.FileSystems.AppData;
using Orchard.Security; using Orchard.Security;
using Orchard.Settings; using Orchard.Settings;
using Orchard.Setup.Services; using Orchard.Setup.Services;

View File

@@ -63,6 +63,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Modules", "Orchard.
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Profile", "Orchard.Profile\Orchard.Profile.csproj", "{94E694A2-D140-468D-A277-C5FCE1D13E9B}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Profile", "Orchard.Profile\Orchard.Profile.csproj", "{94E694A2-D140-468D-A277-C5FCE1D13E9B}"
EndProject 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 Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU 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}.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.ActiveCfg = Release|Any CPU
{94E694A2-D140-468D-A277-C5FCE1D13E9B}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@@ -206,5 +226,8 @@ Global
{4AB4B5B6-277E-4FF6-B69B-7AE9E16D2A56} = {383DBA32-4A3E-48D1-AAC3-75377A694452} {4AB4B5B6-277E-4FF6-B69B-7AE9E16D2A56} = {383DBA32-4A3E-48D1-AAC3-75377A694452}
{33B1BC8D-E292-4972-A363-22056B207156} = {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} {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 EndGlobalSection
EndGlobal EndGlobal

View File

@@ -3,9 +3,9 @@ using System.IO;
using NHibernate; using NHibernate;
using Orchard.Data.Builders; using Orchard.Data.Builders;
using Orchard.Environment.Configuration; using Orchard.Environment.Configuration;
using Orchard.Environment.FileSystems;
using Orchard.Environment.Topology; using Orchard.Environment.Topology;
using Orchard.Environment.Topology.Models; using Orchard.Environment.Topology.Models;
using Orchard.FileSystems.AppData;
using Orchard.Logging; using Orchard.Logging;
namespace Orchard.Data { namespace Orchard.Data {

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Yaml.Serialization; using System.Yaml.Serialization;
using Orchard.Environment.FileSystems; using Orchard.FileSystems.AppData;
using Orchard.Localization; using Orchard.Localization;
namespace Orchard.Environment.Configuration { namespace Orchard.Environment.Configuration {

View File

@@ -1,11 +1,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using Orchard.Caching; using Orchard.Caching;
using Orchard.Environment.FileSystems; using Orchard.FileSystems.WebSite;
namespace Orchard.Environment.Extensions.Folders { namespace Orchard.Environment.Extensions.Folders {
public class AreaFolders : ExtensionFolders { public class AreaFolders : ExtensionFolders {
public AreaFolders(IEnumerable<string> paths, ICacheManager cacheManager, IVirtualPathProvider virtualPathProvider) : public AreaFolders(IEnumerable<string> paths, ICacheManager cacheManager, IWebSiteFolder webSiteFolder) :
base(paths, "Module.txt", true/*isManifestOptional*/, cacheManager, virtualPathProvider) { base(paths, "Module.txt", true/*isManifestOptional*/, cacheManager, webSiteFolder) {
} }
} }
} }

View File

@@ -6,7 +6,7 @@ using System.Web.Hosting;
using Orchard.Caching; using Orchard.Caching;
using Orchard.Environment.Extensions.Helpers; using Orchard.Environment.Extensions.Helpers;
using Orchard.Environment.Extensions.Models; using Orchard.Environment.Extensions.Models;
using Orchard.Environment.FileSystems; using Orchard.FileSystems.WebSite;
using Yaml.Grammar; using Yaml.Grammar;
namespace Orchard.Environment.Extensions.Folders { namespace Orchard.Environment.Extensions.Folders {
@@ -22,28 +22,28 @@ namespace Orchard.Environment.Extensions.Folders {
private readonly string _extensionType; private readonly string _extensionType;
private readonly bool _manifestIsOptional; private readonly bool _manifestIsOptional;
private readonly ICacheManager _cacheManager; private readonly ICacheManager _cacheManager;
private readonly IVirtualPathProvider _virtualPathProvider; private readonly IWebSiteFolder _webSiteFolder;
protected ExtensionFolders( protected ExtensionFolders(
IEnumerable<string> paths, IEnumerable<string> paths,
string manifestName, string manifestName,
bool manifestIsOptional, bool manifestIsOptional,
ICacheManager cacheManager, ICacheManager cacheManager,
IVirtualPathProvider virtualPathProvider) { IWebSiteFolder webSiteFolder) {
_paths = paths; _paths = paths;
_manifestName = manifestName; _manifestName = manifestName;
_extensionType = manifestName == "Theme.txt" ? "Theme" : "Module"; _extensionType = manifestName == "Theme.txt" ? "Theme" : "Module";
_manifestIsOptional = manifestIsOptional; _manifestIsOptional = manifestIsOptional;
_cacheManager = cacheManager; _cacheManager = cacheManager;
_virtualPathProvider = virtualPathProvider; _webSiteFolder = webSiteFolder;
} }
public IEnumerable<ExtensionDescriptor> AvailableExtensions() { public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
var list = new List<ExtensionDescriptor>(); var list = new List<ExtensionDescriptor>();
foreach (var locationPath in _paths) { foreach (var locationPath in _paths) {
var subfolderPaths = _cacheManager.Get(locationPath, ctx => { var subfolderPaths = _cacheManager.Get(locationPath, ctx => {
ctx.Monitor(_virtualPathProvider.WhenPathChanges(ctx.Key)); ctx.Monitor(_webSiteFolder.WhenPathChanges(ctx.Key));
return _virtualPathProvider.GetSubfolderPaths(ctx.Key); return _webSiteFolder.ListDirectories(ctx.Key);
}); });
foreach (var subfolderPath in subfolderPaths) { foreach (var subfolderPath in subfolderPaths) {
var extensionName = Path.GetFileName(subfolderPath.TrimEnd('/', '\\')); var extensionName = Path.GetFileName(subfolderPath.TrimEnd('/', '\\'));
@@ -59,9 +59,9 @@ namespace Orchard.Environment.Extensions.Folders {
ExtensionDescriptor GetExtensionDescriptor(string locationPath, string extensionName, string manifestPath) { ExtensionDescriptor GetExtensionDescriptor(string locationPath, string extensionName, string manifestPath) {
return _cacheManager.Get(manifestPath, context => { 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 (manifestText == null) {
if (_manifestIsOptional) { if (_manifestIsOptional) {
manifestText = string.Format("name: {0}", extensionName); manifestText = string.Format("name: {0}", extensionName);

View File

@@ -1,11 +1,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using Orchard.Caching; using Orchard.Caching;
using Orchard.Environment.FileSystems; using Orchard.FileSystems.WebSite;
namespace Orchard.Environment.Extensions.Folders { namespace Orchard.Environment.Extensions.Folders {
public class ModuleFolders : ExtensionFolders { public class ModuleFolders : ExtensionFolders {
public ModuleFolders(IEnumerable<string> paths, ICacheManager cacheManager, IVirtualPathProvider virtualPathProvider) : public ModuleFolders(IEnumerable<string> paths, ICacheManager cacheManager, IWebSiteFolder webSiteFolder) :
base(paths, "Module.txt", false/*isManifestOptional*/, cacheManager, virtualPathProvider) { base(paths, "Module.txt", false/*isManifestOptional*/, cacheManager, webSiteFolder) {
} }
} }
} }

View File

@@ -1,11 +1,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using Orchard.Caching; using Orchard.Caching;
using Orchard.Environment.FileSystems; using Orchard.FileSystems.WebSite;
namespace Orchard.Environment.Extensions.Folders { namespace Orchard.Environment.Extensions.Folders {
public class ThemeFolders : ExtensionFolders { public class ThemeFolders : ExtensionFolders {
public ThemeFolders(IEnumerable<string> paths, ICacheManager cacheManager, IVirtualPathProvider virtualPathProvider) : public ThemeFolders(IEnumerable<string> paths, ICacheManager cacheManager, IWebSiteFolder webSiteFolder) :
base(paths, "Theme.txt", false/*manifestIsOptional*/, cacheManager, virtualPathProvider) { base(paths, "Theme.txt", false/*manifestIsOptional*/, cacheManager, webSiteFolder) {
} }
} }
} }

View File

@@ -1,11 +0,0 @@
using System.Collections.Generic;
using Orchard.Caching;
namespace Orchard.Environment.FileSystems {
public interface IVirtualPathProvider : IVolatileProvider {
IEnumerable<string> GetSubfolderPaths(string virtualPath);
string ReadAllText(string virtualPath);
IVolatileToken WhenPathChanges(string path);
}
}

View File

@@ -11,10 +11,11 @@ using Orchard.Environment.Configuration;
using Orchard.Environment.Extensions; using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Folders; using Orchard.Environment.Extensions.Folders;
using Orchard.Environment.Extensions.Loaders; using Orchard.Environment.Extensions.Loaders;
using Orchard.Environment.FileSystems;
using Orchard.Environment.ShellBuilders; using Orchard.Environment.ShellBuilders;
using Orchard.Environment.Topology; using Orchard.Environment.Topology;
using Orchard.Events; using Orchard.Events;
using Orchard.FileSystems.AppData;
using Orchard.FileSystems.WebSite;
using Orchard.Logging; using Orchard.Logging;
using Orchard.Services; using Orchard.Services;
@@ -30,7 +31,7 @@ namespace Orchard.Environment {
builder.RegisterType<DefaultOrchardEventBus>().As<IEventBus>().SingleInstance(); builder.RegisterType<DefaultOrchardEventBus>().As<IEventBus>().SingleInstance();
builder.RegisterType<DefaultCacheHolder>().As<ICacheHolder>().SingleInstance(); builder.RegisterType<DefaultCacheHolder>().As<ICacheHolder>().SingleInstance();
RegisterVolatileProvider<DefaultVirtualPathProvider, IVirtualPathProvider>(builder); RegisterVolatileProvider<WebSiteFolder, IWebSiteFolder>(builder);
RegisterVolatileProvider<AppDataFolder, IAppDataFolder>(builder); RegisterVolatileProvider<AppDataFolder, IAppDataFolder>(builder);
RegisterVolatileProvider<Clock, IClock>(builder); RegisterVolatileProvider<Clock, IClock>(builder);

View File

@@ -2,8 +2,8 @@
using System.IO; using System.IO;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Xml; using System.Xml;
using Orchard.Environment.FileSystems;
using Orchard.Environment.Topology.Models; using Orchard.Environment.Topology.Models;
using Orchard.FileSystems.AppData;
using Orchard.Localization; using Orchard.Localization;
using Orchard.Logging; using Orchard.Logging;

View File

@@ -3,7 +3,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Web.Hosting; using System.Web.Hosting;
namespace Orchard.Environment.FileSystems { namespace Orchard.FileSystems.AppData {
public class AppDataFolder : IAppDataFolder { public class AppDataFolder : IAppDataFolder {
protected string _basePath; protected string _basePath;

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using Orchard.Caching; using Orchard.Caching;
namespace Orchard.Environment.FileSystems { namespace Orchard.FileSystems.AppData {
/// <summary> /// <summary>
/// Abstraction of App_Data folder /// Abstraction of App_Data folder
/// Expected to work on physical filesystem, but decouples core /// Expected to work on physical filesystem, but decouples core

View File

@@ -5,7 +5,7 @@ using System.Linq;
using System.Web.Hosting; using System.Web.Hosting;
using Orchard.Environment.Configuration; using Orchard.Environment.Configuration;
namespace Orchard.Storage { namespace Orchard.FileSystems.Media {
public class FileSystemStorageProvider : IStorageProvider { public class FileSystemStorageProvider : IStorageProvider {
private readonly string _storagePath; private readonly string _storagePath;
private readonly string _publicPath; private readonly string _publicPath;

View File

@@ -1,7 +1,7 @@
using System; using System;
using System.IO; using System.IO;
namespace Orchard.Storage { namespace Orchard.FileSystems.Media {
public interface IStorageFile { public interface IStorageFile {
string GetPath(); string GetPath();
string GetName(); string GetName();

View File

@@ -1,6 +1,6 @@
using System; using System;
namespace Orchard.Storage { namespace Orchard.FileSystems.Media {
public interface IStorageFolder { public interface IStorageFolder {
string GetPath(); string GetPath();
string GetName(); string GetName();

View File

@@ -1,6 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace Orchard.Storage { namespace Orchard.FileSystems.Media {
public interface IStorageProvider : IDependency { public interface IStorageProvider : IDependency {
string GetPublicUrl(string path); string GetPublicUrl(string path);
IStorageFile GetFile(string path); IStorageFile GetFile(string path);

View File

@@ -0,0 +1,11 @@
using System.Collections.Generic;
using Orchard.Caching;
namespace Orchard.FileSystems.WebSite {
public interface IWebSiteFolder : IVolatileProvider {
IEnumerable<string> ListDirectories(string path);
string ReadFile(string path);
IVolatileToken WhenPathChanges(string path);
}
}

View File

@@ -7,20 +7,20 @@ using System.Web.Hosting;
using Orchard.Caching; using Orchard.Caching;
using Orchard.Services; using Orchard.Services;
namespace Orchard.Environment.FileSystems { namespace Orchard.FileSystems.WebSite {
public class DefaultVirtualPathProvider : IVirtualPathProvider { public class WebSiteFolder : IWebSiteFolder {
private readonly IClock _clock; private readonly IClock _clock;
private readonly Thunk _thunk; private readonly Thunk _thunk;
private readonly string _prefix = Guid.NewGuid().ToString("n"); private readonly string _prefix = Guid.NewGuid().ToString("n");
private readonly IDictionary<string, Weak<Token>> _tokens = new Dictionary<string, Weak<Token>>(); private readonly IDictionary<string, Weak<Token>> _tokens = new Dictionary<string, Weak<Token>>();
public DefaultVirtualPathProvider(IClock clock) { public WebSiteFolder(IClock clock) {
_clock = clock; _clock = clock;
_thunk = new Thunk(this); _thunk = new Thunk(this);
} }
public IEnumerable<string> GetSubfolderPaths(string virtualPath) { public IEnumerable<string> ListDirectories(string virtualPath) {
if (!HostingEnvironment.VirtualPathProvider.DirectoryExists(virtualPath)) if (!HostingEnvironment.VirtualPathProvider.DirectoryExists(virtualPath))
return Enumerable.Empty<string>(); return Enumerable.Empty<string>();
@@ -31,7 +31,7 @@ namespace Orchard.Environment.FileSystems {
.ToArray(); .ToArray();
} }
public string ReadAllText(string virtualPath) { public string ReadFile(string virtualPath) {
if (!HostingEnvironment.VirtualPathProvider.FileExists(virtualPath)) if (!HostingEnvironment.VirtualPathProvider.FileExists(virtualPath))
return null; return null;
@@ -111,10 +111,10 @@ namespace Orchard.Environment.FileSystems {
} }
class Thunk { class Thunk {
private readonly Weak<DefaultVirtualPathProvider> _weak; private readonly Weak<WebSiteFolder> _weak;
public Thunk(DefaultVirtualPathProvider provider) { public Thunk(WebSiteFolder provider) {
_weak = new Weak<DefaultVirtualPathProvider>(provider); _weak = new Weak<WebSiteFolder>(provider);
} }
public void Signal(string key, object value, CacheItemRemovedReason reason) { public void Signal(string key, object value, CacheItemRemovedReason reason) {

View File

@@ -150,9 +150,9 @@
<Compile Include="Caching\DefaultCacheManager.cs" /> <Compile Include="Caching\DefaultCacheManager.cs" />
<Compile Include="Caching\ICacheHolder.cs" /> <Compile Include="Caching\ICacheHolder.cs" />
<Compile Include="Caching\Weak.cs" /> <Compile Include="Caching\Weak.cs" />
<Compile Include="Environment\FileSystems\DefaultVirtualPathProvider.cs" /> <Compile Include="FileSystems\WebSite\WebSiteFolder.cs" />
<Compile Include="Environment\FileSystems\IAppDataFolder.cs" /> <Compile Include="FileSystems\AppData\IAppDataFolder.cs" />
<Compile Include="Environment\FileSystems\IVirtualPathProvider.cs" /> <Compile Include="FileSystems\WebSite\IWebSiteFolder.cs" />
<Compile Include="Caching\ICache.cs" /> <Compile Include="Caching\ICache.cs" />
<Compile Include="Caching\ICacheManager.cs" /> <Compile Include="Caching\ICacheManager.cs" />
<Compile Include="Caching\IVolatileToken.cs" /> <Compile Include="Caching\IVolatileToken.cs" />
@@ -194,7 +194,7 @@
<Compile Include="Environment\AutofacUtil\DynamicProxy2\DynamicProxyContext.cs" /> <Compile Include="Environment\AutofacUtil\DynamicProxy2\DynamicProxyContext.cs" />
<Compile Include="Environment\AutofacUtil\DynamicProxy2\DynamicProxyExtensions.cs" /> <Compile Include="Environment\AutofacUtil\DynamicProxy2\DynamicProxyExtensions.cs" />
<Compile Include="Environment\AutofacUtil\DynamicProxy2\ConstructorFinderWrapper.cs" /> <Compile Include="Environment\AutofacUtil\DynamicProxy2\ConstructorFinderWrapper.cs" />
<Compile Include="Environment\FileSystems\AppDataFolder.cs" /> <Compile Include="FileSystems\AppData\AppDataFolder.cs" />
<Compile Include="Environment\Configuration\ShellSettingsManager.cs" /> <Compile Include="Environment\Configuration\ShellSettingsManager.cs" />
<Compile Include="Environment\AutofacUtil\ContainerUpdater.cs" /> <Compile Include="Environment\AutofacUtil\ContainerUpdater.cs" />
<Compile Include="Environment\ShellBuilders\ShellContextFactory.cs" /> <Compile Include="Environment\ShellBuilders\ShellContextFactory.cs" />
@@ -436,10 +436,10 @@
<Compile Include="Security\Providers\OrchardMembershipProvider.cs" /> <Compile Include="Security\Providers\OrchardMembershipProvider.cs" />
<Compile Include="Security\Providers\OrchardRoleProvider.cs" /> <Compile Include="Security\Providers\OrchardRoleProvider.cs" />
<Compile Include="Services\Clock.cs" /> <Compile Include="Services\Clock.cs" />
<Compile Include="Storage\FileSystemStorageProvider.cs" /> <Compile Include="FileSystems\Media\FileSystemStorageProvider.cs" />
<Compile Include="Storage\IStorageFile.cs" /> <Compile Include="FileSystems\Media\IStorageFile.cs" />
<Compile Include="Storage\IStorageFolder.cs" /> <Compile Include="FileSystems\Media\IStorageFolder.cs" />
<Compile Include="Storage\IStorageProvider.cs" /> <Compile Include="FileSystems\Media\IStorageProvider.cs" />
<Compile Include="UI\Zones\ZoneManager.cs" /> <Compile Include="UI\Zones\ZoneManager.cs" />
<Compile Include="Utility\Extensions\ReadOnlyCollectionExtensions.cs" /> <Compile Include="Utility\Extensions\ReadOnlyCollectionExtensions.cs" />
<Compile Include="Utility\Extensions\RouteValueDictionaryExtensions.cs" /> <Compile Include="Utility\Extensions\RouteValueDictionaryExtensions.cs" />