public class STDavResource
extends java.lang.Object
Constructor and Description |
---|
STDavResource(DavResourceLocator davResourceLocator,
DavResourceFactory davResourceFactory,
LockManager lockManager,
STDavSession davSession) |
Modifier and Type | Method and Description |
---|---|
void |
addLockManager(LockManager lockmgr)
Add an external
LockManager to this resource. |
void |
addMember(DavResource resource,
InputContext inputContext)
Add the given resource as an internal member to this resource.
|
MultiStatusResponse |
alterProperties(DavPropertySet setProperties,
DavPropertyNameSet removePropertyNames)
Deprecated.
use
alterProperties(List) instead |
MultiStatusResponse |
alterProperties(java.util.List changeList)
Set/add and remove the specified properties from this resource.
|
void |
copy(DavResource destination,
boolean shallow)
Copy this DavResource to the given destination resource
|
static STDavResource |
createSimpleResource(DavResourceLocator davResourceLocator,
DavResourceFactory davResourceFactory)
simple resource is used for OPTIONS request only, it doesn't link with any DBFile or DBFolder
|
DBFile |
createVirtualFile(MutableDataSource mds,
java.lang.String fileName,
java.lang.String encodedPath) |
boolean |
exists()
Returns true if this webdav resource represents an existing repository item.
|
DavResource |
getCollection()
Retrieve the resource this resource is internal member of.
|
java.lang.String |
getComplianceClass()
Returns a comma separated list of all compliance classes the given
resource is fulfilling.
|
java.io.InputStream |
getContent() |
long |
getContentLength()
get the length of the content
|
java.lang.String |
getContentType()
the content type
|
protected long |
getCreationtTime() |
DBObject |
getDBObject() |
Session |
getDBSession() |
java.lang.String |
getDisplayName()
Returns the display name of this resource.
|
java.lang.String |
getEtag() |
DavResourceFactory |
getFactory()
Return the
DavResourceFactory that created this resource. |
java.lang.String |
getHref()
Returns the absolute href of this resource as returned in the
multistatus response body.
|
DavResourceLocator |
getLocator()
Returns the
locator object for this webdav resource,
which encapsulates the information for building the complete 'href'. |
ActiveLock |
getLock(Type type,
Scope scope)
Return the lock present on this webdav resource or
null
if the resource is either not locked or not lockable at all. |
LockManager |
getLockManager() |
ActiveLock[] |
getLocks()
Returns an array of all locks applied to the given resource.
|
Login |
getLogin() |
DavResourceIterator |
getMembers()
Returns an iterator over all internal members.
|
long |
getModificationTime()
Return the time of the last modification or -1 if the modification time
could not be retrieved.
|
protected java.lang.String |
getParentResourcePath() |
STDavResource |
getParentSource()
get parent source
|
DavPropertySet |
getProperties()
Returns all webdav properties present on this resource.
|
DavProperty |
getProperty(DavPropertyName name)
Return the webdav property with the specified name.
|
DavPropertyName[] |
getPropertyNames()
Returns an array of all
property names available
on this resource. |
java.lang.String |
getResourcePath()
Returns the path of the hierarchy element defined by this
DavResource . |
DavSession |
getSession()
Retrieve the
DavSession associated with this resource. |
protected SupportedLock |
getSupportedLock() |
java.lang.String |
getSupportedMethods()
Returns a comma separated list of all METHODS supported by the given
resource.
|
protected java.lang.String |
getWorkspaceHref() |
boolean |
hasLock(Type type,
Scope scope)
Returns true if a lock applies to this resource.
|
protected void |
initProperties(DavPropertySet propertySet) |
boolean |
isCollection()
Returns true if this webdav resource has the resource type 'collection'.
|
boolean |
isLockable(Type type,
Scope scope)
Returns true, if the this resource allows locking.
|
java.util.ArrayList |
listFiles(DBFolder dbFolder)
Returns an array of strings path files in the folder denoted by this path.
|
java.util.ArrayList |
listFolders()
Returns an array of strings path folders in the folder denoted by this path.
|
ActiveLock |
lock(LockInfo reqLockInfo)
Lock this webdav resource with the information retrieve from the request
and return the resulting lock discovery object.
|
void |
move(DavResource destination)
Move this DavResource to the given destination resource
|
ActiveLock |
refreshLock(LockInfo reqLockInfo,
java.lang.String lockToken)
Refresh an existing lock by resetting the timeout.
|
void |
removeMember(DavResource member)
Removes the specified member from this resource.
|
void |
removeProperty(DavPropertyName propertyName)
Remove the specified property from this resource.
|
void |
setAsVirtualFile(MutableDataSource mds,
java.lang.String encodedPath,
DBFile file,
java.lang.String fileName) |
void |
setFile(DBFile afile) |
void |
setLockManager(LockManager lockManager) |
void |
setProperty(DavProperty property)
Add/Set the specified property on this resource.
|
void |
setVirtualName(java.lang.String virtualName) |
void |
spool(OutputContext outputContext)
Spools the resource properties and ev.
|
java.lang.String |
toString() |
void |
unlock(java.lang.String lockToken)
Remove the lock identified by the included lock token from this resource.
|
public STDavResource(DavResourceLocator davResourceLocator, DavResourceFactory davResourceFactory, LockManager lockManager, STDavSession davSession)
davResourceLocator
- the locatordavResourceFactory
- the factorylockManager
- the lock managerdavSession
- the sessionpublic static STDavResource createSimpleResource(DavResourceLocator davResourceLocator, DavResourceFactory davResourceFactory)
davResourceLocator
- davResourceFactory
- public DBObject getDBObject()
public Session getDBSession()
public Login getLogin()
public java.lang.String getComplianceClass()
public java.lang.String getSupportedMethods()
public boolean exists()
public boolean isCollection()
public java.lang.String getDisplayName()
public DavResourceLocator getLocator()
locator
object for this webdav resource,
which encapsulates the information for building the complete 'href'.getResourcePath()
,
getHref()
public java.lang.String getResourcePath()
DavResource
.
This method is a shortcut for DavResource.getLocator().getResourcePath()
.DavResource
.public java.lang.String getHref()
public long getModificationTime()
public void spool(OutputContext outputContext) throws java.io.IOException
outputContext
- the contextjava.io.IOException
- a problempublic java.io.InputStream getContent()
public long getContentLength()
public java.lang.String getContentType()
public java.lang.String getEtag()
public DavPropertyName[] getPropertyNames()
property names
available
on this resource.public DavProperty getProperty(DavPropertyName name)
name
- name of the webdav propertyDavProperty
with the given name or null
if the property does not exist.public DavPropertySet getProperties()
DavPropertySet
containing all webdav property
of this resource.protected void initProperties(DavPropertySet propertySet) throws java.lang.Exception
propertySet
- the propertiesjava.lang.Exception
- a serious problem.public void setProperty(DavProperty property) throws DavException
property
- the propertyDavException
- if an error occurspublic void removeProperty(DavPropertyName propertyName) throws DavException
propertyName
- the nameDavException
- if an error occurspublic MultiStatusResponse alterProperties(DavPropertySet setProperties, DavPropertyNameSet removePropertyNames) throws DavException
alterProperties(List)
insteadsetProperties
- Set of properties to be added or modifiedremovePropertyNames
- Set of property names to be removedDavException
- if an error occurred. This may be the case if the
general state of the resource prevents any properties to be set or removed
(e.g. due to a lock).public MultiStatusResponse alterProperties(java.util.List changeList) throws DavException
changeList
- list containing DavPropertyName
objects (for
properties to be removed) and DavProperty
objects (for
properties to be added/set).DavException
- if an error occurred. This may be the case if the
general state of the resource prevents any properties to be set or removed
(e.g. due to a lock).public DavResource getCollection()
null
is returned.protected java.lang.String getParentResourcePath()
@CheckReturnValue @Nonnull public java.lang.String toString()
toString
in class java.lang.Object
public void addMember(DavResource resource, InputContext inputContext) throws DavException
resource
- DavResource
to be added as internal member.inputContext
- Context providing the properties and content for the
internal member to be created or replaced.DavException
- a problempublic DavResourceIterator getMembers()
DavResourceIterator
over all internal members.public void removeMember(DavResource member) throws DavException
member
- the memberDavException
- a problempublic STDavResource getParentSource() throws DavException
DavException
public void move(DavResource destination) throws DavException
destination
- the destinationDavException
- a problempublic void copy(DavResource destination, boolean shallow) throws DavException
destination
- the destinationshallow
- shallow onlyDavException
- a problempublic boolean isLockable(Type type, Scope scope)
type
- the typescope
- the scopepublic boolean hasLock(Type type, Scope scope)
type
- the typescope
- the scopepublic ActiveLock getLock(Type type, Scope scope)
null
if the resource is either not locked or not lockable at all. Note, that
a resource may have a lock that is inherited by a deep lock enforced on
one of its 'parent' resources.type
- the typescope
- the scopenull
if this
resource has no lock applying it. If an error occurs while retrieving the
lock information null
is returned as well.public ActiveLock[] getLocks()
public ActiveLock lock(LockInfo reqLockInfo) throws DavException
reqLockInfo
- lock info as retrieved from the request.DavException
is thrown.DavException
- if the lock could not be obtained.public ActiveLock refreshLock(LockInfo reqLockInfo, java.lang.String lockToken) throws DavException
reqLockInfo
- lock info as retrieved from the request.lockToken
- identifying the lock to be refreshed.DavException
is thrown.DavException
- if the lock could not be refreshed.public void unlock(java.lang.String lockToken) throws DavException
lockToken
- identifying the lock to be removed.DavException
- if the lock could not be removed.public void addLockManager(LockManager lockmgr)
LockManager
to this resource. This method may
throw UnsupportedOperationException
if the resource does handle
locking itself.lockmgr
- the managerLockManager
public DavResourceFactory getFactory()
DavResourceFactory
that created this resource.public DavSession getSession()
DavSession
associated with this resource.public void setLockManager(LockManager lockManager)
lockManager
- the managerpublic LockManager getLockManager()
protected long getCreationtTime()
protected java.lang.String getWorkspaceHref()
protected SupportedLock getSupportedLock()
public java.util.ArrayList listFolders() throws java.lang.Exception
java.lang.Exception
- Exception A serious problempublic java.util.ArrayList listFiles(DBFolder dbFolder) throws java.lang.Exception
dbFolder
- the folder.java.lang.Exception
- a problempublic void setVirtualName(java.lang.String virtualName)
public void setFile(DBFile afile)
public DBFile createVirtualFile(MutableDataSource mds, java.lang.String fileName, java.lang.String encodedPath) throws java.lang.Exception
java.lang.Exception
public void setAsVirtualFile(MutableDataSource mds, java.lang.String encodedPath, DBFile file, java.lang.String fileName) throws java.lang.Exception
java.lang.Exception
stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.