Class WebdavNsNode

  • All Implemented Interfaces:
    Serializable, org.bedework.util.logging.Logged
    Direct Known Subclasses:
    WebdavPrincipalNode

    public abstract class WebdavNsNode
    extends Object
    implements Serializable, org.bedework.util.logging.Logged
    Represents a node in the underlying namespace for which this servlet is acting as a gateway. This could be a file system, a set of dynamically created objects or some sort of CMS for example.
    Author:
    Mike Douglass douglm rpi.edu
    See Also:
    Serialized Form
    • Field Detail

      • exists

        protected boolean exists
        Does the resource exist?
      • uri

        protected String uri
        Uri of the node. These are relative to the root of the namespace this interface represents and should start with a "/". For example, if this namespace is part of a file system starting at uabc in /var/local/uabc and we are referring to a directory x at /var/local/uabc/a/x then the uri should be /a/x/
      • path

        protected String path
        Suitable for display
      • collection

        protected boolean collection
        True if this node is a collection
      • userPrincipal

        protected boolean userPrincipal
        True if this node is a user
      • groupPrincipal

        protected boolean groupPrincipal
        True if this node is a group
      • allowsGet

        protected boolean allowsGet
        True if GET is allowed
      • status

        protected int status
        Can be set to indicate some sort of abnormal condition on this node, e.g. no access.
      • alias

        protected boolean alias
        true if this is an alias
      • targetUri

        protected String targetUri
    • Constructor Detail

      • WebdavNsNode

        public WebdavNsNode​(WdSysIntf sysi,
                            UrlHandler urlHandler,
                            String path,
                            boolean collection,
                            String uri)
        Constructor
        Parameters:
        sysi - system interface
        urlHandler - - needed for building hrefs.
        path - - resource path
        collection - - true if this is a collection
        uri - - the uri (XXX is that the same as the path?)
    • Method Detail

      • getCurrentAccess

        public abstract org.bedework.access.CurrentAccess getCurrentAccess()
                                                                    throws WebdavException
        Get the current access granted to this principal for this node.
        Returns:
        CurrentAccess
        Throws:
        WebdavException
      • trailSlash

        public abstract boolean trailSlash()
        Trailing "/" on uri?
        Returns:
        boolean
      • getChildren

        public abstract Collection<? extends WdEntity<?>> getChildren​(Supplier<Object> filterGetter)
                                                               throws WebdavException
        Return a collection of children objects. For example, this is object represents a folder, they may be file objects or a mix of file and folder objects. These are not node objects.

        Default is to return null

        Parameters:
        filterGetter - non-null if there is a filter
        Returns:
        Collection of children
        Throws:
        WebdavException - on fatal error
      • getPath

        public String getPath()
        Returns:
        String
      • generateHref

        public void generateHref​(org.bedework.util.xml.XmlEmit xml)
                          throws WebdavException
        Parameters:
        xml - emitter
        Throws:
        WebdavException
      • generateUrl

        public void generateUrl​(org.bedework.util.xml.XmlEmit xml,
                                QName tag,
                                String uri,
                                boolean exists)
                         throws WebdavException
        Parameters:
        xml - emitter
        tag -
        uri -
        exists - - true if we KNOW it exists
        Throws:
        WebdavException
      • knownProperty

        public boolean knownProperty​(QName tag)
        Return true if a call to generatePropertyValue will return a value.
        Parameters:
        tag -
        Returns:
        boolean
      • generatePropertyValue

        public boolean generatePropertyValue​(QName tag,
                                             WebdavNsIntf intf,
                                             boolean allProp)
                                      throws WebdavException
        Emit the property indicated by the tag.
        Parameters:
        tag - QName defining property
        intf - WebdavNsIntf
        allProp - true if we're doing allprop
        Returns:
        boolean true if emitted
        Throws:
        WebdavException
      • init

        public void init​(boolean content)
        This method is called before each setter/getter takes any action. It allows the concrete implementation to defer some expensive operation to just before the first call.
        Parameters:
        content - boolean flag indicating if this is a content related property - that is a property which requires fetching and/or rendering the content
      • isPrincipal

        public boolean isPrincipal()
        Return true if this represents a principal
        Returns:
        boolean
      • setExists

        public void setExists​(boolean val)
        Parameters:
        val - boolean true if node exists
      • getExists

        public boolean getExists()
        Returns:
        boolean true if node exists
      • setUri

        public void setUri​(String val)
        Set uri
        Parameters:
        val -
      • getUri

        public String getUri()
        Get uri
        Returns:
        String uri
      • isCollection

        public boolean isCollection()
        Returns:
        boolean true for a collection
      • setAllowsGet

        public void setAllowsGet​(boolean val)
        Parameters:
        val - boolean true if node allows get
      • getAllowsGet

        public boolean getAllowsGet()
        Returns:
        true if node allows get
      • setStatus

        public void setStatus​(int val)
        Parameters:
        val - in status
      • getStatus

        public int getStatus()
        Returns:
        int sttaus
      • writeContent

        public abstract String writeContent​(org.bedework.util.xml.XmlEmit xml,
                                            Writer wtr,
                                            String contentType)
                                     throws WebdavException
        Called during xml emission to write the content for the node.
        Parameters:
        xml - - if this is embedded in an xml stream
        wtr - - if standalone output or no xml stream initialized.
        contentType - desired content type or null for default.
        Returns:
        actual contentType
        Throws:
        WebdavException
      • getContentBinary

        public abstract boolean getContentBinary()
                                          throws WebdavException
        Returns:
        boolean true if this is binary content
        Throws:
        WebdavException
      • getContentType

        public abstract String getContentType()
                                       throws WebdavException
        A content type of null implies no content (or we don't know)
        Returns:
        String content type
        Throws:
        WebdavException
      • getEtagValue

        public abstract String getEtagValue​(boolean strong)
                                     throws WebdavException
        Entity tags are defined in RFC2068 - they are supposed to provide some sort of indication the data has changed - e.g. a checksum.

        There are weak and strong tags

        This methods should return a suitable value for that tag.

        Parameters:
        strong -
        Returns:
        String
        Throws:
        WebdavException
      • getOwner

        public abstract org.bedework.access.AccessPrincipal getOwner()
                                                              throws WebdavException
        Should return a value suitable for WebdavNsIntf.makeUserHref
        Returns:
        AccessPrincipal owner
        Throws:
        WebdavException
      • getCollection

        public abstract WdCollection<?> getCollection​(boolean deref)
                                               throws WebdavException
        The node may refer to a collection object which may in fact be an alias to another. For deletions we want to remove the alias itself.

        Move and rename are also targetted at the alias.

        Other operations are probably intended to work on the underlying target of the alias.

        Parameters:
        deref - true if we want to act upon the target of an alias.
        Returns:
        Collection this node represents
        Throws:
        WebdavException
      • allowsSyncReport

        public abstract boolean allowsSyncReport()
                                          throws WebdavException
        Returns:
        true if this node allows a sync-report.
        Throws:
        WebdavException
      • getDeleted

        public abstract boolean getDeleted()
                                    throws WebdavException
        Returns:
        true if this represents a deleted resource.
        Throws:
        WebdavException
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getLogger

        public org.bedework.util.logging.BwLogger getLogger()
        Specified by:
        getLogger in interface org.bedework.util.logging.Logged