Search in sources :

Example 1 with ParentSet

use of org.apache.jackrabbit.webdav.bind.ParentSet in project jackrabbit by apache.

the class DavResourceImpl method initProperties.

/**
     * Fill the set of properties
     */
protected void initProperties() {
    if (!exists() || propsInitialized) {
        return;
    }
    try {
        config.getPropertyManager().exportProperties(getPropertyExportContext(), isCollection());
    } catch (RepositoryException e) {
        log.warn("Error while accessing resource properties", e);
    }
    // set (or reset) fundamental properties
    if (getDisplayName() != null) {
        properties.add(new DefaultDavProperty<String>(DavPropertyName.DISPLAYNAME, getDisplayName()));
    }
    if (isCollection()) {
        properties.add(new ResourceType(ResourceType.COLLECTION));
        // Windows XP support
        properties.add(new DefaultDavProperty<String>(DavPropertyName.ISCOLLECTION, "1"));
    } else {
        properties.add(new ResourceType(ResourceType.DEFAULT_RESOURCE));
        // Windows XP support
        properties.add(new DefaultDavProperty<String>(DavPropertyName.ISCOLLECTION, "0"));
    }
    if (rfc4122Uri != null) {
        properties.add(new HrefProperty(BindConstants.RESOURCEID, rfc4122Uri, true));
    }
    Set<ParentElement> parentElements = getParentElements();
    if (!parentElements.isEmpty()) {
        properties.add(new ParentSet(parentElements));
    }
    /* set current lock information. If no lock is set to this resource,
        an empty lock discovery will be returned in the response. */
    properties.add(new LockDiscovery(getLock(Type.WRITE, Scope.EXCLUSIVE)));
    /* lock support information: all locks are lockable. */
    SupportedLock supportedLock = new SupportedLock();
    supportedLock.addEntry(Type.WRITE, Scope.EXCLUSIVE);
    properties.add(supportedLock);
    propsInitialized = true;
}
Also used : ParentSet(org.apache.jackrabbit.webdav.bind.ParentSet) HrefProperty(org.apache.jackrabbit.webdav.property.HrefProperty) SupportedLock(org.apache.jackrabbit.webdav.lock.SupportedLock) RepositoryException(javax.jcr.RepositoryException) ResourceType(org.apache.jackrabbit.webdav.property.ResourceType) ParentElement(org.apache.jackrabbit.webdav.bind.ParentElement) LockDiscovery(org.apache.jackrabbit.webdav.lock.LockDiscovery)

Aggregations

RepositoryException (javax.jcr.RepositoryException)1 ParentElement (org.apache.jackrabbit.webdav.bind.ParentElement)1 ParentSet (org.apache.jackrabbit.webdav.bind.ParentSet)1 LockDiscovery (org.apache.jackrabbit.webdav.lock.LockDiscovery)1 SupportedLock (org.apache.jackrabbit.webdav.lock.SupportedLock)1 HrefProperty (org.apache.jackrabbit.webdav.property.HrefProperty)1 ResourceType (org.apache.jackrabbit.webdav.property.ResourceType)1