use of org.apache.jackrabbit.webdav.property.ResourceType 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;
}
use of org.apache.jackrabbit.webdav.property.ResourceType in project jackrabbit by apache.
the class VersionHistoryResourceImpl method initProperties.
//--------------------------------------------------------------------------
/**
* Fill the property set for this resource.
*/
@Override
protected void initProperties() {
if (!propsInitialized) {
super.initProperties();
// change resource type defined by default item collection
properties.add(new ResourceType(new int[] { ResourceType.COLLECTION, ResourceType.VERSION_HISTORY }));
// required root-version property for version-history resource
try {
String rootVersionHref = getLocatorFromNode(((VersionHistory) getNode()).getRootVersion()).getHref(false);
properties.add(new HrefProperty(VersionHistoryResource.ROOT_VERSION, rootVersionHref, false));
} catch (RepositoryException e) {
log.error(e.getMessage());
}
// required, protected version-set property for version-history resource
try {
VersionIterator vIter = ((VersionHistory) getNode()).getAllVersions();
ArrayList<Version> l = new ArrayList<Version>();
while (vIter.hasNext()) {
l.add(vIter.nextVersion());
}
properties.add(getHrefProperty(VersionHistoryResource.VERSION_SET, l.toArray(new Version[l.size()]), true, false));
} catch (RepositoryException e) {
log.error(e.getMessage());
}
}
}
use of org.apache.jackrabbit.webdav.property.ResourceType in project jackrabbit by apache.
the class VersionHistoryItemCollection method initProperties.
/**
* Fill the property set for this resource.
*/
@Override
protected void initProperties() {
super.initProperties();
// change resource type defined by default item collection
properties.add(new ResourceType(ResourceType.VERSION_HISTORY));
// jcr specific property pointing to the node this history belongs to
try {
properties.add(new DefaultDavProperty<String>(JCR_VERSIONABLEUUID, ((VersionHistory) item).getVersionableIdentifier()));
} catch (RepositoryException e) {
log.error(e.getMessage());
}
}
use of org.apache.jackrabbit.webdav.property.ResourceType in project jackrabbit by apache.
the class AbstractResource method initProperties.
/**
* Fill the set of default properties
*/
protected void initProperties() {
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"));
}
// todo: add etag
// default last modified
String lastModified = IOUtil.getLastModified(getModificationTime());
properties.add(new DefaultDavProperty<String>(DavPropertyName.GETLASTMODIFIED, lastModified));
// default creation time
properties.add(new DefaultDavProperty<String>(DavPropertyName.CREATIONDATE, getCreationDate()));
// supported lock property
properties.add(supportedLock);
// set current lock information. If no lock is applied to this resource,
// an empty xlockdiscovery will be returned in the response.
properties.add(new LockDiscovery(getLocks()));
// name of the jcr workspace
properties.add(new DefaultDavProperty<String>(ItemResourceConstants.JCR_WORKSPACE_NAME, getRepositorySession().getWorkspace().getName()));
}
Aggregations