ClassDiagram: COFE.Core.Volume.cd

DirectoryLister, together with DirectoryController and StreamProvider created by it, enable listing and manipulating a file system, together they are called a volume.

Volume is created by Volume Factories, which construct using a string parameter (e.g. path=c:\). Volume and Volume Factory are both registered in VolumeRegistrar. DBVolumeRegistrar store Volume information to database.

User can register a new volume using : (where FSI is FactoryKey, temp is VolumeKey)

COFEAdmin.RegisterVolume("FSI", "temp", @"path=c:\temp");
COFEAdmin.Authorize("Username", "temp");
See : Defined Volume Factories


DirectoryLister (lister) is responsible for provide entry listing for a file system, and to construct DirectoryController (controller) and StreamProvider.

There are two kind of DirectoryListers, primary and secondary:

Primary lister work with file system defined by yourself, for examples, the included FSI lister list contents using a DirectoryInfo in System.IO as root.

Secondary lister, on the another side, work with existing COFE entries from the primary ones, it "Convert" target file entries to a directory entries, for examples, the SZ DirectoryLister convert file with zip extension to directory. Another way is to append virtual entry to an existing directory entry.


DirectoryController is used to required to manipulate an entry, it provide methods like CreateFile, Copy and Rename.

Controller also contains a method named NotifyModified, this is used by secondary controller, so a primary lister can notify the secondary controller that the file is changed.


StreamProvider is used to create Stream object for File entries that's created by it's lister.

Defining a new Volume.

At least the following have to be defined:
  • DirectoryLister (which implements IPrimaryDirectoryLister2 or ISecondaryDirectoryLister)
  • DirectoryController (which implements IDirectoryController)
  • StreamProvider (which implements IStreamProvider)
  • VolumeFactory (which implements IFactory<IDirectoryLister>)

Interface Specific properties / methods
IDirectoryLister ListerKey, List(), GetParent(), Expand(), GetPosition(), SetPosition(), CreateController(), CreateStreamProvider()
IPrimaryDirectoryLister2 SupportedPathPatterns, RootDirectories, RootTempPath, ParsePath(), Exists()
ISecondaryDirectoryLister ConvertableFileNamePatterns, ConvertEntry(), AppendEntries(), CreateVirtualDirectory()
IDirectoryController ListerKey, CreateFile(), CreateDirectory(), Rename(), Copy(), Move(), Delete(), NotifyModified()
IStreamProvider ListerKey, OpenStream()
IFactory<IDirectoryLister> Construct(), Recycle()

In COFE2, Volume Factory are registered via COFEPlugin:

_directoryListerFactories.AddRange(new IFactory<IDirectoryLister>[] 
     new COFE.IO.FSI.FileSystemFactory("FSI"),

Last edited Jul 10, 2012 at 6:39 AM by lycj, version 9


No comments yet.