Class DefaultItemCollection

  • All Implemented Interfaces:
    org.apache.jackrabbit.commons.webdav.JcrRemotingConstants, org.apache.jackrabbit.webdav.DavResource, ItemResourceConstants, org.apache.jackrabbit.webdav.observation.ObservationResource, org.apache.jackrabbit.webdav.ordering.OrderingResource, org.apache.jackrabbit.webdav.search.SearchResource, org.apache.jackrabbit.webdav.transaction.TransactionResource, org.apache.jackrabbit.webdav.version.DeltaVResource
    Direct Known Subclasses:
    VersionControlledItemCollection, VersionHistoryItemCollection, VersionItemCollection

    public class DefaultItemCollection
    extends Object
    implements org.apache.jackrabbit.webdav.ordering.OrderingResource
    DefaultItemCollection represents a JCR node item.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean initedProps  
      protected Item item  
      protected org.apache.jackrabbit.webdav.property.DavPropertyNameSet names  
      protected org.apache.jackrabbit.webdav.property.DavPropertySet properties  
      protected org.apache.jackrabbit.webdav.lock.SupportedLock supportedLock  
      protected org.apache.jackrabbit.webdav.version.report.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.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​(org.apache.jackrabbit.webdav.DavResourceLocator locator, JcrDavSession session, org.apache.jackrabbit.webdav.DavResourceFactory factory, Item item)
      Create a new DefaultItemCollection.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addHrefProperty​(org.apache.jackrabbit.webdav.property.DavPropertyName name, Item[] values, boolean isProtected)
      Add a HrefProperty with the specified property name and values.
      protected void addHrefProperty​(org.apache.jackrabbit.webdav.property.DavPropertyName name, PropertyIterator itemIterator, boolean isProtected)
      Add a new href property to the property set, where all properties present in the specified iterator are referenced in the resulting property.
      protected void addHrefProperty​(org.apache.jackrabbit.webdav.property.DavPropertyName name, VersionIterator itemIterator, boolean isProtected)
      Add a new href property to the property set, where all versions present in the specified iterator are referenced in the resulting property.
      void addLockManager​(org.apache.jackrabbit.webdav.lock.LockManager lockMgr)  
      void addMember​(org.apache.jackrabbit.webdav.DavResource resource, org.apache.jackrabbit.webdav.io.InputContext inputContext)
      If the specified resource represents a collection, a new node is added to the item represented by this resource.
      void addWorkspace​(org.apache.jackrabbit.webdav.DavResource workspace)
      The JCR api does not provide methods to create new workspaces.
      org.apache.jackrabbit.webdav.MultiStatusResponse alterProperties​(List<? extends org.apache.jackrabbit.webdav.property.PropEntry> changeList)
      Loops over the given Lists and alters the properties accordingly.
      void copy​(org.apache.jackrabbit.webdav.DavResource destination, boolean shallow)
      Copies the underlying repository item to the indicated destination.
      protected org.apache.jackrabbit.webdav.DavResource createResourceFromLocator​(org.apache.jackrabbit.webdav.DavResourceLocator loc)
      Create a new DavResource from the given locator.
      boolean exists()
      Returns true if there exists a repository item with the given resource path, false otherwise.
      org.apache.jackrabbit.webdav.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 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()
      Retrieves the last segment of the item path (or the resource path if this resource does not exist).
      org.apache.jackrabbit.webdav.DavResourceFactory getFactory()  
      String getHref()  
      protected org.apache.jackrabbit.webdav.property.HrefProperty getHrefProperty​(org.apache.jackrabbit.webdav.property.DavPropertyName name, Item[] values, boolean isProtected)
      Creates a new HrefProperty with the specified name using the given array of items as value.
      protected org.apache.jackrabbit.webdav.property.HrefProperty getHrefProperty​(org.apache.jackrabbit.webdav.property.DavPropertyName name, PropertyIterator itemIterator, boolean isProtected)
      Creates a new href property to the property set, where all properties present in the specified iterator are referenced in the resulting property.
      protected org.apache.jackrabbit.webdav.property.HrefProperty getHrefProperty​(org.apache.jackrabbit.webdav.property.DavPropertyName name, VersionIterator itemIterator, boolean isProtected)
      Add a new href 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.
      org.apache.jackrabbit.webdav.DavResourceLocator getLocator()  
      protected org.apache.jackrabbit.webdav.DavResourceLocator getLocatorFromItem​(Item repositoryItem)
      Build a new DavResourceLocator from the given repository item.
      protected org.apache.jackrabbit.webdav.DavResourceLocator getLocatorFromItemPath​(String itemPath)
      Build a DavResourceLocator from the given itemPath path.
      org.apache.jackrabbit.webdav.lock.ActiveLock getLock​(org.apache.jackrabbit.webdav.lock.Type type, org.apache.jackrabbit.webdav.lock.Scope scope)
      Retrieve the lock with the specified type and scope.
      org.apache.jackrabbit.webdav.lock.ActiveLock[] getLocks()  
      org.apache.jackrabbit.webdav.DavResourceIterator getMembers()  
      long getModificationTime()  
      org.apache.jackrabbit.webdav.version.OptionsResponse getOptionResponse​(org.apache.jackrabbit.webdav.version.OptionsInfo optionsInfo)  
      org.apache.jackrabbit.webdav.property.DavPropertySet getProperties()  
      org.apache.jackrabbit.webdav.property.DavProperty<?> getProperty​(org.apache.jackrabbit.webdav.property.DavPropertyName name)  
      org.apache.jackrabbit.webdav.property.DavPropertyName[] getPropertyNames()  
      org.apache.jackrabbit.webdav.search.QueryGrammerSet getQueryGrammerSet()  
      org.apache.jackrabbit.webdav.DavResource[] getReferenceResources​(org.apache.jackrabbit.webdav.property.DavPropertyName hrefPropertyName)
      Return an array of DavResource objects that are referenced by the property with the specified name.
      org.apache.jackrabbit.webdav.version.report.Report getReport​(org.apache.jackrabbit.webdav.version.report.ReportInfo 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).
      org.apache.jackrabbit.webdav.DavSession getSession()  
      String getSupportedMethods()  
      String getTransactionId()  
      protected String getWorkspaceHref()
      Retrieve the href of the workspace the current session belongs to.
      boolean hasLock​(org.apache.jackrabbit.webdav.lock.Type type, org.apache.jackrabbit.webdav.lock.Scope scope)
      Returns true if this resource has a lock applied with the given type and scope.
      void init​(org.apache.jackrabbit.webdav.observation.SubscriptionManager subsMgr)  
      void init​(org.apache.jackrabbit.webdav.transaction.TxLockManager txMgr, String transactionId)  
      protected void initLockSupport()
      Extend the general AbstractResource.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 repository node): export view report locate corresponding node report
      boolean isCollection()
      Always returns true
      boolean isLockable​(org.apache.jackrabbit.webdav.lock.Type type, org.apache.jackrabbit.webdav.lock.Scope scope)
      Returns true, if the SupportedLock 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.
      org.apache.jackrabbit.webdav.lock.ActiveLock lock​(org.apache.jackrabbit.webdav.lock.LockInfo reqLockInfo)
      Creates a lock on this resource by locking the underlying node.
      void move​(org.apache.jackrabbit.webdav.DavResource destination)
      Moves the underlying repository item to the indicated destination.
      protected String normalizeResourceHref​(String href)
      Normalize the resource href.
      void orderMembers​(org.apache.jackrabbit.webdav.ordering.OrderPatch orderPatch)
      Reorder the child nodes of the repository item represented by this resource as indicated by the specified OrderPatch object.
      org.apache.jackrabbit.webdav.observation.EventDiscovery poll​(String subscriptionId, long timeout)  
      org.apache.jackrabbit.webdav.lock.ActiveLock refreshLock​(org.apache.jackrabbit.webdav.lock.LockInfo reqLockInfo, String lockToken)
      Refreshes the lock on this resource.
      void removeMember​(org.apache.jackrabbit.webdav.DavResource member)
      Removes the repository item represented by the specified member resource.
      void removeProperty​(org.apache.jackrabbit.webdav.property.DavPropertyName propertyName)
      This implementation of the DavResource does only allow to remove the mixinnodetypes property.
      org.apache.jackrabbit.webdav.MultiStatus search​(org.apache.jackrabbit.webdav.search.SearchInfo sInfo)  
      void setProperty​(org.apache.jackrabbit.webdav.property.DavProperty<?> property)
      This implementation of the DavResource does only allow to set the mixinnodetypes property.
      void spool​(org.apache.jackrabbit.webdav.io.OutputContext outputContext)
      If this resource represents an existing Node the system view is spooled as resource content.
      org.apache.jackrabbit.webdav.observation.Subscription subscribe​(org.apache.jackrabbit.webdav.observation.SubscriptionInfo info, String subscriptionId)  
      void unlock​(String lockToken)
      Remove the write lock from this resource by unlocking the underlying node.
      void unlock​(String lockToken, org.apache.jackrabbit.webdav.transaction.TransactionInfo tInfo)  
      void unsubscribe​(String subscriptionId)  
      • 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 org.apache.jackrabbit.webdav.property.DavPropertySet properties
      • names

        protected org.apache.jackrabbit.webdav.property.DavPropertyNameSet names
      • supportedLock

        protected org.apache.jackrabbit.webdav.lock.SupportedLock supportedLock
      • supportedReports

        protected org.apache.jackrabbit.webdav.version.report.SupportedReportSetProperty supportedReports
    • Constructor Detail

      • DefaultItemCollection

        protected DefaultItemCollection​(org.apache.jackrabbit.webdav.DavResourceLocator locator,
                                        JcrDavSession session,
                                        org.apache.jackrabbit.webdav.DavResourceFactory factory,
                                        Item item)
        Create a new DefaultItemCollection.
        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 interface org.apache.jackrabbit.webdav.DavResource
        Returns:
        string listing the compliance classes.
        See Also:
        DavResource.getComplianceClass()
      • getModificationTime

        public long getModificationTime()
        Specified by:
        getModificationTime in interface org.apache.jackrabbit.webdav.DavResource
      • getSupportedMethods

        public String getSupportedMethods()
        Specified by:
        getSupportedMethods in interface org.apache.jackrabbit.webdav.DavResource
        See Also:
        DavResource.getSupportedMethods()
      • isCollection

        public boolean isCollection()
        Always returns true
        Specified by:
        isCollection in interface org.apache.jackrabbit.webdav.DavResource
        Returns:
        true
        See Also:
        DavResource.isCollection()
      • getProperty

        public org.apache.jackrabbit.webdav.property.DavProperty<?> getProperty​(org.apache.jackrabbit.webdav.property.DavPropertyName name)
        Specified by:
        getProperty in interface org.apache.jackrabbit.webdav.DavResource
        See Also:
        DavResource.getProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
      • setProperty

        public void setProperty​(org.apache.jackrabbit.webdav.property.DavProperty<?> property)
                         throws org.apache.jackrabbit.webdav.DavException
        This implementation of the DavResource 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 underlying Node use addMember(DavResource) or addMember(DavResource, InputStream) or modify the value of the corresponding resource.
        Specified by:
        setProperty in interface org.apache.jackrabbit.webdav.DavResource
        Parameters:
        property -
        Throws:
        org.apache.jackrabbit.webdav.DavException
        See Also:
        DavResource.setProperty(org.apache.jackrabbit.webdav.property.DavProperty), ItemResourceConstants.JCR_MIXINNODETYPES
      • removeProperty

        public void removeProperty​(org.apache.jackrabbit.webdav.property.DavPropertyName propertyName)
                            throws org.apache.jackrabbit.webdav.DavException
        This implementation of the DavResource does only allow to remove the mixinnodetypes property.
        Specified by:
        removeProperty in interface org.apache.jackrabbit.webdav.DavResource
        Parameters:
        propertyName -
        Throws:
        org.apache.jackrabbit.webdav.DavException
        See Also:
        DavResource.removeProperty(org.apache.jackrabbit.webdav.property.DavPropertyName), ItemResourceConstants.JCR_MIXINNODETYPES
      • alterProperties

        public org.apache.jackrabbit.webdav.MultiStatusResponse alterProperties​(List<? extends org.apache.jackrabbit.webdav.property.PropEntry> changeList)
                                                                         throws org.apache.jackrabbit.webdav.DavException
        Loops over the given Lists and alters the properties accordingly. Changes are persisted at the end according to the rules defined with the AbstractItemResource.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 interface org.apache.jackrabbit.webdav.DavResource
        Parameters:
        changeList -
        Returns:
        Throws:
        org.apache.jackrabbit.webdav.DavException
        See Also:
        DavResource.alterProperties(List)
      • addMember

        public void addMember​(org.apache.jackrabbit.webdav.DavResource resource,
                              org.apache.jackrabbit.webdav.io.InputContext inputContext)
                       throws org.apache.jackrabbit.webdav.DavException
        If the specified resource represents a collection, a new node is added to the item represented by this resource. If an input stream is specified together with a collection resource Session.importXML(String, java.io.InputStream, int) is called instead and this resource path is used as parentAbsPath 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 an undefined resource type, its value will be changed/set to type binary.

        Specified by:
        addMember in interface org.apache.jackrabbit.webdav.DavResource
        Parameters:
        resource -
        inputContext -
        Throws:
        org.apache.jackrabbit.webdav.DavException
        See Also:
        DavResource.addMember(org.apache.jackrabbit.webdav.DavResource, InputContext), Node.addNode(String), Node.setProperty(String, java.io.InputStream)
      • getMembers

        public org.apache.jackrabbit.webdav.DavResourceIterator getMembers()
        Specified by:
        getMembers in interface org.apache.jackrabbit.webdav.DavResource
        See Also:
        DavResource.getMembers()
      • removeMember

        public void removeMember​(org.apache.jackrabbit.webdav.DavResource member)
                          throws org.apache.jackrabbit.webdav.DavException
        Removes the repository item represented by the specified member resource.
        Specified by:
        removeMember in interface org.apache.jackrabbit.webdav.DavResource
        Throws:
        org.apache.jackrabbit.webdav.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​(org.apache.jackrabbit.webdav.lock.Type type,
                               org.apache.jackrabbit.webdav.lock.Scope scope)
        Returns true if this resource has a lock applied with the given type and scope.
        Specified by:
        hasLock in interface org.apache.jackrabbit.webdav.DavResource
        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 org.apache.jackrabbit.webdav.lock.ActiveLock getLock​(org.apache.jackrabbit.webdav.lock.Type type,
                                                                    org.apache.jackrabbit.webdav.lock.Scope scope)
        Retrieve the lock with the specified type and scope.
        Specified by:
        getLock in interface org.apache.jackrabbit.webdav.DavResource
        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 org.apache.jackrabbit.webdav.lock.ActiveLock lock​(org.apache.jackrabbit.webdav.lock.LockInfo reqLockInfo)
                                                          throws org.apache.jackrabbit.webdav.DavException
        Creates a lock on this resource by locking the underlying node. Except for the LockInfo.isDeep() } all information included in the LockInfo object is ignored. Lock timeout is defined by JCR implementation.
        Specified by:
        lock in interface org.apache.jackrabbit.webdav.DavResource
        Parameters:
        reqLockInfo -
        Returns:
        lock object representing the lock created on this resource.
        Throws:
        org.apache.jackrabbit.webdav.DavException
        See Also:
        DavResource.lock(org.apache.jackrabbit.webdav.lock.LockInfo), Node.lock(boolean, boolean)
      • refreshLock

        public org.apache.jackrabbit.webdav.lock.ActiveLock refreshLock​(org.apache.jackrabbit.webdav.lock.LockInfo reqLockInfo,
                                                                        String lockToken)
                                                                 throws org.apache.jackrabbit.webdav.DavException
        Refreshes the lock on this resource. With this implementation the lock present on the underlying node is refreshed. The timeout indicated by the LockInfo object is ignored.
        Specified by:
        refreshLock in interface org.apache.jackrabbit.webdav.DavResource
        Parameters:
        reqLockInfo - LockInfo as build from the request.
        lockToken -
        Returns:
        the updated lock info object.
        Throws:
        org.apache.jackrabbit.webdav.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 org.apache.jackrabbit.webdav.DavException
        Remove the write lock from this resource by unlocking the underlying node.
        Specified by:
        unlock in interface org.apache.jackrabbit.webdav.DavResource
        Parameters:
        lockToken -
        Throws:
        org.apache.jackrabbit.webdav.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 interface org.apache.jackrabbit.webdav.ordering.OrderingResource
        Returns:
        true if orderMembers(OrderPatch) can be called on this resource.
        See Also:
        OrderingResource.isOrderable(), NodeTypeDefinition.hasOrderableChildNodes()
      • orderMembers

        public void orderMembers​(org.apache.jackrabbit.webdav.ordering.OrderPatch orderPatch)
                          throws org.apache.jackrabbit.webdav.DavException
        Reorder the child nodes of the repository item represented by this resource as indicated by the specified OrderPatch object.
        Specified by:
        orderMembers in interface org.apache.jackrabbit.webdav.ordering.OrderingResource
        Parameters:
        orderPatch -
        Throws:
        org.apache.jackrabbit.webdav.DavException
        See Also:
        OrderingResource.orderMembers(org.apache.jackrabbit.webdav.ordering.OrderPatch), Node.orderBefore(String, String)
      • initLockSupport

        protected void initLockSupport()
        Extend the general AbstractResource.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 repository node):
        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 protected DeltaVConstants.CREATOR_DISPLAYNAME property.
        Returns:
        always null; subclasses may provide a regular value.
      • getCreationDate

        protected String getCreationDate()
        Returns the creation date which is used for the DavPropertyName.CREATIONDATE property.
        Returns:
        a dummy date; subclasses may provide a reasonable value.
      • getHrefProperty

        protected org.apache.jackrabbit.webdav.property.HrefProperty getHrefProperty​(org.apache.jackrabbit.webdav.property.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​(org.apache.jackrabbit.webdav.property.DavPropertyName name,
                                       Item[] values,
                                       boolean isProtected)
        Add a HrefProperty 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 org.apache.jackrabbit.webdav.property.HrefProperty getHrefProperty​(org.apache.jackrabbit.webdav.property.DavPropertyName name,
                                                                                     PropertyIterator itemIterator,
                                                                                     boolean isProtected)
        Creates a new href 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​(org.apache.jackrabbit.webdav.property.DavPropertyName name,
                                       PropertyIterator itemIterator,
                                       boolean isProtected)
        Add a new href 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 org.apache.jackrabbit.webdav.property.HrefProperty getHrefProperty​(org.apache.jackrabbit.webdav.property.DavPropertyName name,
                                                                                     VersionIterator itemIterator,
                                                                                     boolean isProtected)
        Add a new href 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​(org.apache.jackrabbit.webdav.property.DavPropertyName name,
                                       VersionIterator itemIterator,
                                       boolean isProtected)
        Add a new href 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 a repository item with the given resource path, false otherwise.
        Specified by:
        exists in interface org.apache.jackrabbit.webdav.DavResource
        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 to item name which is exposed with the {http://www.day.com/jcr/webdav/1.0}name property.
        Specified by:
        getDisplayName in interface org.apache.jackrabbit.webdav.DavResource
        See Also:
        DavResource.getDisplayName()
      • getCollection

        public org.apache.jackrabbit.webdav.DavResource getCollection()
        Returns the resource representing the parent item of the repository item represented by this resource. If this resoure represents the root item a RootCollection is returned.
        Specified by:
        getCollection in interface org.apache.jackrabbit.webdav.DavResource
        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​(org.apache.jackrabbit.webdav.DavResource destination)
                  throws org.apache.jackrabbit.webdav.DavException
        Moves the underlying repository item to the indicated destination.
        Specified by:
        move in interface org.apache.jackrabbit.webdav.DavResource
        Parameters:
        destination -
        Throws:
        org.apache.jackrabbit.webdav.DavException
        See Also:
        DavResource.move(DavResource), Session.move(String, String)
      • copy

        public void copy​(org.apache.jackrabbit.webdav.DavResource destination,
                         boolean shallow)
                  throws org.apache.jackrabbit.webdav.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 interface org.apache.jackrabbit.webdav.DavResource
        Parameters:
        destination -
        shallow -
        Throws:
        org.apache.jackrabbit.webdav.DavException
        See Also:
        DavResource.copy(DavResource, boolean), Workspace.copy(String, String), Workspace.copy(String, String, String)
      • init

        public void init​(org.apache.jackrabbit.webdav.observation.SubscriptionManager subsMgr)
        Specified by:
        init in interface org.apache.jackrabbit.webdav.observation.ObservationResource
        See Also:
        ObservationResource.init(SubscriptionManager)
      • subscribe

        public org.apache.jackrabbit.webdav.observation.Subscription subscribe​(org.apache.jackrabbit.webdav.observation.SubscriptionInfo info,
                                                                               String subscriptionId)
                                                                        throws org.apache.jackrabbit.webdav.DavException
        Specified by:
        subscribe in interface org.apache.jackrabbit.webdav.observation.ObservationResource
        Throws:
        org.apache.jackrabbit.webdav.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 org.apache.jackrabbit.webdav.DavException
        Specified by:
        unsubscribe in interface org.apache.jackrabbit.webdav.observation.ObservationResource
        Throws:
        org.apache.jackrabbit.webdav.DavException
        See Also:
        ObservationResource.unsubscribe(String), SubscriptionManager.unsubscribe(String, org.apache.jackrabbit.webdav.observation.ObservationResource)
      • poll

        public org.apache.jackrabbit.webdav.observation.EventDiscovery poll​(String subscriptionId,
                                                                            long timeout)
                                                                     throws org.apache.jackrabbit.webdav.DavException
        Specified by:
        poll in interface org.apache.jackrabbit.webdav.observation.ObservationResource
        Throws:
        org.apache.jackrabbit.webdav.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 org.apache.jackrabbit.webdav.DavResourceLocator getLocator()
        Specified by:
        getLocator in interface org.apache.jackrabbit.webdav.DavResource
        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 item null is returned.
        Specified by:
        getResourcePath in interface org.apache.jackrabbit.webdav.DavResource
        Returns:
        path of the underlying repository item.
        See Also:
        DavResource.getResourcePath(), DavResourceLocator.getResourcePath()
      • getHref

        public String getHref()
        Specified by:
        getHref in interface org.apache.jackrabbit.webdav.DavResource
        See Also:
        DavResource.getHref(), DavResourceLocator.getHref(boolean)
      • getPropertyNames

        public org.apache.jackrabbit.webdav.property.DavPropertyName[] getPropertyNames()
        Specified by:
        getPropertyNames in interface org.apache.jackrabbit.webdav.DavResource
        See Also:
        DavResource.getPropertyNames()
      • getProperties

        public org.apache.jackrabbit.webdav.property.DavPropertySet getProperties()
        Specified by:
        getProperties in interface org.apache.jackrabbit.webdav.DavResource
        See Also:
        DavResource.getProperties()
      • isLockable

        public boolean isLockable​(org.apache.jackrabbit.webdav.lock.Type type,
                                  org.apache.jackrabbit.webdav.lock.Scope scope)
        Returns true, if the SupportedLock property contains an entry with the given type and scope. By default resources allow for transaction lock only.
        Specified by:
        isLockable in interface org.apache.jackrabbit.webdav.DavResource
        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 org.apache.jackrabbit.webdav.lock.ActiveLock[] getLocks()
        Specified by:
        getLocks in interface org.apache.jackrabbit.webdav.DavResource
        See Also:
        todo improve....
      • addLockManager

        public void addLockManager​(org.apache.jackrabbit.webdav.lock.LockManager lockMgr)
        Specified by:
        addLockManager in interface org.apache.jackrabbit.webdav.DavResource
        See Also:
        DavResource.addLockManager(org.apache.jackrabbit.webdav.lock.LockManager)
      • getFactory

        public org.apache.jackrabbit.webdav.DavResourceFactory getFactory()
        Specified by:
        getFactory in interface org.apache.jackrabbit.webdav.DavResource
        See Also:
        DavResource.getFactory()
      • getSession

        public org.apache.jackrabbit.webdav.DavSession getSession()
        Specified by:
        getSession in interface org.apache.jackrabbit.webdav.DavResource
        See Also:
        DavResource.getSession(), DavResource.getSession()
      • init

        public void init​(org.apache.jackrabbit.webdav.transaction.TxLockManager txMgr,
                         String transactionId)
        Specified by:
        init in interface org.apache.jackrabbit.webdav.transaction.TransactionResource
        See Also:
        TransactionResource.init(TxLockManager, String)
      • unlock

        public void unlock​(String lockToken,
                           org.apache.jackrabbit.webdav.transaction.TransactionInfo tInfo)
                    throws org.apache.jackrabbit.webdav.DavException
        Specified by:
        unlock in interface org.apache.jackrabbit.webdav.transaction.TransactionResource
        Throws:
        org.apache.jackrabbit.webdav.DavException
        See Also:
        TransactionResource.unlock(String, org.apache.jackrabbit.webdav.transaction.TransactionInfo)
      • getTransactionId

        public String getTransactionId()
        Specified by:
        getTransactionId in interface org.apache.jackrabbit.webdav.transaction.TransactionResource
        See Also:
        TransactionResource.getTransactionId()
      • getOptionResponse

        public org.apache.jackrabbit.webdav.version.OptionsResponse getOptionResponse​(org.apache.jackrabbit.webdav.version.OptionsInfo optionsInfo)
        Specified by:
        getOptionResponse in interface org.apache.jackrabbit.webdav.version.DeltaVResource
        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 org.apache.jackrabbit.webdav.version.report.Report getReport​(org.apache.jackrabbit.webdav.version.report.ReportInfo reportInfo)
                                                                     throws org.apache.jackrabbit.webdav.DavException
        Specified by:
        getReport in interface org.apache.jackrabbit.webdav.version.DeltaVResource
        Parameters:
        reportInfo -
        Returns:
        the requested report
        Throws:
        org.apache.jackrabbit.webdav.DavException
        See Also:
        DeltaVResource.getReport(org.apache.jackrabbit.webdav.version.report.ReportInfo)
      • addWorkspace

        public void addWorkspace​(org.apache.jackrabbit.webdav.DavResource workspace)
                          throws org.apache.jackrabbit.webdav.DavException
        The JCR api does not provide methods to create new workspaces. Calling addWorkspace on this resource will always fail.
        Specified by:
        addWorkspace in interface org.apache.jackrabbit.webdav.version.DeltaVResource
        Parameters:
        workspace -
        Throws:
        org.apache.jackrabbit.webdav.DavException - Always throws.
        See Also:
        DeltaVResource.addWorkspace(org.apache.jackrabbit.webdav.DavResource)
      • getReferenceResources

        public org.apache.jackrabbit.webdav.DavResource[] getReferenceResources​(org.apache.jackrabbit.webdav.property.DavPropertyName hrefPropertyName)
                                                                         throws org.apache.jackrabbit.webdav.DavException
        Return an array of DavResource objects that are referenced by the property with the specified name.
        Specified by:
        getReferenceResources in interface org.apache.jackrabbit.webdav.version.DeltaVResource
        Parameters:
        hrefPropertyName -
        Returns:
        array of DavResources
        Throws:
        org.apache.jackrabbit.webdav.DavException
        See Also:
        DeltaVResource.getReferenceResources(org.apache.jackrabbit.webdav.property.DavPropertyName)
      • getQueryGrammerSet

        public org.apache.jackrabbit.webdav.search.QueryGrammerSet getQueryGrammerSet()
        Specified by:
        getQueryGrammerSet in interface org.apache.jackrabbit.webdav.search.SearchResource
        Returns:
        See Also:
        SearchResource.getQueryGrammerSet()
      • search

        public org.apache.jackrabbit.webdav.MultiStatus search​(org.apache.jackrabbit.webdav.search.SearchInfo sInfo)
                                                        throws org.apache.jackrabbit.webdav.DavException
        Specified by:
        search in interface org.apache.jackrabbit.webdav.search.SearchResource
        Parameters:
        sInfo -
        Returns:
        Throws:
        org.apache.jackrabbit.webdav.DavException
        See Also:
        SearchResource.search(org.apache.jackrabbit.webdav.search.SearchInfo)
      • createResourceFromLocator

        protected org.apache.jackrabbit.webdav.DavResource createResourceFromLocator​(org.apache.jackrabbit.webdav.DavResourceLocator loc)
                                                                              throws org.apache.jackrabbit.webdav.DavException
        Create a new DavResource from the given locator.
        Parameters:
        loc -
        Returns:
        new DavResource
        Throws:
        org.apache.jackrabbit.webdav.DavException
      • getLocatorFromItemPath

        protected org.apache.jackrabbit.webdav.DavResourceLocator getLocatorFromItemPath​(String itemPath)
        Build a DavResourceLocator from the given itemPath path.
        Parameters:
        itemPath -
        Returns:
        a new DavResourceLocator
        See Also:
        DavLocatorFactory.createResourceLocator(String, String, String)
      • getLocatorFromItem

        protected org.apache.jackrabbit.webdav.DavResourceLocator getLocatorFromItem​(Item repositoryItem)
        Build a new DavResourceLocator from the given repository item.
        Parameters:
        repositoryItem -
        Returns:
        a new locator for the specified item.
        See Also:
        getLocatorFromItemPath(String)
      • getRepositorySession

        protected Session getRepositorySession()
        Shortcut for getSession().getRepositorySession()
        Returns:
        repository session present in the AbstractResource.session.
      • normalizeResourceHref

        protected String normalizeResourceHref​(String href)
        Normalize the resource href. For example, remove contextPath prefix if found.
        Parameters:
        href - resource href
        Returns:
        normalized resource href