Package org.apache.jackrabbit.webdav.property

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


                    // DAV:version-history (computed)
                    String vhHref = getLocatorFromItem(n.getVersionHistory()).getHref(true);
                    properties.add(new HrefProperty(VERSION_HISTORY, vhHref, true));

                    // DAV:auto-version property: there is no auto version, explicit CHECKOUT is required.
                    properties.add(new DefaultDavProperty(AUTO_VERSION, null, false));

                    String baseVHref = getLocatorFromItem(n.getBaseVersion()).getHref(true);
                    if (n.isCheckedOut()) {
                        // DAV:checked-out property (protected)
                        properties.add(new HrefProperty(CHECKED_OUT, baseVHref, true));
View Full Code Here


     */
    protected void initProperties() {
        super.initProperties();
        if (exists()) {
            // resource is serialized as system-view (xml)
            properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, "text/xml"));
            Node n = (Node)item;
            // overwrite the default modificationtime if possible
            try {
                if (n.hasProperty(JcrConstants.JCR_LASTMODIFIED)) {
                    setModificationTime(n.getProperty(JcrConstants.JCR_LASTMODIFIED).getLong());
                }
            } catch (RepositoryException e) {
                log.warn("Error while accessing jcr:lastModified property");
            }
            // overwrite the default creation date if possible
            try {
                if (n.hasProperty(JcrConstants.JCR_CREATED)) {
                    long creationTime = n.getProperty(JcrConstants.JCR_CREATED).getValue().getLong();
                    properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE,
                        DavConstants.creationDateFormat.format(new Date(creationTime))));
                }
            } catch (RepositoryException e) {
                log.warn("Error while accessing jcr:created property");
            }

            // add node-specific resource properties
            try {
                properties.add(new NodeTypeProperty(JCR_PRIMARYNODETYPE, n.getPrimaryNodeType(), false));
                properties.add(new NodeTypeProperty(JCR_MIXINNODETYPES, n.getMixinNodeTypes(), false));
                properties.add(new DefaultDavProperty(JCR_INDEX, new Integer(n.getIndex()), true));
                addHrefProperty(JCR_REFERENCES, n.getReferences(), true);
                if (n.isNodeType(JcrConstants.MIX_REFERENCEABLE)) {
                    properties.add(new DefaultDavProperty(JCR_UUID, n.getUUID(), true));
                }
            } catch (RepositoryException e) {
                log.error("Failed to retrieve primary nodetype property: " + e.getMessage());
            }
            try {
View Full Code Here

     */
    void setModificationTime(long modificationTime) {
        if (modificationTime > IOUtil.UNDEFINED_TIME) {
            this.modificationTime = modificationTime;
            String lastModified = IOUtil.getLastModified(modificationTime);
            properties.add(new DefaultDavProperty(DavPropertyName.GETLASTMODIFIED, lastModified));
        }
    }
View Full Code Here

    /**
     * Fill the set of default properties
     */
    protected void initProperties() {
        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"));
        }
        // todo: add etag

        // default last modified
        setModificationTime(new Date().getTime());
        // default creation time
        properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE, DavConstants.creationDateFormat.format(new Date(0))));

        // supported lock property
        properties.add(supportedLock);

        // set current lock information. If no lock is applied to this resource,
        // an empty lockdiscovery will be returned in the response.
        properties.add(new LockDiscovery(getLocks()));

        // observation resource
        SubscriptionDiscovery subsDiscovery = subsMgr.getSubscriptionDiscovery(this);
        properties.add(subsDiscovery);

        properties.add(new SupportedMethodSetProperty(getSupportedMethods().split(",\\s")));

  // DeltaV properties
  properties.add(supportedReports);
  // creator-displayname, comment: not value available from jcr
  properties.add(new DefaultDavProperty(DeltaVConstants.CREATOR_DISPLAYNAME, null, true));
  properties.add(new DefaultDavProperty(DeltaVConstants.COMMENT, null, true));

  // 'workspace' property as defined by RFC 3253
  String workspaceHref = getWorkspaceHref();
  if (workspaceHref != null) {
      properties.add(new HrefProperty(DeltaVConstants.WORKSPACE, workspaceHref, true));
View Full Code Here

     */
    protected void initProperties() {
        super.initProperties();
        if (exists()) {
            // resource is serialized as system-view (xml)
            properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, "text/xml"));
            Node n = (Node)item;
            // overwrite the default creation date if possible
            try {
                if (n.hasProperty(JcrConstants.JCR_CREATED)) {
                    long creationTime = n.getProperty(JcrConstants.JCR_CREATED).getValue().getLong();
                    properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE,
                        DavConstants.creationDateFormat.format(new Date(creationTime))));
                }
            } catch (RepositoryException e) {
                log.warn("Error while accessing jcr:created property");
            }

            // add node-specific resource properties
            try {
                properties.add(new NodeTypeProperty(JCR_PRIMARYNODETYPE, n.getPrimaryNodeType(), false));
                properties.add(new NodeTypeProperty(JCR_MIXINNODETYPES, n.getMixinNodeTypes(), false));
                properties.add(new DefaultDavProperty(JCR_INDEX, new Integer(n.getIndex()), true));
                addHrefProperty(JCR_REFERENCES, n.getReferences(), true);
                addHrefProperty(JCR_WEAK_REFERENCES, n.getWeakReferences(), true);
                if (n.isNodeType(JcrConstants.MIX_REFERENCEABLE)) {
                    properties.add(new DefaultDavProperty(JCR_UUID, n.getUUID(), true));
                }
            } catch (RepositoryException e) {
                log.error("Failed to retrieve primary nodetype property: " + e.getMessage());
            }
            try {
View Full Code Here

        DavPropertySet properties = new DavPropertySet();
       
        // 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" ) );
        }

        // Need to get the ISO8601 date for properties
        DateTime dt = new DateTime( localResource.lastModified() );
        DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
        String modifiedDate = fmt.print( dt );

        properties.add( new DefaultDavProperty( DavPropertyName.GETLASTMODIFIED, modifiedDate ) );

        properties.add( new DefaultDavProperty( DavPropertyName.CREATIONDATE, modifiedDate ) );

        properties.add( new DefaultDavProperty( DavPropertyName.GETCONTENTLENGTH, localResource.length() ) );
       
        this.properties = properties;
       
        return properties;
    }
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.