public class RootCollection extends Object
RootCollection represent the WebDAV root resource that does not
represent any repository item. A call to getMembers() returns a
DavResourceIterator containing only workspace resources
resources, thus revealing the names of the accessible JCR workspaces.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
initedProps |
protected DavPropertyNameSet |
names |
protected DavPropertySet |
properties |
protected SupportedLock |
supportedLock |
protected SupportedReportSetProperty |
supportedReports |
METHODSMETHODS, METHODS_INCL_MKWORKSPACEMETHODS| Modifier | Constructor and Description |
|---|---|
protected |
RootCollection(DavResourceLocator locator,
JcrDavSession session,
DavResourceFactory factory)
Create a new
RootCollection. |
| Modifier and Type | Method and Description |
|---|---|
void |
addLockManager(LockManager lockMgr)
Add an external
LockManager to this resource. |
void |
addMember(DavResource resource,
InputContext inputContext)
Throws exception: 403 Forbidden.
|
void |
addWorkspace(DavResource workspace)
The JCR api does not provide methods to create new workspaces.
|
MultiStatusResponse |
alterProperties(List<? extends PropEntry> changeList)
Throws
HttpServletResponse.SC_METHOD_NOT_ALLOWED |
void |
copy(DavResource destination,
boolean shallow)
Throws
HttpServletResponse.SC_METHOD_NOT_ALLOWED |
protected DavResource |
createResourceFromLocator(DavResourceLocator loc)
Create a new
DavResource from the given locator. |
boolean |
exists()
Returns true
|
DavResource |
getCollection()
Always returns
null |
String |
getComplianceClass()
Returns a string listing the compliance classes for this resource as it
is required for the DAV response header.
|
protected String |
getCreationDate()
Returns the creation date which is used for the
DavPropertyName.CREATIONDATE property. |
protected String |
getCreatorDisplayName()
Returns the display name of the creator which is used for the protected
DeltaVConstants.CREATOR_DISPLAYNAME property. |
String |
getDisplayName()
Returns an empty string.
|
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.
|
DavResourceLocator |
getLocator()
Returns the
locator object for this webdav resource,
which encapsulates the information for building the complete 'href'. |
protected DavResourceLocator |
getLocatorFromItem(Item repositoryItem)
Build a new
DavResourceLocator from the given repository item. |
protected DavResourceLocator |
getLocatorFromItemPath(String itemPath)
Build a
DavResourceLocator from the given itemPath path. |
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 the member resources, which are all
workspace resources available.
|
long |
getModificationTime()
Always returns 'now'
|
OptionsResponse |
getOptionResponse(OptionsInfo optionsInfo)
Retrieves the information requested in the OPTIONS request body and
returns the corresponding values.
|
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.
|
DavPropertyName[] |
getPropertyNames()
Returns an array of all
property names available
on this resource. |
QueryGrammerSet |
getQueryGrammerSet()
Returns the protected DAV:supported-method-set property which is defined
mandatory by RTF 3253.
|
DavResource[] |
getReferenceResources(DavPropertyName hrefPropertyName)
Return an array of
DavResource objects that are referenced
by the property with the specified name. |
Report |
getReport(ReportInfo reportInfo)
Runs the report specified by the given
ReportInfo. |
protected Session |
getRepositorySession()
Shortcut for
getSession().getRepositorySession() |
String |
getResourcePath()
Returns the path of the underlying repository item or the item to
be created (PUT/MKCOL).
|
DavSession |
getSession()
Retrieve the
DavSession associated with this resource. |
String |
getSupportedMethods()
Returns a string listing the METHODS for this resource as it
is required for the "Allow" response header.
|
String |
getTransactionId()
The TransactionId or
null according to the value of the
corresponding request header
field. |
protected String |
getWorkspaceHref()
Since the root resource does not represent a repository item and therefore
is not member of a workspace resource, this method always returns
null. |
boolean |
hasLock(Type type,
Scope scope)
Returns true if this resource has a lock applied with the given type and scope.
|
void |
init(TxLockManager txMgr,
String transactionId)
Initializes the
TransactionResource. |
protected void |
initLockSupport()
Define the set of locks supported by this resource.
|
protected void |
initProperties()
Fill the set of default properties
|
protected void |
initPropertyNames()
Property names common to all resources.
|
protected void |
initSupportedReports()
Define the set of reports supported by this resource.
|
boolean |
isCollection()
Returns true
|
boolean |
isLockable(Type type,
Scope scope)
Returns true, if the
SupportedLock property contains an entry
with the given type and scope. |
ActiveLock |
lock(LockInfo reqLockInfo)
Lock this webdav resource with the information retrieve from the request
and return the resulting lockdiscovery object.
|
void |
move(DavResource destination)
Throws
HttpServletResponse.SC_METHOD_NOT_ALLOWED |
protected String |
normalizeResourceHref(String href)
Normalize the resource
href. |
ActiveLock |
refreshLock(LockInfo info,
String lockToken)
Only transaction lock may be available on this resource.
|
void |
removeMember(DavResource member)
Calls
Workspace.deleteWorkspace(String) for the workspace with
the name as indicated by the specified member. |
void |
removeProperty(DavPropertyName propertyName)
Throws
HttpServletResponse.SC_METHOD_NOT_ALLOWED |
MultiStatus |
search(SearchInfo sInfo)
Runs a search with the language and query defined in the
SearchInfo
object specified and returns a MultiStatus object listing the
results. |
void |
setProperty(DavProperty<?> property)
Throws
HttpServletResponse.SC_METHOD_NOT_ALLOWED |
void |
spool(OutputContext outputContext)
Sets content lengths to '0' and retrieves the modification time.
|
void |
unlock(String lockToken)
Throws
HttpServletResponse.SC_METHOD_NOT_ALLOWED since only transaction
locks may be present on this resource, that need to be released by calling
TransactionResource.unlock(String, org.apache.jackrabbit.webdav.transaction.TransactionInfo). |
void |
unlock(String lockToken,
TransactionInfo tInfo)
Overloads the
unlock method of the DavResource
interface. |
protected boolean initedProps
protected DavPropertySet properties
protected DavPropertyNameSet names
protected SupportedLock supportedLock
protected SupportedReportSetProperty supportedReports
protected RootCollection(DavResourceLocator locator, JcrDavSession session, DavResourceFactory factory)
RootCollection.locator - session - factory - public String getSupportedMethods()
DavResource.getSupportedMethods()public boolean exists()
DavResource.exists()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 boolean isCollection()
DavResource.isCollection()public String getDisplayName()
DavResource.getDisplayName()public long getModificationTime()
DavResource.getModificationTime()public void spool(OutputContext outputContext) throws IOException
outputContext - IOExceptionDavResource.spool(org.apache.jackrabbit.webdav.io.OutputContext)public DavResource getCollection()
nullnull for the root resource is not internal member
of any resource.DavResource.getCollection()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.DavExceptionDavResource.addMember(DavResource, InputContext)public DavResourceIterator getMembers()
DavResource.getMembers()public void removeMember(DavResource member) throws DavException
Workspace.deleteWorkspace(String) for the workspace with
the name as indicated by the specified member.public void addWorkspace(DavResource workspace) throws DavException
addWorkspace on this resource will always fail.addWorkspace in interface DeltaVResourceworkspace - resource representing the new workspace to be created as
member of this resource.DavException - Always throws.DeltaVResource.addWorkspace(org.apache.jackrabbit.webdav.DavResource)protected void initLockSupport()
AbstractResource.initLockSupport()protected String getWorkspaceHref()
null.nullAbstractResource.getWorkspaceHref()protected void initPropertyNames()
public String getComplianceClass()
getComplianceClass in interface DavResourceDavResource.getComplianceClass()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()
null is returned.getResourcePath in interface DavResourceDavResource.getResourcePath(),
DavResourceLocator.getResourcePath()public String getHref()
DavResourcegetHref in interface DavResourceDavResource.getHref(),
DavResourceLocator.getHref(boolean)public DavPropertyName[] getPropertyNames()
DavResourceproperty names available
on this resource.getPropertyNames in interface DavResourceDavResource.getPropertyNames()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 void setProperty(DavProperty<?> property) throws DavException
HttpServletResponse.SC_METHOD_NOT_ALLOWEDsetProperty in interface DavResourceproperty - DavException - Always throws HttpServletResponse.SC_METHOD_NOT_ALLOWEDDavResource.setProperty(org.apache.jackrabbit.webdav.property.DavProperty)public void removeProperty(DavPropertyName propertyName) throws DavException
HttpServletResponse.SC_METHOD_NOT_ALLOWEDremoveProperty in interface DavResourcepropertyName - DavException - Always throws HttpServletResponse.SC_METHOD_NOT_ALLOWEDDavResource.removeProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)public MultiStatusResponse alterProperties(List<? extends PropEntry> changeList) throws DavException
HttpServletResponse.SC_METHOD_NOT_ALLOWEDalterProperties 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).DavResource.alterProperties(List)public void move(DavResource destination) throws DavException
HttpServletResponse.SC_METHOD_NOT_ALLOWEDmove in interface DavResourcedestination - DavException - Always throws HttpServletResponse.SC_METHOD_NOT_ALLOWEDDavResource.move(org.apache.jackrabbit.webdav.DavResource)public void copy(DavResource destination, boolean shallow) throws DavException
HttpServletResponse.SC_METHOD_NOT_ALLOWEDcopy in interface DavResourcedestination - shallow - DavException - Always throws HttpServletResponse.SC_METHOD_NOT_ALLOWEDDavResource.copy(org.apache.jackrabbit.webdav.DavResource, boolean)public boolean isLockable(Type type, Scope scope)
SupportedLock property contains an entry
with the given type and scope. By default resources allow for transaction lock only.isLockable in interface DavResourcetype - scope - DavResource.isLockable(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)public boolean hasLock(Type type, Scope scope)
hasLock in interface DavResourcetype - scope - DavResource.hasLock(Type, 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 DavResourcetodo improve....public ActiveLock lock(LockInfo reqLockInfo) throws DavException
DavResourcelock in interface DavResourcereqLockInfo - lock info as retrieved from the request.DavException is thrown.DavException - if the lock could not be obtained.DavResource.lock(org.apache.jackrabbit.webdav.lock.LockInfo)public ActiveLock refreshLock(LockInfo info, String lockToken) throws DavException
refreshLock in interface DavResourceinfo - lockToken - DavException is thrown.DavExceptionDavResource.refreshLock(org.apache.jackrabbit.webdav.lock.LockInfo, String)public void unlock(String lockToken) throws DavException
HttpServletResponse.SC_METHOD_NOT_ALLOWED since only transaction
locks may be present on this resource, that need to be released by calling
TransactionResource.unlock(String, org.apache.jackrabbit.webdav.transaction.TransactionInfo).unlock in interface DavResourcelockToken - DavException - Always throws HttpServletResponse.SC_METHOD_NOT_ALLOWEDpublic 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(),
DavResource.getSession()public void init(TxLockManager txMgr, String transactionId)
TransactionResourceTransactionResource.init in interface TransactionResourceTransactionResource.init(TxLockManager, String)public void unlock(String lockToken, TransactionInfo tInfo) throws DavException
TransactionResourceunlock method of the DavResource
interface.unlock in interface TransactionResourcelockToken - lock token as present in the request header.tInfo - transaction info object as present in the UNLOCK request body.DavException - if an error occursTransactionResource.unlock(String, org.apache.jackrabbit.webdav.transaction.TransactionInfo)public String getTransactionId()
TransactionResourcenull according to the value of the
corresponding request header
field.getTransactionId in interface TransactionResourcenullTransactionResource.getTransactionId()public OptionsResponse getOptionResponse(OptionsInfo optionsInfo)
DeltaVResourcegetOptionResponse in interface DeltaVResourceoptionsInfo - nullDeltaVResource.getOptionResponse(org.apache.jackrabbit.webdav.version.OptionsInfo)public Report getReport(ReportInfo reportInfo) throws DavException
DeltaVResourceReportInfo.getReport in interface DeltaVResourcereportInfo - DavExceptionDeltaVResource.getReport(org.apache.jackrabbit.webdav.version.report.ReportInfo)public DavResource[] getReferenceResources(DavPropertyName hrefPropertyName) throws DavException
DavResource objects that are referenced
by the property with the specified name.getReferenceResources in interface DeltaVResourcehrefPropertyName - DavResourcesDavExceptionDeltaVResource.getReferenceResources(org.apache.jackrabbit.webdav.property.DavPropertyName)public QueryGrammerSet getQueryGrammerSet()
SearchResourceDavResource.getProperty(SearchConstants.QUERY_GRAMMER_SET).getQueryGrammerSet in interface SearchResourceSearchResource.getQueryGrammerSet()public MultiStatus search(SearchInfo sInfo) throws DavException
SearchResourceSearchInfo
object specified and returns a MultiStatus object listing the
results.search in interface SearchResourcesInfo - DavExceptionSearchResource.search(org.apache.jackrabbit.webdav.search.SearchInfo)protected void initProperties()
protected DavResource createResourceFromLocator(DavResourceLocator loc) throws DavException
DavResource from the given locator.loc - DavResourceDavExceptionprotected DavResourceLocator getLocatorFromItemPath(String itemPath)
DavResourceLocator from the given itemPath path.itemPath - DavResourceLocatorDavLocatorFactory.createResourceLocator(String, String, String)protected DavResourceLocator getLocatorFromItem(Item repositoryItem)
DavResourceLocator from the given repository item.repositoryItem - getLocatorFromItemPath(String)protected Session getRepositorySession()
getSession().getRepositorySession()AbstractResource.session.protected void initSupportedReports()
SupportedReportSetProperty,
AbstractResource.initSupportedReports()protected String getCreatorDisplayName()
DeltaVConstants.CREATOR_DISPLAYNAME property.null; subclasses may provide a regular value.protected String getCreationDate()
DavPropertyName.CREATIONDATE property.Copyright © 2004–2020 The Apache Software Foundation. All rights reserved.