Skip to content

Commit

Permalink
aspnet#4 - Rename *FileSystem to *FileProvider.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tratcher committed Jan 20, 2015
1 parent 679290d commit 56c87db
Show file tree
Hide file tree
Showing 27 changed files with 116 additions and 119 deletions.
8 changes: 4 additions & 4 deletions FileSystem.sln → FileProvider.sln
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22108.0
VisualStudioVersion = 14.0.22513.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A1477614-E825-4204-A684-385004B63AEB}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.FileSystems", "src\Microsoft.AspNet.FileSystems\Microsoft.AspNet.FileSystems.kproj", "{A830B046-595A-4992-B9E1-3C28C6440707}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.FileProviders", "src\Microsoft.AspNet.FileProviders\Microsoft.AspNet.FileProviders.kproj", "{A830B046-595A-4992-B9E1-3C28C6440707}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E399495E-82B8-4C06-8779-C1D02BEF4495}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.FileSystems.Tests", "test\Microsoft.AspNet.FileSystems.Tests\Microsoft.AspNet.FileSystems.Tests.kproj", "{66FE5FDF-BBF9-4573-A7B7-53551731C0F9}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.FileProviders.Tests", "test\Microsoft.AspNet.FileProviders.Tests\Microsoft.AspNet.FileProviders.Tests.kproj", "{66FE5FDF-BBF9-4573-A7B7-53551731C0F9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1A060559-74DD-4B5A-BBA1-E8A441E729C1}"
ProjectSection(SolutionItems) = preProject
global.json = global.json
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.FileSystems.Interfaces", "src\Microsoft.AspNet.FileSystems.Interfaces\Microsoft.AspNet.FileSystems.Interfaces.kproj", "{DD94B7E8-3A59-4F84-98A0-8139BE259A87}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.FileProviders.Interfaces", "src\Microsoft.AspNet.FileProviders.Interfaces\Microsoft.AspNet.FileProviders.Interfaces.kproj", "{DD94B7E8-3A59-4F84-98A0-8139BE259A87}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FileSystem
FileProvider
==========

File System abstractions for ASP.NET vNext runtime. Contains IFileInfo and IFileSystem.
File Provider abstractions for ASP.NET vNext runtime. Contains IFileInfo and IFileProvider.

This project is part of ASP.NET vNext. You can find samples, documentation and getting started instructions for ASP.NET vNext at the [Home](https://github.com/aspnet/home) repo.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

using System.Collections.Generic;

namespace Microsoft.AspNet.FileSystems
namespace Microsoft.AspNet.FileProviders
{
/// <summary>
/// Represents a directory's content in the file system.
/// Represents a directory's content in the file provider.
/// </summary>
#if ASPNET50 || ASPNETCORE50
[Framework.Runtime.AssemblyNeutral]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
using System;
using System.IO;

namespace Microsoft.AspNet.FileSystems
namespace Microsoft.AspNet.FileProviders
{
/// <summary>
/// Represents a file in the given file system.
/// Represents a file in the given file provider.
/// </summary>
#if ASPNET50 || ASPNETCORE50
[Framework.Runtime.AssemblyNeutral]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

using Microsoft.Framework.Expiration.Interfaces;

namespace Microsoft.AspNet.FileSystems
namespace Microsoft.AspNet.FileProviders
{
/// <summary>
/// A file system abstraction.
/// A read-only file provider abstraction.
/// </summary>
#if ASPNET50 || ASPNETCORE50
[Framework.Runtime.AssemblyNeutral]
#endif
public interface IFileSystem
public interface IFileProvider
{
/// <summary>
/// Locate a file at the given path.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">12.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>

<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>dd94b7e8-3a59-4f84-98a0-8139be259a87</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.AspNet.FileSystems.Interfaces</RootNamespace>
</PropertyGroup>

<PropertyGroup Condition="$(OutputType) == 'Console'">
<DebuggerFlavor>ConsoleDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="$(OutputType) == 'Web'">
<DebuggerFlavor>WebDebugger</DebuggerFlavor>
</PropertyGroup>

<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">12.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>dd94b7e8-3a59-4f84-98a0-8139be259a87</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.AspNet.FileSystems.Interfaces</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="$(OutputType) == 'Console'">
<DebuggerFlavor>ConsoleDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="$(OutputType) == 'Web'">
<DebuggerFlavor>WebDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"version": "1.0.0-*",
"description": "ASP.NET 5 File System interfaces.",
"dependencies": {
"Microsoft.Framework.Runtime.Interfaces": "1.0.0-*"
},
"frameworks": {
"net45": { },
"aspnet50": { },
"aspnetcore50": { }
}
{
"version": "1.0.0-*",
"description": "ASP.NET 5 file provider interfaces.",
"dependencies": {
"Microsoft.Framework.Runtime.Interfaces": "1.0.0-*"
},
"frameworks": {
"net45": { },
"aspnet50": { },
"aspnetcore50": { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,35 @@
using System.Reflection;
using Microsoft.Framework.Expiration.Interfaces;

namespace Microsoft.AspNet.FileSystems
namespace Microsoft.AspNet.FileProviders
{
/// <summary>
/// Looks up files using embedded resources in the specified assembly.
/// This file system is case sensitive.
/// This file provider is case sensitive.
/// </summary>
public class EmbeddedResourceFileSystem : IFileSystem
public class EmbeddedFileProvider : IFileProvider
{
private readonly Assembly _assembly;
private readonly string _baseNamespace;
private readonly DateTimeOffset _lastModified;

/// <summary>
/// Initializes a new instance of the <see cref="EmbeddedResourceFileSystem" /> class using the specified
/// Initializes a new instance of the <see cref="EmbeddedFileProvider" /> class using the specified
/// assembly and empty base namespace.
/// </summary>
/// <param name="assembly"></param>
public EmbeddedResourceFileSystem(Assembly assembly)
public EmbeddedFileProvider(Assembly assembly)
: this(assembly, string.Empty)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="EmbeddedResourceFileSystem" /> class using the specified
/// Initializes a new instance of the <see cref="EmbeddedFileProvider" /> class using the specified
/// assembly and base namespace.
/// </summary>
/// <param name="assembly">The assembly that contains the embedded resources.</param>
/// <param name="baseNamespace">The base namespace that contains the embedded resources.</param>
public EmbeddedResourceFileSystem(Assembly assembly, string baseNamespace)
public EmbeddedFileProvider(Assembly assembly, string baseNamespace)
{
if (assembly == null)
{
Expand Down Expand Up @@ -76,10 +76,10 @@ public IFileInfo GetFileInfo(string subpath)
}

/// <summary>
/// Enumerate a directory at the given path, if any.
/// This file system uses a flat directory structure. Everything under the base namespace is considered to be one directory.
/// </summary>
/// <param name="subpath">The path that identifies the directory</param>
/// Enumerate a directory at the given path, if any.
/// This file provider uses a flat directory structure. Everything under the base namespace is considered to be one directory.
/// </summary>
/// <param name="subpath">The path that identifies the directory</param>
/// <returns>Contents of the directory. Caller must check Exists property.</returns>
public IDirectoryContents GetDirectoryContents(string subpath)
{
Expand Down Expand Up @@ -198,12 +198,12 @@ public Stream CreateReadStream()

public void WriteContent(byte[] content)
{
throw new InvalidOperationException(string.Format("{0} does not support {1}.", nameof(EmbeddedResourceFileSystem), nameof(WriteContent)));
throw new InvalidOperationException(string.Format("{0} does not support {1}.", nameof(EmbeddedFileProvider), nameof(WriteContent)));
}

public void Delete()
{
throw new InvalidOperationException(string.Format("{0} does not support {1}.", nameof(EmbeddedResourceFileSystem), nameof(Delete)));
throw new InvalidOperationException(string.Format("{0} does not support {1}.", nameof(EmbeddedFileProvider), nameof(Delete)));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Collections;
using System.Collections.Generic;

namespace Microsoft.AspNet.FileSystems
namespace Microsoft.AspNet.FileProviders
{
public class EnumerableDirectoryContents : IDirectoryContents
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Text.RegularExpressions;
using Microsoft.Framework.Expiration.Interfaces;

namespace Microsoft.AspNet.FileSystems
namespace Microsoft.AspNet.FileProviders
{
internal class FileChangeTrigger : IExpirationTrigger
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System;
using Microsoft.Framework.Expiration.Interfaces;

namespace Microsoft.AspNet.FileSystems
namespace Microsoft.AspNet.FileProviders
{
internal class NoopTrigger : IExpirationTrigger
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Collections.Generic;
using System.Linq;

namespace Microsoft.AspNet.FileSystems
namespace Microsoft.AspNet.FileProviders
{
public class NotFoundDirectoryContents : IDirectoryContents
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System;
using System.IO;

namespace Microsoft.AspNet.FileSystems
namespace Microsoft.AspNet.FileProviders
{
/// <summary>
/// Represents a non-existing file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
using System.Text.RegularExpressions;
using Microsoft.Framework.Expiration.Interfaces;

namespace Microsoft.AspNet.FileSystems
namespace Microsoft.AspNet.FileProviders
{
internal class PhysicalFileSystemWatcher
internal class PhysicalFilesWatcher
{
private readonly ConcurrentDictionary<string, FileChangeTrigger> _triggerCache =
new ConcurrentDictionary<string, FileChangeTrigger>(StringComparer.OrdinalIgnoreCase);
Expand All @@ -21,7 +21,7 @@ internal class PhysicalFileSystemWatcher

private readonly string _root;

internal PhysicalFileSystemWatcher(string root)
internal PhysicalFilesWatcher(string root)
{
_root = root;
_fileWatcher = new FileSystemWatcher(root);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
using System.IO;
using Microsoft.Framework.Expiration.Interfaces;

namespace Microsoft.AspNet.FileSystems
namespace Microsoft.AspNet.FileProviders
{
/// <summary>
/// Looks up files using the on-disk file system
/// </summary>
public class PhysicalFileSystem : IFileSystem
public class PhysicalFileProvider : IFileProvider
{
// These are restricted file names on Windows, regardless of extension.
private static readonly Dictionary<string, string> RestrictedFileNames = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
Expand Down Expand Up @@ -41,13 +41,13 @@ public class PhysicalFileSystem : IFileSystem
{ "clock$", string.Empty },
};

private readonly PhysicalFileSystemWatcher _physicalFileSystemWatcher;
private readonly PhysicalFilesWatcher _filesWatcher;

/// <summary>
/// Creates a new instance of a PhysicalFileSystem at the given root directory.
/// Creates a new instance of a PhysicalFileProvider at the given root directory.
/// </summary>
/// <param name="root">The root directory. This should be an absolute path.</param>
public PhysicalFileSystem(string root)
public PhysicalFileProvider(string root)
{
if (!Path.IsPathRooted(root))
{
Expand All @@ -62,7 +62,7 @@ public PhysicalFileSystem(string root)
}

// Monitor only the application's root folder.
_physicalFileSystemWatcher = new PhysicalFileSystemWatcher(Root);
_filesWatcher = new PhysicalFilesWatcher(Root);
}

/// <summary>
Expand Down Expand Up @@ -129,7 +129,7 @@ public IFileInfo GetFileInfo(string subpath)
var fileInfo = new FileInfo(fullPath);
if (fileInfo.Exists)
{
return new PhysicalFileInfo(_physicalFileSystemWatcher, fileInfo);
return new PhysicalFileInfo(_filesWatcher, fileInfo);
}

return new NotFoundFileInfo(subpath);
Expand Down Expand Up @@ -177,7 +177,7 @@ public IDirectoryContents GetDirectoryContents(string subpath)
var fileInfo = fileSystemInfo as FileInfo;
if (fileInfo != null)
{
virtualInfos.Add(new PhysicalFileInfo(_physicalFileSystemWatcher, fileInfo));
virtualInfos.Add(new PhysicalFileInfo(_filesWatcher, fileInfo));
}
else
{
Expand Down Expand Up @@ -222,19 +222,19 @@ public IExpirationTrigger Watch(string filter)
return NoopTrigger.Singleton;
}

return _physicalFileSystemWatcher.CreateFileChangeTrigger(filter);
return _filesWatcher.CreateFileChangeTrigger(filter);
}

private class PhysicalFileInfo : IFileInfo
{
private readonly FileInfo _info;

private readonly PhysicalFileSystemWatcher _physicalFileSystemWatcher;
private readonly PhysicalFilesWatcher _filesWatcher;

public PhysicalFileInfo(PhysicalFileSystemWatcher physicalFileSystemWatcher, FileInfo info)
public PhysicalFileInfo(PhysicalFilesWatcher filesWatcher, FileInfo info)
{
_info = info;
_physicalFileSystemWatcher = physicalFileSystemWatcher;
_filesWatcher = filesWatcher;
}

public bool Exists
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"version": "1.0.0-*",
"description": "Implementation for ASP.NET 5 File System abstractions.",
"description": "Implementation of ASP.NET 5 file provider abstractions.",
"dependencies": {
"Microsoft.AspNet.FileSystems.Interfaces": "1.0.0-*"
"Microsoft.AspNet.FileProviders.Interfaces": "1.0.0-*"
},
"frameworks": {
"net45": { },
Expand Down
Loading

0 comments on commit 56c87db

Please sign in to comment.