Class DefaultItemCollection
- java.lang.Object
-
- org.apache.jackrabbit.webdav.jcr.DefaultItemCollection
-
- All Implemented Interfaces:
JcrRemotingConstants
,DavResource
,ItemResourceConstants
,ObservationResource
,OrderingResource
,SearchResource
,TransactionResource
,DeltaVResource
- Direct Known Subclasses:
VersionControlledItemCollection
,VersionHistoryItemCollection
,VersionItemCollection
public class DefaultItemCollection extends Object implements OrderingResource
DefaultItemCollection
represents a JCR node item.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
initedProps
protected Item
item
protected DavPropertyNameSet
names
protected DavPropertySet
properties
protected SupportedLock
supportedLock
protected SupportedReportSetProperty
supportedReports
-
Fields inherited from interface org.apache.jackrabbit.webdav.DavResource
METHODS
-
Fields inherited from interface org.apache.jackrabbit.webdav.version.DeltaVResource
METHODS, METHODS_INCL_MKWORKSPACE
-
Fields inherited from interface org.apache.jackrabbit.webdav.jcr.ItemResourceConstants
EXCLUSIVE_SESSION, JCR_DEFINITION, JCR_DEPTH, JCR_GET_STRING, JCR_INDEX, JCR_ISMODIFIED, JCR_ISNEW, JCR_LENGTH, JCR_LENGTHS, JCR_MIXINNODETYPES, JCR_NAME, JCR_NAMESPACES, JCR_NODETYPES_CND, JCR_PARENT, JCR_PATH, JCR_PRIMARYITEM, JCR_PRIMARYNODETYPE, JCR_REFERENCES, JCR_SELECTOR_NAME, JCR_TYPE, JCR_UUID, JCR_VALUE, JCR_VALUES, JCR_VERSIONABLEUUID, JCR_WEAK_REFERENCES, JCR_WORKSPACE_NAME, METHODS, NAMESPACE, PRIVILEGE_JCR_ADD_NODE, PRIVILEGE_JCR_READ, PRIVILEGE_JCR_REMOVE, PRIVILEGE_JCR_SET_PROPERTY
-
Fields inherited from interface org.apache.jackrabbit.commons.webdav.JcrRemotingConstants
ATTR_VALUE_TYPE, IMPORT_UUID_BEHAVIOR, JCR_DEFINITION_LN, JCR_DEPTH_LN, JCR_GET_STRING_LN, JCR_INDEX_LN, JCR_ISMODIFIED_LN, JCR_ISNEW_LN, JCR_LENGTH_LN, JCR_LENGTHS_LN, JCR_MIXINNODETYPES_LN, JCR_NAME_LN, JCR_NAMESPACES_LN, JCR_NODETYPES_CND_LN, JCR_PARENT_LN, JCR_PATH_LN, JCR_PRIMARYITEM_LN, JCR_PRIMARYNODETYPE_LN, JCR_QUERY_RESULT_LN, JCR_REFERENCES_LN, JCR_SELECTOR_NAME_LN, JCR_TYPE_LN, JCR_UUID_LN, JCR_VALUE_LN, JCR_VALUES_LN, JCR_VERSIONABLEUUID_LN, JCR_WEAK_REFERENCES_LN, JCR_WORKSPACE_NAME_LN, NS_PREFIX, NS_URI, RELATION_REMOTE_SESSION_ID, RELATION_USER_DATA, REPORT_EXPORT_VIEW, REPORT_LOCATE_BY_UUID, REPORT_LOCATE_CORRESPONDING_NODE, REPORT_NODETYPES, REPORT_PRIVILEGES, REPORT_REGISTERED_NAMESPACES, REPORT_REPOSITORY_DESCRIPTORS, ROOT_ITEM_PATH, ROOT_ITEM_RESOURCEPATH, VERSIONSTORAGE_PATH, XML_ALLOWUPDATE, XML_CND, XML_DESCRIPTOR, XML_DESCRIPTORKEY, XML_DESCRIPTORVALUE, XML_EXCLUSIVE_SESSION_SCOPED, XML_LENGTH, XML_NAMESPACE, XML_NODETYPENAME, XML_PREFIX, XML_PRIMARYNODETYPE, XML_QUERY_RESULT_COLUMN, XML_RELPATH, XML_REMOVEEXISTING, XML_URI, XML_VALUE
-
Fields inherited from interface org.apache.jackrabbit.webdav.observation.ObservationResource
METHODS
-
Fields inherited from interface org.apache.jackrabbit.webdav.ordering.OrderingResource
METHODS
-
Fields inherited from interface org.apache.jackrabbit.webdav.search.SearchResource
METHODS
-
Fields inherited from interface org.apache.jackrabbit.webdav.transaction.TransactionResource
METHODS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultItemCollection(DavResourceLocator locator, JcrDavSession session, DavResourceFactory factory, Item item)
Create a newDefaultItemCollection
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addHrefProperty(DavPropertyName name, Item[] values, boolean isProtected)
Add aHrefProperty
with the specified property name and values.protected void
addHrefProperty(DavPropertyName name, PropertyIterator itemIterator, boolean isProtected)
Add a newhref property
to the property set, where all properties present in the specified iterator are referenced in the resulting property.protected void
addHrefProperty(DavPropertyName name, VersionIterator itemIterator, boolean isProtected)
Add a newhref property
to the property set, where all versions present in the specified iterator are referenced in the resulting property.void
addLockManager(LockManager lockMgr)
Add an externalLockManager
to this resource.void
addMember(DavResource resource, InputContext inputContext)
If the specified resource represents a collection, a new node isadded
to the item represented by this resource.void
addWorkspace(DavResource workspace)
The JCR api does not provide methods to create new workspaces.MultiStatusResponse
alterProperties(List<? extends PropEntry> changeList)
Loops over the givenList
s and alters the properties accordingly.void
copy(DavResource destination, boolean shallow)
Copies the underlying repository item to the indicated destination.protected DavResource
createResourceFromLocator(DavResourceLocator loc)
Create a newDavResource
from the given locator.boolean
exists()
Returns true if there exists arepository item
with the given resource path, false otherwise.DavResource
getCollection()
Returns the resource representing the parent item of the repository item represented by this resource.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 theDavPropertyName.CREATIONDATE
property.protected String
getCreatorDisplayName()
Returns the display name of the creator which is used for the protectedDeltaVConstants.CREATOR_DISPLAYNAME
property.String
getDisplayName()
Retrieves the last segment of the item path (or the resource path if this resource does not exist).DavResourceFactory
getFactory()
Return theDavResourceFactory
that created this resource.String
getHref()
Returns the absolute href of this resource as returned in the multistatus response body.protected HrefProperty
getHrefProperty(DavPropertyName name, Item[] values, boolean isProtected)
Creates a new HrefProperty with the specified name using the given array of items as value.protected HrefProperty
getHrefProperty(DavPropertyName name, PropertyIterator itemIterator, boolean isProtected)
Creates a newhref property
to the property set, where all properties present in the specified iterator are referenced in the resulting property.protected HrefProperty
getHrefProperty(DavPropertyName name, VersionIterator itemIterator, boolean isProtected)
Add a newhref property
to the property set, where all versions present in the specified iterator are referenced in the resulting property.protected static String
getItemName(String itemPath)
Retrieves the last segment of the given path and removes the index if present.DavResourceLocator
getLocator()
Returns thelocator
object for this webdav resource, which encapsulates the information for building the complete 'href'.protected DavResourceLocator
getLocatorFromItem(Item repositoryItem)
Build a newDavResourceLocator
from the given repository item.protected DavResourceLocator
getLocatorFromItemPath(String itemPath)
Build aDavResourceLocator
from the given itemPath path.ActiveLock
getLock(Type type, Scope scope)
Retrieve the lock with the specified type and scope.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.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 aDavConstants.PROPFIND_ALL_PROP
request.DavProperty<?>
getProperty(DavPropertyName name)
Return the webdav property with the specified name.DavPropertyName[]
getPropertyNames()
Returns an array of allproperty 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 ofDavResource
objects that are referenced by the property with the specified name.Report
getReport(ReportInfo reportInfo)
Runs the report specified by the givenReportInfo
.protected Session
getRepositorySession()
Shortcut forgetSession().getRepositorySession()
String
getResourcePath()
Returns the path of the underlying repository item or the item to be created (PUT/MKCOL).DavSession
getSession()
Retrieve theDavSession
associated with this resource.String
getSupportedMethods()
Returns a comma separated list of all METHODS supported by the given resource.String
getTransactionId()
The TransactionId ornull
according to the value of the corresponding requestheader
field.protected String
getWorkspaceHref()
Retrieve the href of the workspace the current session belongs to.boolean
hasLock(Type type, Scope scope)
Returns true if this resource has a lock applied with the given type and scope.void
init(SubscriptionManager subsMgr)
Initializes this resource.void
init(TxLockManager txMgr, String transactionId)
Initializes theTransactionResource
.protected void
initLockSupport()
Extend the generalAbstractResource.supportedLock
field by lock entries specific for this resource: write locks (exclusive or exclusive session-scoped) in case the underlying node has the node type mix:lockable.protected void
initProperties()
Fill the property set for this resource.protected void
initPropertyNames()
Property names common to all resources.protected void
initSupportedReports()
Defines the additional reports supported by this resource (reports specific for resources representing a repositorynode
):export view report
locate corresponding node report
boolean
isCollection()
Always returns trueboolean
isLockable(Type type, Scope scope)
Returns true, if theSupportedLock
property contains an entry with the given type and scope.boolean
isOrderable()
Returns true if this resource exists and the nodetype defining the underlying repository node allow to reorder this nodes children.ActiveLock
lock(LockInfo reqLockInfo)
Creates a lock on this resource by locking the underlyingnode
.void
move(DavResource destination)
Moves the underlying repository item to the indicated destination.protected String
normalizeResourceHref(String href)
Normalize the resourcehref
.void
orderMembers(OrderPatch orderPatch)
Reorder the child nodes of the repository item represented by this resource as indicated by the specifiedOrderPatch
object.EventDiscovery
poll(String subscriptionId, long timeout)
Retrieve the list of events that where recorded for the event listener with the given SubscriptionId.ActiveLock
refreshLock(LockInfo reqLockInfo, String lockToken)
Refreshes the lock on this resource.void
removeMember(DavResource member)
Removes the repository item represented by the specified member resource.void
removeProperty(DavPropertyName propertyName)
This implementation of theDavResource
does only allow to remove the mixinnodetypes property.MultiStatus
search(SearchInfo sInfo)
Runs a search with the language and query defined in theSearchInfo
object specified and returns aMultiStatus
object listing the results.void
setProperty(DavProperty<?> property)
This implementation of theDavResource
does only allow to set the mixinnodetypes property.void
spool(OutputContext outputContext)
If this resource represents an existingNode
the system view is spooled as resource content.Subscription
subscribe(SubscriptionInfo info, String subscriptionId)
Subscribe this resource for event listening defined by the specified subscription info.void
unlock(String lockToken)
Remove the write lock from this resource by unlocking the underlyingnode
.void
unlock(String lockToken, TransactionInfo tInfo)
Overloads theunlock
method of theDavResource
interface.void
unsubscribe(String subscriptionId)
Unsubscribe the event listener with the given SubscriptionId.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.jackrabbit.webdav.DavResource
addLockManager, copy, exists, getCollection, getDisplayName, getFactory, getHref, getLocator, getLocks, getProperties, getPropertyNames, getResourcePath, getSession, isLockable, move
-
-
-
-
Field Detail
-
item
protected final Item item
-
initedProps
protected boolean initedProps
-
properties
protected DavPropertySet properties
-
names
protected DavPropertyNameSet names
-
supportedLock
protected SupportedLock supportedLock
-
supportedReports
protected SupportedReportSetProperty supportedReports
-
-
Constructor Detail
-
DefaultItemCollection
protected DefaultItemCollection(DavResourceLocator locator, JcrDavSession session, DavResourceFactory factory, Item item)
Create a newDefaultItemCollection
.- Parameters:
locator
-session
-factory
-item
-
-
-
Method Detail
-
getComplianceClass
public String getComplianceClass()
Returns a string listing the compliance classes for this resource as it is required for the DAV response header. This includes DAV 1, 2 which is supported by all derived classes as well as a subset of the classes defined by DeltaV: version-control, version-history, checkout-in-place, label, merge, update and workspace.
Those compliance classes are added as required by RFC3253 since all all resources in the jcr-server support at least the reporting and some basic versioning functionality.- Specified by:
getComplianceClass
in interfaceDavResource
- Returns:
- string listing the compliance classes.
- See Also:
DavResource.getComplianceClass()
-
getModificationTime
public long getModificationTime()
Description copied from interface:DavResource
Return the time of the last modification or -1 if the modification time could not be retrieved.- Specified by:
getModificationTime
in interfaceDavResource
- Returns:
- time of last modification or -1.
-
getSupportedMethods
public String getSupportedMethods()
Description copied from interface:DavResource
Returns a comma separated list of all METHODS supported by the given resource.- Specified by:
getSupportedMethods
in interfaceDavResource
- Returns:
- METHODS supported by this resource.
- See Also:
DavResource.getSupportedMethods()
-
isCollection
public boolean isCollection()
Always returns true- Specified by:
isCollection
in interfaceDavResource
- Returns:
- true
- See Also:
DavResource.isCollection()
-
spool
public void spool(OutputContext outputContext) throws IOException
If this resource represents an existingNode
the system view is spooled as resource content.- Specified by:
spool
in interfaceDavResource
- Parameters:
outputContext
-- Throws:
IOException
- See Also:
Session.exportSystemView(String, OutputStream, boolean, boolean)
-
getProperty
public DavProperty<?> getProperty(DavPropertyName name)
Description copied from interface:DavResource
Return the webdav property with the specified name.- Specified by:
getProperty
in interfaceDavResource
- Parameters:
name
- name of the webdav property- Returns:
- the
DavProperty
with the given name ornull
if the property does not exist. - See Also:
DavResource.getProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
-
setProperty
public void setProperty(DavProperty<?> property) throws DavException
This implementation of theDavResource
does only allow to set the mixinnodetypes property. Please note that the existing list of mixin nodetypes will be completely replaced.
In order to add / set any other repository property on the underlyingNode
useaddMember(DavResource)
oraddMember(DavResource, InputStream)
or modify the value of the corresponding resource.- Specified by:
setProperty
in interfaceDavResource
- Parameters:
property
-- Throws:
DavException
- See Also:
DavResource.setProperty(org.apache.jackrabbit.webdav.property.DavProperty)
,ItemResourceConstants.JCR_MIXINNODETYPES
-
removeProperty
public void removeProperty(DavPropertyName propertyName) throws DavException
This implementation of theDavResource
does only allow to remove the mixinnodetypes property.- Specified by:
removeProperty
in interfaceDavResource
- Parameters:
propertyName
-- Throws:
DavException
- See Also:
DavResource.removeProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
,ItemResourceConstants.JCR_MIXINNODETYPES
-
alterProperties
public MultiStatusResponse alterProperties(List<? extends PropEntry> changeList) throws DavException
Loops over the givenList
s and alters the properties accordingly. Changes are persisted at the end according to the rules defined with theAbstractItemResource.complete()
method.Please note: since there is only a single property (
ItemResourceConstants.JCR_MIXINNODETYPES
that can be set or removed with PROPPATCH, this method either succeeds or throws an exception, even if this violates RFC 2518. Thus no property specific multistatus will be created in case of an error.- Specified by:
alterProperties
in interfaceDavResource
- Parameters:
changeList
-- Returns:
- Throws:
DavException
- See Also:
DavResource.alterProperties(List)
-
addMember
public void addMember(DavResource resource, InputContext inputContext) throws DavException
If the specified resource represents a collection, a new node isadded
to the item represented by this resource. If an input stream is specified together with a collection resourceSession.importXML(String, java.io.InputStream, int)
is called instead and this resource path is used asparentAbsPath
argument.However, if the specified resource is not of resource type collection a new
Property
is set or an existing one is changed by modifying its value.
NOTE: with the current implementation it is not possible to create or modify multivalue JCR properties.
NOTE: if the JCR property represented by the specified resource has anundefined
resource type, its value will be changed/set to typebinary
.- Specified by:
addMember
in interfaceDavResource
- Parameters:
resource
-inputContext
-- Throws:
DavException
- See Also:
DavResource.addMember(org.apache.jackrabbit.webdav.DavResource, InputContext)
,Node.addNode(String)
,Node.setProperty(String, java.io.InputStream)
-
getMembers
public DavResourceIterator getMembers()
Description copied from interface:DavResource
Returns an iterator over all internal members.- Specified by:
getMembers
in interfaceDavResource
- Returns:
- a
DavResourceIterator
over all internal members. - See Also:
DavResource.getMembers()
-
removeMember
public void removeMember(DavResource member) throws DavException
Removes the repository item represented by the specified member resource.- Specified by:
removeMember
in interfaceDavResource
- Throws:
DavException
- if this resource does not exist or if an error occurs while deleting the underlying item.- See Also:
DavResource.removeMember(DavResource)
,Item.remove()
-
hasLock
public boolean hasLock(Type type, Scope scope)
Returns true if this resource has a lock applied with the given type and scope.- Specified by:
hasLock
in interfaceDavResource
- Parameters:
type
-scope
-- Returns:
- true if a lock with the specified type and scope is present on this resource, false otherwise. If retrieving the corresponding information fails, false is returned.
- See Also:
DavResource.hasLock(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
-
getLock
public ActiveLock getLock(Type type, Scope scope)
Retrieve the lock with the specified type and scope.- Specified by:
getLock
in interfaceDavResource
- Parameters:
type
-scope
-- Returns:
- lock with the specified type and scope is present on this
resource or
null
. NOTE: If retrieving the write lock present on the underlying repository item fails,null
is return. - See Also:
DavResource.getLock(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
,for the write locks.
-
lock
public ActiveLock lock(LockInfo reqLockInfo) throws DavException
Creates a lock on this resource by locking the underlyingnode
. Except for theLockInfo.isDeep()
} all information included in theLockInfo
object is ignored. Lock timeout is defined by JCR implementation.- Specified by:
lock
in interfaceDavResource
- Parameters:
reqLockInfo
-- Returns:
- lock object representing the lock created on this resource.
- Throws:
DavException
- See Also:
DavResource.lock(org.apache.jackrabbit.webdav.lock.LockInfo)
,Node.lock(boolean, boolean)
-
refreshLock
public ActiveLock refreshLock(LockInfo reqLockInfo, String lockToken) throws DavException
Refreshes the lock on this resource. With this implementation thelock
present on the underlyingnode
is refreshed. The timeout indicated by theLockInfo
object is ignored.- Specified by:
refreshLock
in interfaceDavResource
- Parameters:
reqLockInfo
- LockInfo as build from the request.lockToken
-- Returns:
- the updated lock info object.
- Throws:
DavException
- in case the lock could not be refreshed.- See Also:
DavResource.refreshLock(org.apache.jackrabbit.webdav.lock.LockInfo, String)
,Lock.refresh()
-
unlock
public void unlock(String lockToken) throws DavException
Remove the write lock from this resource by unlocking the underlyingnode
.- Specified by:
unlock
in interfaceDavResource
- Parameters:
lockToken
-- Throws:
DavException
- See Also:
DavResource.unlock(String)
,Node.unlock()
-
isOrderable
public boolean isOrderable()
Returns true if this resource exists and the nodetype defining the underlying repository node allow to reorder this nodes children.- Specified by:
isOrderable
in interfaceOrderingResource
- Returns:
- true if
orderMembers(OrderPatch)
can be called on this resource. - See Also:
OrderingResource.isOrderable()
,NodeTypeDefinition.hasOrderableChildNodes()
-
orderMembers
public void orderMembers(OrderPatch orderPatch) throws DavException
Reorder the child nodes of the repository item represented by this resource as indicated by the specifiedOrderPatch
object.- Specified by:
orderMembers
in interfaceOrderingResource
- Parameters:
orderPatch
-- Throws:
DavException
- See Also:
OrderingResource.orderMembers(org.apache.jackrabbit.webdav.ordering.OrderPatch)
,Node.orderBefore(String, String)
-
initLockSupport
protected void initLockSupport()
Extend the generalAbstractResource.supportedLock
field by lock entries specific for this resource: write locks (exclusive or exclusive session-scoped) in case the underlying node has the node type mix:lockable.- See Also:
JcrConstants.MIX_LOCKABLE
-
initSupportedReports
protected void initSupportedReports()
Defines the additional reports supported by this resource (reports specific for resources representing a repositorynode
):- See Also:
SupportedReportSetProperty
-
initPropertyNames
protected void initPropertyNames()
Property names common to all resources.
-
initProperties
protected void initProperties()
Fill the property set for this resource.
-
getCreatorDisplayName
protected String getCreatorDisplayName()
Returns the display name of the creator which is used for the protectedDeltaVConstants.CREATOR_DISPLAYNAME
property.- Returns:
- always
null
; subclasses may provide a regular value.
-
getCreationDate
protected String getCreationDate()
Returns the creation date which is used for theDavPropertyName.CREATIONDATE
property.- Returns:
- a dummy date; subclasses may provide a reasonable value.
-
getHrefProperty
protected HrefProperty getHrefProperty(DavPropertyName name, Item[] values, boolean isProtected)
Creates a new HrefProperty with the specified name using the given array of items as value.- Parameters:
name
-values
-isProtected
-- Returns:
-
addHrefProperty
protected void addHrefProperty(DavPropertyName name, Item[] values, boolean isProtected)
Add aHrefProperty
with the specified property name and values. Each item present in the specified values array is referenced in the resulting property.- Parameters:
name
-values
-isProtected
-
-
getHrefProperty
protected HrefProperty getHrefProperty(DavPropertyName name, PropertyIterator itemIterator, boolean isProtected)
Creates a newhref property
to the property set, where all properties present in the specified iterator are referenced in the resulting property.- Parameters:
name
-itemIterator
-isProtected
-- Returns:
-
addHrefProperty
protected void addHrefProperty(DavPropertyName name, PropertyIterator itemIterator, boolean isProtected)
Add a newhref property
to the property set, where all properties present in the specified iterator are referenced in the resulting property.- Parameters:
name
-itemIterator
-isProtected
-- See Also:
addHrefProperty(DavPropertyName, Item[], boolean)
-
getHrefProperty
protected HrefProperty getHrefProperty(DavPropertyName name, VersionIterator itemIterator, boolean isProtected)
Add a newhref property
to the property set, where all versions present in the specified iterator are referenced in the resulting property.- Parameters:
name
-itemIterator
-isProtected
-
-
addHrefProperty
protected void addHrefProperty(DavPropertyName name, VersionIterator itemIterator, boolean isProtected)
Add a newhref property
to the property set, where all versions present in the specified iterator are referenced in the resulting property.- Parameters:
name
-itemIterator
-isProtected
-
-
exists
public boolean exists()
Returns true if there exists arepository item
with the given resource path, false otherwise.- Specified by:
exists
in interfaceDavResource
- Returns:
- true, if the resource represents an existing repository item.
- See Also:
DavResource.exists()
-
getDisplayName
public String getDisplayName()
Retrieves the last segment of the item path (or the resource path if this resource does not exist). An item path is in addition first translated to the corresponding resource path.
NOTE: the display name is not equivalent toitem name
which is exposed with the{http://www.day.com/jcr/webdav/1.0}name
property.- Specified by:
getDisplayName
in interfaceDavResource
- Returns:
- display name.
- See Also:
DavResource.getDisplayName()
-
getCollection
public DavResource getCollection()
Returns the resource representing the parent item of the repository item represented by this resource. If this resoure represents the root item aRootCollection
is returned.- Specified by:
getCollection
in interfaceDavResource
- Returns:
- the collection this resource is internal member of. Except for the repository root, the returned collection always represent the parent repository node.
- See Also:
DavResource.getCollection()
-
move
public void move(DavResource destination) throws DavException
Moves the underlying repository item to the indicated destination.- Specified by:
move
in interfaceDavResource
- Parameters:
destination
-- Throws:
DavException
- See Also:
DavResource.move(DavResource)
,Session.move(String, String)
-
copy
public void copy(DavResource destination, boolean shallow) throws DavException
Copies the underlying repository item to the indicated destination. If the locator of the specified destination resource indicates a different workspace,Workspace.copy(String, String, String)
is used to perform the copy operation,Workspace.copy(String, String)
otherwise.Note, that this implementation does not support shallow copy.
- Specified by:
copy
in interfaceDavResource
- Parameters:
destination
-shallow
-- Throws:
DavException
- See Also:
DavResource.copy(DavResource, boolean)
,Workspace.copy(String, String)
,Workspace.copy(String, String, String)
-
init
public void init(SubscriptionManager subsMgr)
Description copied from interface:ObservationResource
Initializes this resource.- Specified by:
init
in interfaceObservationResource
- Parameters:
subsMgr
- subscription manager object- See Also:
ObservationResource.init(SubscriptionManager)
-
subscribe
public Subscription subscribe(SubscriptionInfo info, String subscriptionId) throws DavException
Description copied from interface:ObservationResource
Subscribe this resource for event listening defined by the specified subscription info. A subscriptionId may be specified in case an existing subscription should be modified.- Specified by:
subscribe
in interfaceObservationResource
- Parameters:
info
-SubscriptionInfo
object as defined by the request body and headers.subscriptionId
- ornull
if theSubscriptionId
header is missing.- Returns:
Subscription
object in case the subscription was successful.- Throws:
DavException
- See Also:
ObservationResource.subscribe(org.apache.jackrabbit.webdav.observation.SubscriptionInfo, String)
,SubscriptionManager.subscribe(org.apache.jackrabbit.webdav.observation.SubscriptionInfo, String, org.apache.jackrabbit.webdav.observation.ObservationResource)
-
unsubscribe
public void unsubscribe(String subscriptionId) throws DavException
Description copied from interface:ObservationResource
Unsubscribe the event listener with the given SubscriptionId.- Specified by:
unsubscribe
in interfaceObservationResource
- Parameters:
subscriptionId
- as present in theSubscriptionId
header.- Throws:
DavException
- See Also:
ObservationResource.unsubscribe(String)
,SubscriptionManager.unsubscribe(String, org.apache.jackrabbit.webdav.observation.ObservationResource)
-
poll
public EventDiscovery poll(String subscriptionId, long timeout) throws DavException
Description copied from interface:ObservationResource
Retrieve the list of events that where recorded for the event listener with the given SubscriptionId.- Specified by:
poll
in interfaceObservationResource
- Parameters:
subscriptionId
- as present in theSubscriptionId
header.timeout
- as present in theObservationConstants.HEADER_POLL_TIMEOUT
header or 0 (zero) if none is present.- Returns:
EventDiscovery
object- Throws:
DavException
- See Also:
ObservationResource.poll(String, long)
,SubscriptionManager.poll(String, long, org.apache.jackrabbit.webdav.observation.ObservationResource)
-
getWorkspaceHref
protected String getWorkspaceHref()
Retrieve the href of the workspace the current session belongs to.- Returns:
- href of the workspace or
null
if this resource does not represent a repository item. - See Also:
AbstractResource.getWorkspaceHref()
-
getItemName
protected static String getItemName(String itemPath)
Retrieves the last segment of the given path and removes the index if present.- Parameters:
itemPath
-- Returns:
- valid jcr item name
-
getLocator
public DavResourceLocator getLocator()
Description copied from interface:DavResource
Returns thelocator
object for this webdav resource, which encapsulates the information for building the complete 'href'.- Specified by:
getLocator
in interfaceDavResource
- Returns:
- the locator for this resource.
- See Also:
DavResource.getLocator()
-
getResourcePath
public String getResourcePath()
Returns the path of the underlying repository item or the item to be created (PUT/MKCOL). If the resource exists but does not represent a repository itemnull
is returned.- Specified by:
getResourcePath
in interfaceDavResource
- Returns:
- path of the underlying repository item.
- See Also:
DavResource.getResourcePath()
,DavResourceLocator.getResourcePath()
-
getHref
public String getHref()
Description copied from interface:DavResource
Returns the absolute href of this resource as returned in the multistatus response body.- Specified by:
getHref
in interfaceDavResource
- Returns:
- href
- See Also:
DavResource.getHref()
,DavResourceLocator.getHref(boolean)
-
getPropertyNames
public DavPropertyName[] getPropertyNames()
Description copied from interface:DavResource
Returns an array of allproperty names
available on this resource.- Specified by:
getPropertyNames
in interfaceDavResource
- Returns:
- an array of property names.
- See Also:
DavResource.getPropertyNames()
-
getProperties
public DavPropertySet getProperties()
Description copied from interface:DavResource
Returns all webdav properties present on this resource that will be return upon aDavConstants.PROPFIND_ALL_PROP
request. The implementation may in addition expose other (protected or calculated) properties which should be marked accordingly (see alsoDavProperty.isInvisibleInAllprop()
.- Specified by:
getProperties
in interfaceDavResource
- Returns:
- a
DavPropertySet
containing at least all properties of this resource that are exposed in 'allprop' PROPFIND request. - See Also:
DavResource.getProperties()
-
isLockable
public boolean isLockable(Type type, Scope scope)
Returns true, if theSupportedLock
property contains an entry with the given type and scope. By default resources allow fortransaction
lock only.- Specified by:
isLockable
in interfaceDavResource
- Parameters:
type
-scope
-- Returns:
- true if this resource may be locked by the given type and scope.
- See Also:
DavResource.isLockable(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
-
getLocks
public ActiveLock[] getLocks()
Description copied from interface:DavResource
Returns an array of all locks applied to the given resource.- Specified by:
getLocks
in interfaceDavResource
- Returns:
- array of locks. The array is empty if there are no locks applied to this resource.
- See Also:
todo improve....
-
addLockManager
public void addLockManager(LockManager lockMgr)
Description copied from interface:DavResource
Add an externalLockManager
to this resource. This method may throwUnsupportedOperationException
if the resource does handle locking itself.- Specified by:
addLockManager
in interfaceDavResource
- See Also:
DavResource.addLockManager(org.apache.jackrabbit.webdav.lock.LockManager)
-
getFactory
public DavResourceFactory getFactory()
Description copied from interface:DavResource
Return theDavResourceFactory
that created this resource.- Specified by:
getFactory
in interfaceDavResource
- Returns:
- the factory that created this resource.
- See Also:
DavResource.getFactory()
-
getSession
public DavSession getSession()
Description copied from interface:DavResource
Retrieve theDavSession
associated with this resource.- Specified by:
getSession
in interfaceDavResource
- Returns:
- session object associated with this resource.
- See Also:
DavResource.getSession()
,DavResource.getSession()
-
init
public void init(TxLockManager txMgr, String transactionId)
Description copied from interface:TransactionResource
Initializes theTransactionResource
.- Specified by:
init
in interfaceTransactionResource
- See Also:
TransactionResource.init(TxLockManager, String)
-
unlock
public void unlock(String lockToken, TransactionInfo tInfo) throws DavException
Description copied from interface:TransactionResource
Overloads theunlock
method of theDavResource
interface.- Specified by:
unlock
in interfaceTransactionResource
- Parameters:
lockToken
- lock token as present in the request header.tInfo
- transaction info object as present in the UNLOCK request body.- Throws:
DavException
- if an error occurs- See Also:
TransactionResource.unlock(String, org.apache.jackrabbit.webdav.transaction.TransactionInfo)
-
getTransactionId
public String getTransactionId()
Description copied from interface:TransactionResource
The TransactionId ornull
according to the value of the corresponding requestheader
field.- Specified by:
getTransactionId
in interfaceTransactionResource
- Returns:
- TransactionId header or
null
- See Also:
TransactionResource.getTransactionId()
-
getOptionResponse
public OptionsResponse getOptionResponse(OptionsInfo optionsInfo)
Description copied from interface:DeltaVResource
Retrieves the information requested in the OPTIONS request body and returns the corresponding values.- Specified by:
getOptionResponse
in interfaceDeltaVResource
- Parameters:
optionsInfo
-- Returns:
- object to be used in the OPTIONS response body or
null
- See Also:
DeltaVResource.getOptionResponse(org.apache.jackrabbit.webdav.version.OptionsInfo)
-
getReport
public Report getReport(ReportInfo reportInfo) throws DavException
Description copied from interface:DeltaVResource
Runs the report specified by the givenReportInfo
.- Specified by:
getReport
in interfaceDeltaVResource
- Parameters:
reportInfo
-- Returns:
- the requested report
- Throws:
DavException
- See Also:
DeltaVResource.getReport(org.apache.jackrabbit.webdav.version.report.ReportInfo)
-
addWorkspace
public void addWorkspace(DavResource workspace) throws DavException
The JCR api does not provide methods to create new workspaces. CallingaddWorkspace
on this resource will always fail.- Specified by:
addWorkspace
in interfaceDeltaVResource
- Parameters:
workspace
-- Throws:
DavException
- Always throws.- See Also:
DeltaVResource.addWorkspace(org.apache.jackrabbit.webdav.DavResource)
-
getReferenceResources
public DavResource[] getReferenceResources(DavPropertyName hrefPropertyName) throws DavException
Return an array ofDavResource
objects that are referenced by the property with the specified name.- Specified by:
getReferenceResources
in interfaceDeltaVResource
- Parameters:
hrefPropertyName
-- Returns:
- array of
DavResource
s - Throws:
DavException
- See Also:
DeltaVResource.getReferenceResources(org.apache.jackrabbit.webdav.property.DavPropertyName)
-
getQueryGrammerSet
public QueryGrammerSet getQueryGrammerSet()
Description copied from interface:SearchResource
Returns the protected DAV:supported-method-set property which is defined mandatory by RTF 3253. This method call is a shortcut forDavResource.getProperty(SearchConstants.QUERY_GRAMMER_SET)
.- Specified by:
getQueryGrammerSet
in interfaceSearchResource
- Returns:
- See Also:
SearchResource.getQueryGrammerSet()
-
search
public MultiStatus search(SearchInfo sInfo) throws DavException
Description copied from interface:SearchResource
Runs a search with the language and query defined in theSearchInfo
object specified and returns aMultiStatus
object listing the results.- Specified by:
search
in interfaceSearchResource
- Parameters:
sInfo
-- Returns:
- Throws:
DavException
- See Also:
SearchResource.search(org.apache.jackrabbit.webdav.search.SearchInfo)
-
createResourceFromLocator
protected DavResource createResourceFromLocator(DavResourceLocator loc) throws DavException
Create a newDavResource
from the given locator.- Parameters:
loc
-- Returns:
- new
DavResource
- Throws:
DavException
-
getLocatorFromItemPath
protected DavResourceLocator getLocatorFromItemPath(String itemPath)
Build aDavResourceLocator
from the given itemPath path.- Parameters:
itemPath
-- Returns:
- a new
DavResourceLocator
- See Also:
DavLocatorFactory.createResourceLocator(String, String, String)
-
getLocatorFromItem
protected DavResourceLocator getLocatorFromItem(Item repositoryItem)
Build a newDavResourceLocator
from the given repository item.- Parameters:
repositoryItem
-- Returns:
- a new locator for the specified item.
- See Also:
getLocatorFromItemPath(String)
-
getRepositorySession
protected Session getRepositorySession()
Shortcut forgetSession().getRepositorySession()
- Returns:
- repository session present in the
AbstractResource.session
.
-
-