* @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 if (ItemResourceConstants.ROOT_ITEM_PATH.equals(item.getPath())) {
resource = new RootItemCollection(locator, sessionImpl, this, item);
} else{
resource = new VersionControlledItemCollection(locator, sessionImpl, this, item);
}
} else {