Package org.apache.jackrabbit.webdav.property

Examples of org.apache.jackrabbit.webdav.property.DefaultDavProperty


            properties.add(new DefaultDavProperty(DavPropertyName.GETLASTMODIFIED, lastModified));
        }

        public void setETag(String etag) {
            if (etag != null) {
                properties.add(new DefaultDavProperty(DavPropertyName.GETETAG, etag));
            }
        }
View Full Code Here


            Version v = (Version)item;
            // created and creationDate properties
            try {
                String creationDate = DavConstants.creationDateFormat.format(v.getCreated().getTime());
                // replace dummy creation date from default collection
                properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE, creationDate));

                // required, protected DAV:version-name property
                properties.add(new DefaultDavProperty(VERSION_NAME, v.getName(), true));

                // required, protected DAV:label-name-set property
                String[] labels = getVersionHistoryItem().getVersionLabels(v);
                properties.add(new LabelSetProperty(labels));
View Full Code Here

                    pName = (DavPropertyName)propertyName;
                } else {
                    // create property name with default DAV: namespace
                    pName = DavPropertyName.create(propertyName.toString());
                }
                properties.add(new DefaultDavProperty(pName, propertyValue));
            }
        }
View Full Code Here

        // change resourcetype 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(JCR_VERSIONABLEUUID, ((VersionHistory)item).getVersionableUUID()));
        } catch (RepositoryException e) {
            log.error(e.getMessage());
        }

        // required root-version property for version-history resource
View Full Code Here

                if (!isMultiple()) {
                    contentType = (type == PropertyType.BINARY) ? "application/octet-stream" : "text/plain";
                } else {
                    contentType = "text/xml";
                }
                properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, contentType));


                // add jcr-specific resource properties
                properties.add(new DefaultDavProperty(JCR_TYPE, PropertyType.nameFromValue(type)));
                if (isMultiple()) {
                    properties.add(new ValuesProperty(prop.getValues()));
                    properties.add(new LengthsProperty(prop.getLengths()));
                } else {
                    properties.add(new ValuesProperty(prop.getValue()));
                    long length = prop.getLength();
                    properties.add(new DefaultDavProperty(JCR_LENGTH, String.valueOf(length), true));
                    if (prop.getLength() > IOUtil.UNDEFINED_LENGTH) {
                        properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTLENGTH, String.valueOf(length)));
                    }
                }
            } catch (RepositoryException e) {
                log.error("Failed to retrieve resource properties: "+e.getMessage());
            }
View Full Code Here

     */
    protected void initProperties() {
        super.initProperties();
        if (exists()) {
            try {
                properties.add(new DefaultDavProperty(JCR_NAME, item.getName()));
                properties.add(new DefaultDavProperty(JCR_PATH, item.getPath()));
                properties.add(new DefaultDavProperty(JCR_DEPTH, String.valueOf(item.getDepth())));
                // add href-property for the items parent unless its the root item
                if (item.getDepth() > 0) {
                    String parentHref = getLocatorFromItem(item.getParent()).getHref(true);
                    properties.add(new HrefProperty(JCR_PARENT, parentHref, false));
                }
                // protected 'definition' property revealing the item definition
                ItemDefinitionImpl val;
                if (item.isNode()) {
                    val = NodeDefinitionImpl.create(((Node)item).getDefinition());
                } else {
                    val = PropertyDefinitionImpl.create(((Property)item).getDefinition());
                }
                properties.add(new DefaultDavProperty(JCR_DEFINITION, val, true));
            } catch (RepositoryException e) {
                // should not get here
                log.error("Error while accessing jcr properties: " + e.getMessage());
            }

            // transaction resource additional protected properties
            if (item.isNew()) {
                properties.add(new DefaultDavProperty(JCR_ISNEW, null, true));
            } else if (item.isModified()) {
                properties.add(new DefaultDavProperty(JCR_ISMODIFIED, null, true));
            }
        }

        // observation resource
        SubscriptionDiscovery subsDiscovery = subsMgr.getSubscriptionDiscovery(this);
View Full Code Here

            log.warn("Error while accessing resource properties", e);
        }

        // set (or reset) fundamental properties
        if (getDisplayName() != null) {
            properties.add(new DefaultDavProperty(DavPropertyName.DISPLAYNAME, getDisplayName()));
        }
        if (isCollection()) {
            properties.add(new ResourceType(ResourceType.COLLECTION));
            // Windows XP support
            properties.add(new DefaultDavProperty(DavPropertyName.ISCOLLECTION, "1"));
        } else {
            properties.add(new ResourceType(ResourceType.DEFAULT_RESOURCE));
            // Windows XP support
            properties.add(new DefaultDavProperty(DavPropertyName.ISCOLLECTION, "0"));
        }

        /* set current lock information. If no lock is set to this resource,
        an empty lockdiscovery will be returned in the response. */
        properties.add(new LockDiscovery(getLock(Type.WRITE, Scope.EXCLUSIVE)));
View Full Code Here

            return null;
        }

        public void setContentLanguage(String contentLanguage) {
            if (contentLanguage != null) {
                properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTLANGUAGE, contentLanguage));
            }
        }
View Full Code Here

            }
        }

        public void setContentLength(long contentLength) {
            if (contentLength > IOUtil.UNDEFINED_LENGTH) {
                properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTLENGTH, contentLength + ""));
            }
        }
View Full Code Here

        }

        public void setContentType(String mimeType, String encoding) {
            String contentType = IOUtil.buildContentType(mimeType, encoding);
            if (contentType != null) {
                properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, contentType));
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.webdav.property.DefaultDavProperty

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.