Search in sources :

Example 1 with VersionHistoryItemCollection

use of org.apache.jackrabbit.webdav.jcr.version.VersionHistoryItemCollection in project jackrabbit by apache.

the class DavResourceFactoryImpl method createResourceForItem.

/**
     * Tries to retrieve the repository item defined by the locator's resource
     * path and build the corresponding WebDAV resource. The following distinction
     * is made between items: Version nodes, VersionHistory nodes, root node,
     * unspecified nodes and finally property items.
     *
     * @param locator
     * @param sessionImpl
     * @return DavResource representing a repository item.
     * @throws RepositoryException if {@link javax.jcr.Session#getItem(String)} fails.
     */
private DavResource createResourceForItem(DavResourceLocator locator, JcrDavSession sessionImpl) throws RepositoryException, DavException {
    DavResource resource;
    Item item = getItem(sessionImpl, locator);
    if (item.isNode()) {
        // create special resources for Version and VersionHistory
        if (item instanceof Version) {
            resource = new VersionItemCollection(locator, sessionImpl, this, item);
        } else if (item instanceof VersionHistory) {
            resource = new VersionHistoryItemCollection(locator, sessionImpl, this, item);
        } else {
            resource = new VersionControlledItemCollection(locator, sessionImpl, this, item);
        }
    } else {
        resource = new DefaultItemResource(locator, sessionImpl, this, item);
    }
    return resource;
}
Also used : Item(javax.jcr.Item) VersionHistoryItemCollection(org.apache.jackrabbit.webdav.jcr.version.VersionHistoryItemCollection) DavResource(org.apache.jackrabbit.webdav.DavResource) Version(javax.jcr.version.Version) VersionItemCollection(org.apache.jackrabbit.webdav.jcr.version.VersionItemCollection) VersionHistory(javax.jcr.version.VersionHistory)

Aggregations

Item (javax.jcr.Item)1 Version (javax.jcr.version.Version)1 VersionHistory (javax.jcr.version.VersionHistory)1 DavResource (org.apache.jackrabbit.webdav.DavResource)1 VersionHistoryItemCollection (org.apache.jackrabbit.webdav.jcr.version.VersionHistoryItemCollection)1 VersionItemCollection (org.apache.jackrabbit.webdav.jcr.version.VersionItemCollection)1