Engine.GetHierarchyItem Method 

IT Hit WebDAV for .NET

Implementation of this abstract method is used by WebDAV engine to find hierarchy item objects by path.

[Visual Basic]
MustOverride Public Function GetHierarchyItem( _
   ByVal path As String _
) As IHierarchyItem
[C#]
public abstract IHierarchyItem GetHierarchyItem(
   string path
);

Parameters

path
Path of the hierarchy item object. It is always the full path from the root of the WebDAV repository.

Return Value

Hierarchy item object referenced by the specified path or null if hierarchy item not found.

Remarks

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.

Example

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;
    }
}

See Also

Engine Class | ITHit.WebDAV.Server Namespace