Table of Contents

Class AbstractStorageProvider

Namespace
CMS.IO
Assembly
CMS.IO.dll

Abstract storage provider

public abstract class AbstractStorageProvider
Inheritance
object
AbstractStorageProvider
Derived
Extension Methods

Constructors

AbstractStorageProvider()

Constructor

protected AbstractStorageProvider()

Fields

DIRECTORY

Directory suffix.

protected const string DIRECTORY = ".Directory"

Field Value

string

DIRECTORY_INFO

Directory info suffix.

protected const string DIRECTORY_INFO = ".DirectoryInfo"

Field Value

string

DIRECTORY_LOCK

Directory lock suffix.

protected const string DIRECTORY_LOCK = ".DirectoryLock"

Field Value

string

FILE

File suffix.

protected const string FILE = ".File"

Field Value

string

FILE_INFO

File info suffix.

protected const string FILE_INFO = ".FileInfo"

Field Value

string

FILE_STREAM

File stream suffix.

protected const string FILE_STREAM = ".FileStream"

Field Value

string

Properties

CustomRootPath

Gets or sets Custom path where files should be stored.

public string CustomRootPath { get; set; }

Property Value

string

DirectoryProviderObject

Returns CMSDirectoryProvider object.

public AbstractDirectory DirectoryProviderObject { get; }

Property Value

AbstractDirectory

ExternalStorageName

Returns name of external storage (if current instance running on external storage).

public string ExternalStorageName { get; protected set; }

Property Value

string

FileProviderObject

Returns AbstractFile object.

public AbstractFile FileProviderObject { get; }

Property Value

AbstractFile

HasCustomRootPath

Returns whether provider has custom root path.

public bool HasCustomRootPath { get; }

Property Value

bool

IsExternalStorage

Returns whether current instance is running on external storage.

public bool IsExternalStorage { get; }

Property Value

bool

IsSharedStorage

Gets or sets a value indicating whether current instance is running on shared storage.

public bool IsSharedStorage { get; protected set; }

Property Value

bool

Remarks

This property is overridden by CMSSharedFileSystem settings key, if any.

MappedPath

Mapped path

protected string MappedPath { get; set; }

Property Value

string

Name

Provider name

public virtual string Name { get; }

Property Value

string

ParentStorageProvider

Parent storage provider

protected AbstractStorageProvider ParentStorageProvider { get; set; }

Property Value

AbstractStorageProvider

ProviderAssembly

Custom Provider library assembly.

protected Assembly ProviderAssembly { get; }

Property Value

Assembly

ProviderAssemblyName

Custom Provider library assembly.

protected string ProviderAssemblyName { get; set; }

Property Value

string

PublicExternalFolderObject

Gets or sets whether external storage folder object (i.e. Container for WA blob storage) has public access or not.

public bool? PublicExternalFolderObject { get; set; }

Property Value

bool?

Methods

CreateDirectoryProviderObject()

Creates new directory provider object

protected abstract AbstractDirectory CreateDirectoryProviderObject()

Returns

AbstractDirectory

CreateFileProviderObject()

Creates new directory provider object

protected abstract AbstractFile CreateFileProviderObject()

Returns

AbstractFile

GetDirectoryInfo(string)

Returns new instance of directory info.

public abstract DirectoryInfo GetDirectoryInfo(string path)

Parameters

path string

Path

Returns

DirectoryInfo

GetFileInfo(string)

Returns new instance of FileInfo object.

public abstract FileInfo GetFileInfo(string fileName)

Parameters

fileName string

File name

Returns

FileInfo

GetFileStream(string, FileMode)

Returns new instance of file stream.

public abstract FileStream GetFileStream(string path, FileMode mode)

Parameters

path string

Path to file

mode FileMode

File mode

Returns

FileStream

GetFileStream(string, FileMode, FileAccess)

Returns new instance of file stream.

public abstract FileStream GetFileStream(string path, FileMode mode, FileAccess access)

Parameters

path string

Path to file

mode FileMode

File mode

access FileAccess

File access

Returns

FileStream

GetFileStream(string, FileMode, FileAccess, FileShare)

Returns new instance of file stream.

public abstract FileStream GetFileStream(string path, FileMode mode, FileAccess access, FileShare share)

Parameters

path string

Path to file

mode FileMode

File mode

access FileAccess

File access

share FileShare

Sharing permissions

Returns

FileStream

GetFileStream(string, FileMode, FileAccess, FileShare, int)

Returns new instance of file stream.

public abstract FileStream GetFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize)

Parameters

path string

Path to file

mode FileMode

File mode

access FileAccess

File access

share FileShare

Sharing permissions

bufferSize int

Buffer size

Returns

FileStream

GetFullPath(string)

Converts the external mapped path to the internal path of the provider

protected virtual string GetFullPath(string path)

Parameters

path string

Path to convert

Returns

string

GetInternalProvider(string)

Gets the storage provider based on the given path.

protected virtual AbstractStorageProvider GetInternalProvider(string path)

Parameters

path string

Input path

Returns

AbstractStorageProvider

GetStorageProviderInternal(string)

Gets the storage provider based on the given path.

protected virtual AbstractStorageProvider GetStorageProviderInternal(string path)

Parameters

path string

Input path

Returns

AbstractStorageProvider

GetTargetPhysicalPath(string)

Maps virtual file system path to the target one. Remaps only paths inside the web application path structure.

public static string GetTargetPhysicalPath(string virtualPath)

Parameters

virtualPath string

Virtual path

Returns

string

GetVirtualPhysicalPath(AbstractStorageProvider, string)

Maps target file system path to virtual path. Remaps only paths inside the web application path structure.

public static string GetVirtualPhysicalPath(AbstractStorageProvider provider, string targetPath)

Parameters

provider AbstractStorageProvider

Storage provider

targetPath string

Target path

Returns

string

RemoveMappedProvider(string)

Removes a mapped provider from the mapped collection

protected void RemoveMappedProvider(string path)

Parameters

path string

Provider to remove

UnMapStoragePath(string)

Removes the mapping to a storage provider

public AbstractStorageProvider UnMapStoragePath(string path)

Parameters

path string

Path to unmap

Returns

AbstractStorageProvider