Class WebdavNsNode

java.lang.Object
org.bedework.webdav.servlet.shared.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:
  • Field Details

    • exists

      protected boolean exists
      Does the resource exist?
    • wdSysIntf

      protected WdSysIntf wdSysIntf
    • 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
    • urlHandler

      protected UrlHandler urlHandler
  • Constructor Details

    • 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 Details

    • getCurrentAccess

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

      public abstract void update()
      Update this node after changes.
    • trailSlash

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

      public abstract Collection<? extends WdEntity<?>> getChildren(Supplier<Object> filterGetter)
      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
    • getPath

      public String getPath()
      Returns:
      String
    • generateHref

      public void generateHref(org.bedework.util.xml.XmlEmit xml)
      Parameters:
      xml - emitter
    • generateHref

      public void generateHref(org.bedework.util.xml.XmlEmit xml, String uri)
      Parameters:
      xml - emitter
      uri -
    • getPrefixedUri

      public String getPrefixedUri()
      Returns:
      this nodes fully prefixed uri
    • getPrefixedUri

      public String getPrefixedUri(String uri)
      Parameters:
      uri -
      Returns:
      fully prefixed uri
    • generateUrl

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

      public boolean removeProperty(Element val, WebdavNsNode.SetPropertyResult spr)
      Remove the given property for this node.
      Parameters:
      val - Element defining property to remove
      spr - Holds reult of removing property
      Returns:
      boolean true if property recognized.
    • setProperty

      public boolean setProperty(Element val, WebdavNsNode.SetPropertyResult spr)
      Set the given property for this node.
      Parameters:
      val - Element defining property to set
      spr - Holds result of setting property
      Returns:
      boolean true if property recognized and processed.
    • 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)
      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
    • 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
    • getPropertyNames

      public Collection<WebdavNsNode.PropertyTagEntry> getPropertyNames()
      Return a set of PropertyTagEntry defining properties this node supports.
      Returns:
      Collection of PropertyTagEntry
    • getSupportedReports

      public Collection<QName> getSupportedReports()
      Return a set of QName defining reports this node supports.
      Returns:
      Collection of QName
    • 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
    • getEncodedUri

      public String getEncodedUri()
      Returns:
      String encoded uri
    • getEncodedUri

      public String getEncodedUri(String uri)
      Parameters:
      uri - to be encoded
      Returns:
      String encoded 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
    • setAlias

      public void setAlias(boolean val)
      Parameters:
      val -
    • getAlias

      public boolean getAlias()
      Returns:
      boolean true if an alias
    • setTargetUri

      public void setTargetUri(String val)
      Parameters:
      val -
    • getTargetUri

      public String getTargetUri()
      Returns:
      String uri
    • getContent

      public WebdavNsIntf.Content getContent(String contentType)
      Returns the content.
      Parameters:
      contentType -
      Returns:
      Content object
    • getContentStream

      public InputStream getContentStream()
      Returns an InputStream for the content.
      Returns:
      InputStream A reader for the content.
    • getContentString

      public String getContentString(String contentType)
      Return string content
      Returns:
      String content.
    • setDefaults

      public void setDefaults(QName methodTag)
      Parameters:
      methodTag - - acts as a flag for the method type
    • writeContent

      public abstract String writeContent(org.bedework.util.xml.XmlEmit xml, Writer wtr, String contentType)
      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
    • getContentBinary

      public abstract boolean getContentBinary()
      Returns:
      boolean true if this is binary content
    • getContentLang

      public abstract String getContentLang()
      Returns:
      String lang
    • getContentLen

      public abstract long getContentLen()
      Returns:
      long content length
    • getContentType

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

      public abstract String getCreDate()
      Returns:
      String credate
    • getDisplayname

      public abstract String getDisplayname()
      Returns:
      String name
    • getEtagValue

      public abstract String getEtagValue(boolean strong)
      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
    • getLastmodDate

      public abstract String getLastmodDate()
      Returns:
      String last mod date
    • getOwner

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

      public abstract WdCollection<?> getCollection(boolean deref)
      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
    • getImmediateTargetCollection

      public abstract WdCollection<?> getImmediateTargetCollection()
    • allowsSyncReport

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

      public abstract boolean getDeleted()
      Returns:
      true if this represents a deleted resource.
    • getSyncToken

      public abstract String getSyncToken()
      Returns:
      String sync-token, a URI
    • addPropEntry

      protected static void addPropEntry(HashMap<QName,WebdavNsNode.PropertyTagEntry> propertyNames, QName tag)
    • addPropEntry

      protected static void addPropEntry(HashMap<QName,WebdavNsNode.PropertyTagEntry> propertyNames, QName tag, boolean inAllProp)
    • hashCode

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getLogger

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