public class DavResourceImpl extends Object implements DavResource, BindableResource, JcrConstants
| Modifier and Type | Field and Description |
|---|---|
static String |
COMPLIANCE_CLASSES |
static String |
METHODS |
protected DavPropertySet |
properties |
protected boolean |
propsInitialized |
JCR_AUTOCREATED, JCR_BASEVERSION, JCR_CHILD, JCR_CHILDNODEDEFINITION, JCR_CONTENT, JCR_CREATED, JCR_DATA, JCR_DEFAULTPRIMARYTYPE, JCR_DEFAULTVALUES, JCR_ENCODING, JCR_FROZENMIXINTYPES, JCR_FROZENNODE, JCR_FROZENPRIMARYTYPE, JCR_FROZENUUID, JCR_HASORDERABLECHILDNODES, JCR_ISCHECKEDOUT, JCR_ISMIXIN, JCR_LANGUAGE, JCR_LASTMODIFIED, JCR_LOCKISDEEP, JCR_LOCKOWNER, JCR_MANDATORY, JCR_MERGEFAILED, JCR_MIMETYPE, JCR_MIXINTYPES, JCR_MULTIPLE, JCR_NAME, JCR_NODETYPENAME, JCR_ONPARENTVERSION, JCR_PATH, JCR_PREDECESSORS, JCR_PRIMARYITEMNAME, JCR_PRIMARYTYPE, JCR_PROPERTYDEFINITION, JCR_PROTECTED, JCR_REQUIREDPRIMARYTYPES, JCR_REQUIREDTYPE, JCR_ROOTVERSION, JCR_SAMENAMESIBLINGS, JCR_SCORE, JCR_STATEMENT, JCR_SUCCESSORS, JCR_SUPERTYPES, JCR_SYSTEM, JCR_UUID, JCR_VALUECONSTRAINTS, JCR_VERSIONABLEUUID, JCR_VERSIONHISTORY, JCR_VERSIONLABELS, JCR_VERSIONSTORAGE, MIX_LOCKABLE, MIX_REFERENCEABLE, MIX_SHAREABLE, MIX_VERSIONABLE, NT_BASE, NT_CHILDNODEDEFINITION, NT_FILE, NT_FOLDER, NT_FROZENNODE, NT_HIERARCHYNODE, NT_LINKEDFILE, NT_NODETYPE, NT_PROPERTYDEFINITION, NT_QUERY, NT_RESOURCE, NT_UNSTRUCTURED, NT_VERSION, NT_VERSIONEDCHILD, NT_VERSIONHISTORY, NT_VERSIONLABELS| Constructor and Description |
|---|
DavResourceImpl(DavResourceLocator locator,
DavResourceFactory factory,
DavSession session,
ResourceConfig config,
boolean isCollection)
Create a new
DavResource. |
DavResourceImpl(DavResourceLocator locator,
DavResourceFactory factory,
DavSession session,
ResourceConfig config,
Node node)
Create a new
DavResource. |
| Modifier and Type | Method and Description |
|---|---|
void |
addLockManager(LockManager lockMgr)
Add an external
LockManager to this resource. |
void |
addMember(DavResource member,
InputContext inputContext)
Adds a new member to this resource.
|
MultiStatusResponse |
alterProperties(List<? extends PropEntry> changeList)
Set/add and remove the specified properties from this resource.
|
void |
bind(DavResource collection,
DavResource newBinding)
Will add a new binding to the given collection referencing this resource.
|
void |
copy(DavResource destination,
boolean shallow)
Copy this DavResource to the given destination resource
|
boolean |
exists()
Returns true if this webdav resource represents an existing repository item.
|
DavResource |
getCollection()
Retrieve the resource this resource is internal member of.
|
String |
getComplianceClass()
Returns a comma separated list of all compliance classes the given
resource is fulfilling.
|
String |
getDisplayName()
Returns the the last segment of the resource path.
|
protected ExportContext |
getExportContext(OutputContext outputCtx)
Returns a new
ExportContext |
DavResourceFactory |
getFactory()
Return the
DavResourceFactory that created this resource. |
String |
getHref()
Returns the absolute href of this resource as returned in the
multistatus response body.
|
protected ImportContext |
getImportContext(InputContext inputCtx,
String systemId)
Returns a new
ImportContext |
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. |
ActiveLock[] |
getLocks()
Returns an array of all locks applied to the given resource.
|
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 Node |
getNode()
Returns the node that is wrapped by this resource.
|
Set<ParentElement> |
getParentElements()
Will retrieve a collection of parent elements of the bindable resource
representing the parent set.
|
DavPropertySet |
getProperties()
Returns all webdav properties present on this resource that will be
return upon a
DavConstants.PROPFIND_ALL_PROP request. |
DavProperty<?> |
getProperty(DavPropertyName name)
Return the webdav property with the specified name.
|
protected PropertyExportContext |
getPropertyExportContext()
Returns a new
PropertyExportContext. |
protected PropertyImportContext |
getPropertyImportContext(List<? extends PropEntry> changeList)
Returns a new
PropertyImportContext. |
DavPropertyName[] |
getPropertyNames()
Returns an array of all
property names available
on this resource. |
String |
getResourcePath()
Returns the path of the hierarchy element defined by this
DavResource. |
DavSession |
getSession()
Retrieve the
DavSession associated with this resource. |
String |
getSupportedMethods()
Returns a comma separated list of all METHODS supported by the given
resource.
|
boolean |
hasLock(Type type,
Scope scope)
Returns true if a lock applies to this resource.
|
protected void |
initProperties()
Fill the set of properties
|
boolean |
isCollection()
Returns true if this webdav resource has the resourcetype 'collection'.
|
boolean |
isLockable(Type type,
Scope scope)
Returns true, if the this resource allows locking.
|
ActiveLock |
lock(LockInfo lockInfo)
Lock this webdav resource with the information retrieve from the request
and return the resulting lockdiscovery object.
|
void |
move(DavResource destination)
Move this DavResource to the given destination resource
|
void |
rebind(DavResource collection,
DavResource newBinding)
Will rebind the resource to the given collection.
|
ActiveLock |
refreshLock(LockInfo lockInfo,
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 |
setProperty(DavProperty<?> property)
Add/Set the specified property on this resource.
|
void |
spool(OutputContext outputContext)
If this resource exists and the specified context is not
null
this implementation build a new ExportContext based on the specified
context and forwards the export to its IOManager. |
void |
unlock(String lockToken)
Remove the lock identified by the included lock token from this resource.
|
public static final String METHODS
public static final String COMPLIANCE_CLASSES
protected DavPropertySet properties
protected boolean propsInitialized
public DavResourceImpl(DavResourceLocator locator, DavResourceFactory factory, DavSession session, ResourceConfig config, boolean isCollection) throws DavException
DavResource.locator - factory - session - config - isCollection - DavExceptionpublic DavResourceImpl(DavResourceLocator locator, DavResourceFactory factory, DavSession session, ResourceConfig config, Node node) throws DavException
DavResource.locator - factory - session - config - node - DavExceptionpublic String getComplianceClass()
DavResourcegetComplianceClass in interface DavResourceDavResource.getComplianceClass()public String getSupportedMethods()
DavResourcegetSupportedMethods in interface DavResourceDavResource.getSupportedMethods()public boolean exists()
DavResourceexists in interface DavResource)public boolean isCollection()
DavResourceisCollection in interface DavResourceDavResource.isCollection()public DavResourceLocator getLocator()
DavResourcelocator object for this webdav resource,
which encapsulates the information for building the complete 'href'.getLocator in interface DavResourceDavResource.getLocator()public String getResourcePath()
DavResourceDavResource.
This method is a shortcut for DavResource.getLocator().getResourcePath().getResourcePath in interface DavResourceDavResource.DavResource.getResourcePath()public String getHref()
DavResourcegetHref in interface DavResourceDavResource.getHref()public String getDisplayName()
Note that this must not correspond to the name of the underlying repository item for two reasons:
getDisplayName in interface DavResourceDavResource.getDisplayName()public long getModificationTime()
DavResourcegetModificationTime in interface DavResourceDavResource.getModificationTime()public void spool(OutputContext outputContext) throws IOException
null
this implementation build a new ExportContext based on the specified
context and forwards the export to its IOManager. If the
IOManager.exportContent(ExportContext, DavResource) fails,
an IOException is thrown.spool in interface DavResourceoutputContext - The output context.IOException - if the export fails.DavResource.spool(OutputContext),
ResourceConfig.getIOManager()public DavProperty<?> getProperty(DavPropertyName name)
DavResourcegetProperty in interface DavResourcename - name of the webdav propertyDavProperty with the given name or null
if the property does not exist.DavResource.getProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)public DavPropertySet getProperties()
DavResourceDavConstants.PROPFIND_ALL_PROP request. The
implementation may in addition expose other (protected or calculated)
properties which should be marked accordingly (see also
DavProperty.isInvisibleInAllprop().getProperties in interface DavResourceDavPropertySet containing at least all properties
of this resource that are exposed in 'allprop' PROPFIND request.DavResource.getProperties()public DavPropertyName[] getPropertyNames()
DavResourceproperty names available
on this resource.getPropertyNames in interface DavResourceDavResource.getPropertyNames()protected void initProperties()
public void setProperty(DavProperty<?> property) throws DavException
DavResourcesetProperty in interface DavResourceproperty - DavExceptionDavResource.setProperty(org.apache.jackrabbit.webdav.property.DavProperty)public void removeProperty(DavPropertyName propertyName) throws DavException
DavResourceremoveProperty in interface DavResourcepropertyName - DavExceptionDavResource.removeProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)public MultiStatusResponse alterProperties(List<? extends PropEntry> changeList) throws DavException
DavResourcealterProperties in interface DavResourcechangeList - 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()
DavResourcegetCollection in interface DavResourcenull is returned.DavResource.getCollection()public DavResourceIterator getMembers()
DavResourcegetMembers in interface DavResourceDavResourceIterator over all internal members.DavResource.getMembers()public void addMember(DavResource member, InputContext inputContext) throws DavException
addMember in interface DavResourcemember - DavResource to be added as internal member.inputContext - Context providing the properties and content for the
internal member to be created or replaced.DavExceptionDavResource.addMember(DavResource, org.apache.jackrabbit.webdav.io.InputContext)public void removeMember(DavResource member) throws DavException
DavResourceremoveMember in interface DavResourceDavExceptionDavResource.removeMember(DavResource)public void move(DavResource destination) throws DavException
DavResourcemove in interface DavResourceDavExceptionDavResource.move(DavResource)public void copy(DavResource destination, boolean shallow) throws DavException
DavResourcecopy in interface DavResourceDavExceptionDavResource.copy(DavResource, boolean)public boolean isLockable(Type type, Scope scope)
DavResourceisLockable in interface DavResourcetype - scope - Type.WRITE and scope is Scope.EXCLUSIVEDavResource.isLockable(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)public boolean hasLock(Type type, Scope scope)
DavResourcehasLock in interface DavResourceDavResource.hasLock(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)public ActiveLock getLock(Type type, Scope scope)
DavResourcenull
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.getLock in interface DavResourcenull if this
resource has no lock applying it. If an error occurs while retrieving the
lock information null is returned as well.DavResource.getLock(Type, Scope)public ActiveLock[] getLocks()
DavResourcegetLocks in interface DavResourceDavResource.getLocks()public ActiveLock lock(LockInfo lockInfo) throws DavException
DavResourcelock in interface DavResourcelockInfo - lock info as retrieved from the request.DavException is thrown.DavException - if the lock could not be obtained.DavResource.lock(LockInfo)public ActiveLock refreshLock(LockInfo lockInfo, String lockToken) throws DavException
DavResourcerefreshLock in interface DavResourcelockInfo - 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.DavResource.refreshLock(LockInfo, String)public void unlock(String lockToken) throws DavException
DavResourceunlock in interface DavResourcelockToken - identifying the lock to be removed.DavException - if the lock could not be removed.DavResource.unlock(String)public void addLockManager(LockManager lockMgr)
DavResourceLockManager to this resource. This method may
throw UnsupportedOperationException if the resource does handle
locking itself.addLockManager in interface DavResourceDavResource.addLockManager(org.apache.jackrabbit.webdav.lock.LockManager)public DavResourceFactory getFactory()
DavResourceDavResourceFactory that created this resource.getFactory in interface DavResourceDavResource.getFactory()public DavSession getSession()
DavResourceDavSession associated with this resource.getSession in interface DavResourceDavResource.getSession()public void bind(DavResource collection, DavResource newBinding) throws DavException
BindableResourcebind in interface BindableResourcecollection - the collection to create the new binding in.newBinding - the new bindingDavExceptionBindableResource.rebind(DavResource, DavResource)public void rebind(DavResource collection, DavResource newBinding) throws DavException
BindableResourcerebind in interface BindableResourcecollection - the collection to create the new binding in.newBinding - the new bindingDavExceptionBindableResource.rebind(DavResource, DavResource)public Set<ParentElement> getParentElements()
BindableResourcegetParentElements in interface BindableResourceBindableResource.getParentElements()protected Node getNode()
protected ImportContext getImportContext(InputContext inputCtx, String systemId) throws IOException
ImportContextinputCtx - systemId - ImportContextIOExceptionprotected ExportContext getExportContext(OutputContext outputCtx) throws IOException
ExportContextoutputCtx - ExportContextIOExceptionprotected PropertyImportContext getPropertyImportContext(List<? extends PropEntry> changeList)
PropertyImportContext.changeList - PropertyImportContext.protected PropertyExportContext getPropertyExportContext()
PropertyExportContext.PropertyExportContextCopyright © 2004–2021 The Apache Software Foundation. All rights reserved.