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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classResult from setting or removing property -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleantrue if this is an aliasprotected booleanTrue if GET is allowedprotected booleanTrue if this node is a collectionprotected booleanDoes the resource exist?protected booleanTrue if this node is a groupprotected StringSuitable for displayprotected intCan be set to indicate some sort of abnormal condition on this node, e.g.protected Stringprotected StringUri of the node.protected UrlHandlerprotected booleanTrue if this node is a userprotected WdSysIntf -
Constructor Summary
ConstructorsConstructorDescriptionWebdavNsNode(WdSysIntf sysi, UrlHandler urlHandler, String path, boolean collection, String uri) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidaddPropEntry(HashMap<QName, WebdavNsNode.PropertyTagEntry> propertyNames, QName tag) protected static voidaddPropEntry(HashMap<QName, WebdavNsNode.PropertyTagEntry> propertyNames, QName tag, boolean inAllProp) abstract booleanbooleanvoidgenerateHref(org.bedework.util.xml.XmlEmit xml) voidgenerateHref(org.bedework.util.xml.XmlEmit xml, String uri) booleangeneratePropertyValue(QName tag, WebdavNsIntf intf, boolean allProp) Emit the property indicated by the tag.voidgenerateUrl(org.bedework.util.xml.XmlEmit xml, QName tag, String uri, boolean exists) booleangetAlias()booleanabstract Collection<? extends WdEntity<?>>getChildren(Supplier<Object> filterGetter) Return a collection of children objects.abstract WdCollection<?>getCollection(boolean deref) The node may refer to a collection object which may in fact be an alias to another.getContent(String contentType) Returns the content.abstract booleanabstract Stringabstract longReturns an InputStream for the content.getContentString(String contentType) Return string contentabstract StringA content type of null implies no content (or we don't know)abstract Stringabstract org.bedework.access.CurrentAccessGet the current access granted to this principal for this node.abstract booleanabstract StringgetEncodedUri(String uri) abstract StringgetEtagValue(boolean strong) Entity tags are defined in RFC2068 - they are supposed to provide some sort of indication the data has changed - e.g.booleanabstract WdCollection<?>abstract Stringorg.bedework.util.logging.BwLoggerabstract org.bedework.access.AccessPrincipalgetOwner()Should return a value suitable for WebdavNsIntf.makeUserHrefgetPath()getPrefixedUri(String uri) Return a set of PropertyTagEntry defining properties this node supports.intReturn a set of QName defining reports this node supports.abstract StringgetUri()Get uriinthashCode()voidinit(boolean content) This method is called before each setter/getter takes any action.booleanbooleanReturn true if this represents a principalbooleanknownProperty(QName tag) Return true if a call to generatePropertyValue will return a value.booleanRemove the given property for this node.voidsetAlias(boolean val) voidsetAllowsGet(boolean val) voidsetDefaults(QName methodTag) voidsetExists(boolean val) booleansetProperty(Element val, WebdavNsNode.SetPropertyResult spr) Set the given property for this node.voidsetStatus(int val) voidsetTargetUri(String val) voidSet uriabstract booleanTrailing "/" on uri?abstract voidupdate()Update this node after changes.abstract StringwriteContent(org.bedework.util.xml.XmlEmit xml, Writer wtr, String contentType) Called during xml emission to write the content for the node.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.bedework.util.logging.Logged
audit, debug, debug, debug, enableAuditLogger, enableErrorLogger, enableMetricsLogger, error, error, error, getLogLevel, info, isAuditLoggerEnabled, isErrorLoggerEnabled, isMetricsDebugEnabled, isMetricsLoggerEnabled, metrics, setLoggerClass, setLoggerClass, trace, trace, trace, warn
-
Field Details
-
exists
protected boolean existsDoes the resource exist? -
wdSysIntf
-
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
Suitable for display -
collection
protected boolean collectionTrue if this node is a collection -
userPrincipal
protected boolean userPrincipalTrue if this node is a user -
groupPrincipal
protected boolean groupPrincipalTrue if this node is a group -
allowsGet
protected boolean allowsGetTrue if GET is allowed -
status
protected int statusCan be set to indicate some sort of abnormal condition on this node, e.g. no access. -
alias
protected boolean aliastrue if this is an alias -
targetUri
-
urlHandler
-
-
Constructor Details
-
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
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
- Returns:
- String
-
generateHref
public void generateHref(org.bedework.util.xml.XmlEmit xml) - Parameters:
xml- emitter
-
generateHref
- Parameters:
xml- emitteruri-
-
getPrefixedUri
- Returns:
- this nodes fully prefixed uri
-
getPrefixedUri
- Parameters:
uri-- Returns:
- fully prefixed uri
-
generateUrl
- Parameters:
xml- emittertag-uri-exists- - true if we KNOW it exists
-
knownProperty
Return true if a call to generatePropertyValue will return a value.- Parameters:
tag-- Returns:
- boolean
-
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
Return a set of PropertyTagEntry defining properties this node supports.- Returns:
- Collection of PropertyTagEntry
-
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
Set uri- Parameters:
val-
-
getUri
Get uri- Returns:
- String uri
-
getEncodedUri
- Returns:
- String encoded uri
-
getEncodedUri
- 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
- Parameters:
val-
-
getTargetUri
- Returns:
- String uri
-
getContent
Returns the content.- Parameters:
contentType-- Returns:
- Content object
-
getContentStream
Returns an InputStream for the content.- Returns:
- InputStream A reader for the content.
-
getContentString
Return string content- Returns:
- String content.
-
setDefaults
- 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 streamwtr- - 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
- Returns:
- String lang
-
getContentLen
public abstract long getContentLen()- Returns:
- long content length
-
getContentType
A content type of null implies no content (or we don't know)- Returns:
- String content type
-
getCreDate
- Returns:
- String credate
-
getDisplayname
- Returns:
- String name
-
getEtagValue
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
- 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
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
-
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
- 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() -
equals
-
getLogger
public org.bedework.util.logging.BwLogger getLogger()- Specified by:
getLoggerin interfaceorg.bedework.util.logging.Logged
-