use of org.apache.jackrabbit.webdav.jcr.JcrDavSession in project jackrabbit by apache.
the class ResourceFactoryImpl method getNode.
/**
* Returns the <code>Node</code> corresponding to the given locator or
* <code>null</code> if it does not exist or if the existing item represents
* a <code>Property</code>.
*
* @param sessionImpl
* @param locator
* @return
* @throws RepositoryException
*/
private Node getNode(DavSession sessionImpl, DavResourceLocator locator) throws RepositoryException {
Node node = null;
try {
String repoPath = locator.getRepositoryPath();
if (repoPath != null) {
Session session = ((JcrDavSession) sessionImpl).getRepositorySession();
Item item = session.getItem(repoPath);
if (item instanceof Node) {
node = (Node) item;
}
// else: item is a property -> return null
}
} catch (PathNotFoundException e) {
// item does not exist (yet). return null -> create null-resource
}
return node;
}
use of org.apache.jackrabbit.webdav.jcr.JcrDavSession in project jackrabbit by apache.
the class ResourceFactoryImpl method createNullResource.
/**
* Create a 'null resource'
*
* @param locator
* @param session
* @param isCollection
* @return
* @throws DavException
*/
private DavResource createNullResource(DavResourceLocator locator, DavSession session, boolean isCollection) throws DavException {
JcrDavSession.checkImplementation(session);
JcrDavSession sessionImpl = (JcrDavSession) session;
DavResource resource;
if (versioningSupported(sessionImpl.getRepositorySession())) {
resource = new VersionControlledResourceImpl(locator, this, sessionImpl, resourceConfig, isCollection);
} else {
resource = new DavResourceImpl(locator, this, sessionImpl, resourceConfig, isCollection);
}
return resource;
}
use of org.apache.jackrabbit.webdav.jcr.JcrDavSession in project jackrabbit by apache.
the class ResourceFactoryImpl method createResource.
/**
* Tries to retrieve the repository item defined by the locator's resource
* path and build the corresponding WebDAV resource. If the repository
* supports the versioning option different resources are created for
* version, versionhistory and common nodes.
*
* @param node
* @param locator
* @param session
* @return
* @throws DavException
*/
private DavResource createResource(Node node, DavResourceLocator locator, DavSession session) throws DavException {
JcrDavSession.checkImplementation(session);
JcrDavSession sessionImpl = (JcrDavSession) session;
DavResource resource;
if (versioningSupported(sessionImpl.getRepositorySession())) {
// create special resources for Version and VersionHistory
if (node instanceof Version) {
resource = new VersionResourceImpl(locator, this, sessionImpl, resourceConfig, node);
} else if (node instanceof VersionHistory) {
resource = new VersionHistoryResourceImpl(locator, this, sessionImpl, resourceConfig, node);
} else {
resource = new VersionControlledResourceImpl(locator, this, sessionImpl, resourceConfig, node);
}
} else {
resource = new DavResourceImpl(locator, this, session, resourceConfig, node);
}
return resource;
}
Aggregations