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
- DavException
public DavResourceImpl(DavResourceLocator locator, DavResourceFactory factory, DavSession session, ResourceConfig config, Node node) throws DavException
DavResource
.locator
- factory
- session
- config
- node
- DavException
public String getComplianceClass()
DavResource
getComplianceClass
in interface DavResource
DavResource.getComplianceClass()
public String getSupportedMethods()
DavResource
getSupportedMethods
in interface DavResource
DavResource.getSupportedMethods()
public boolean exists()
DavResource
exists
in interface DavResource
)
public boolean isCollection()
DavResource
isCollection
in interface DavResource
DavResource.isCollection()
public DavResourceLocator getLocator()
DavResource
locator
object for this webdav resource,
which encapsulates the information for building the complete 'href'.getLocator
in interface DavResource
DavResource.getLocator()
public String getResourcePath()
DavResource
DavResource
.
This method is a shortcut for DavResource.getLocator().getResourcePath()
.getResourcePath
in interface DavResource
DavResource
.DavResource.getResourcePath()
public String getHref()
DavResource
getHref
in interface DavResource
DavResource.getHref()
public String getDisplayName()
Note that this must not correspond to the name of the underlying repository item for two reasons:
getDisplayName
in interface DavResource
DavResource.getDisplayName()
public long getModificationTime()
DavResource
getModificationTime
in interface DavResource
DavResource.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 DavResource
outputContext
- The output context.IOException
- if the export fails.DavResource.spool(OutputContext)
,
ResourceConfig.getIOManager()
public DavProperty<?> getProperty(DavPropertyName name)
DavResource
getProperty
in interface DavResource
name
- 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()
DavResource
DavConstants.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 DavResource
DavPropertySet
containing at least all properties
of this resource that are exposed in 'allprop' PROPFIND request.DavResource.getProperties()
public DavPropertyName[] getPropertyNames()
DavResource
property names
available
on this resource.getPropertyNames
in interface DavResource
DavResource.getPropertyNames()
protected void initProperties()
public void setProperty(DavProperty<?> property) throws DavException
DavResource
setProperty
in interface DavResource
property
- DavException
DavResource.setProperty(org.apache.jackrabbit.webdav.property.DavProperty)
public void removeProperty(DavPropertyName propertyName) throws DavException
DavResource
removeProperty
in interface DavResource
propertyName
- DavException
DavResource.removeProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
public MultiStatusResponse alterProperties(List<? extends PropEntry> changeList) throws DavException
DavResource
alterProperties
in interface DavResource
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()
DavResource
getCollection
in interface DavResource
null
is returned.DavResource.getCollection()
public DavResourceIterator getMembers()
DavResource
getMembers
in interface DavResource
DavResourceIterator
over all internal members.DavResource.getMembers()
public void addMember(DavResource member, InputContext inputContext) throws DavException
addMember
in interface DavResource
member
- DavResource
to be added as internal member.inputContext
- Context providing the properties and content for the
internal member to be created or replaced.DavException
DavResource.addMember(DavResource, org.apache.jackrabbit.webdav.io.InputContext)
public void removeMember(DavResource member) throws DavException
DavResource
removeMember
in interface DavResource
DavException
DavResource.removeMember(DavResource)
public void move(DavResource destination) throws DavException
DavResource
move
in interface DavResource
DavException
DavResource.move(DavResource)
public void copy(DavResource destination, boolean shallow) throws DavException
DavResource
copy
in interface DavResource
DavException
DavResource.copy(DavResource, boolean)
public boolean isLockable(Type type, Scope scope)
DavResource
isLockable
in interface DavResource
type
- scope
- Type.WRITE
and scope is Scope.EXCLUSIVE
DavResource.isLockable(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
public boolean hasLock(Type type, Scope scope)
DavResource
hasLock
in interface DavResource
DavResource.hasLock(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
public ActiveLock getLock(Type type, Scope scope)
DavResource
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.getLock
in interface DavResource
null
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()
DavResource
getLocks
in interface DavResource
DavResource.getLocks()
public ActiveLock lock(LockInfo lockInfo) throws DavException
DavResource
lock
in interface DavResource
lockInfo
- 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
DavResource
refreshLock
in interface DavResource
lockInfo
- 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
DavResource
unlock
in interface DavResource
lockToken
- identifying the lock to be removed.DavException
- if the lock could not be removed.DavResource.unlock(String)
public void addLockManager(LockManager lockMgr)
DavResource
LockManager
to this resource. This method may
throw UnsupportedOperationException
if the resource does handle
locking itself.addLockManager
in interface DavResource
DavResource.addLockManager(org.apache.jackrabbit.webdav.lock.LockManager)
public DavResourceFactory getFactory()
DavResource
DavResourceFactory
that created this resource.getFactory
in interface DavResource
DavResource.getFactory()
public DavSession getSession()
DavResource
DavSession
associated with this resource.getSession
in interface DavResource
DavResource.getSession()
public void bind(DavResource collection, DavResource newBinding) throws DavException
BindableResource
bind
in interface BindableResource
collection
- the collection to create the new binding in.newBinding
- the new bindingDavException
BindableResource.rebind(DavResource, DavResource)
public void rebind(DavResource collection, DavResource newBinding) throws DavException
BindableResource
rebind
in interface BindableResource
collection
- the collection to create the new binding in.newBinding
- the new bindingDavException
BindableResource.rebind(DavResource, DavResource)
public Set<ParentElement> getParentElements()
BindableResource
getParentElements
in interface BindableResource
BindableResource.getParentElements()
protected Node getNode()
protected ImportContext getImportContext(InputContext inputCtx, String systemId) throws IOException
ImportContext
inputCtx
- systemId
- ImportContext
IOException
protected ExportContext getExportContext(OutputContext outputCtx) throws IOException
ExportContext
outputCtx
- ExportContext
IOException
protected PropertyImportContext getPropertyImportContext(List<? extends PropEntry> changeList)
PropertyImportContext
.changeList
- PropertyImportContext
.protected PropertyExportContext getPropertyExportContext()
PropertyExportContext
.PropertyExportContext
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.