Implementation of this abstract method is used by WebDAV engine to find hierarchy item objects by path.
Hierarchy item object referenced by the specified path or null if hierarchy item not found.
When you inherit from the Engine class, you must override this abstract method. For WebDAV Class 1 server in this method implementation you will search for resource or folder in your storage by path provided and return it to WebDAV engine. For WebDAV Class 2 server you will return folder, resource or lock-null item. For DeltaV server in addition to folder, resource or lock-null item you will return version and history items.
public class MyEngine : Engine
{
public override IHierarchyItem GetHierarchyItem(string path)
{
FileLogger.WriteMessage("Url path = " + path, LogLevel.Debug);
string discPath = ConfigurationManager.AppSettings["StorageRootFolder"].TrimEnd('\\');
discPath += path.Replace('/', '\\');
FileLogger.WriteMessage("Disc path = " + discPath, LogLevel.Debug);
DirectoryInfo directory = new DirectoryInfo(discPath);
if(directory.Exists)
return new Folder(directory);
else
{
FileInfo file = new FileInfo(discPath);
if(file.Exists)
{
if ( (file.Attributes & FileAttributes.Temporary) == 0)
return new Resource(file);
else
return new LockNull(file);
}
}
return null;
}
}
Engine Class | ITHit.WebDAV.Server Namespace