com.xpn.xwiki.plugin.webdav.resources.partial
Class AbstractDavResource

java.lang.Object
  extended by com.xpn.xwiki.plugin.webdav.resources.partial.AbstractDavResource
All Implemented Interfaces:
XWikiDavResource, org.apache.jackrabbit.webdav.DavResource
Direct Known Subclasses:
AbstractDavFile, AbstractDavView, DavPage, DavTempFile

public abstract class AbstractDavResource
extends java.lang.Object
implements XWikiDavResource

The superclass for all XWiki WebDAV resources.

Version:
$Id: AbstractDavResource.java 32446 2010-11-04 08:55:46Z vmassol $

Field Summary
protected  org.apache.jackrabbit.webdav.DavResourceLocator locator
          Resource locator for this resource.
protected  java.lang.String name
          Name of this resource.
protected  XWikiDavResource parentResource
          Parent resource (collection).
 
Fields inherited from interface com.xpn.xwiki.plugin.webdav.resources.XWikiDavResource
BASE_URI
 
Fields inherited from interface org.apache.jackrabbit.webdav.DavResource
COMPLIANCE_CLASS, METHODS
 
Constructor Summary
AbstractDavResource()
           
 
Method Summary
 void addLockManager(org.apache.jackrabbit.webdav.lock.LockManager lockmgr)
          
 void addVirtualMember(org.apache.jackrabbit.webdav.DavResource resource, org.apache.jackrabbit.webdav.io.InputContext inputContext)
          Utility method for adding virtual members.
 org.apache.jackrabbit.webdav.MultiStatusResponse alterProperties(org.apache.jackrabbit.webdav.property.DavPropertySet setProperties, org.apache.jackrabbit.webdav.property.DavPropertyNameSet removePropertyNames)
          
 org.apache.jackrabbit.webdav.MultiStatusResponse alterProperties(java.util.List changeList)
          
 void clearCache()
          Removes everything belonging to this resource from the cache.
 void copy(org.apache.jackrabbit.webdav.DavResource destination, boolean shallow)
          
 XWikiDavResource decode(java.lang.String[] tokens, int next)
           The default decode implementation assumes the next resource in chain to be a temporary resource.
 boolean equals(java.lang.Object obj)
          
 org.apache.jackrabbit.webdav.DavResource getCollection()
          
 java.lang.String getComplianceClass()
          
 XWikiDavContext getContext()
          
 java.lang.String getDisplayName()
          
 org.apache.jackrabbit.webdav.DavResourceFactory getFactory()
          
 java.lang.String getHref()
          
 java.util.List<XWikiDavResource> getInitMembers()
          
 org.apache.jackrabbit.webdav.DavResourceLocator getLocator()
          
 org.apache.jackrabbit.webdav.lock.ActiveLock getLock(org.apache.jackrabbit.webdav.lock.Type type, org.apache.jackrabbit.webdav.lock.Scope scope)
          
 org.apache.jackrabbit.webdav.lock.ActiveLock[] getLocks()
          
 org.apache.jackrabbit.webdav.property.DavPropertySet getProperties()
          Default implementation simply returns all the cached properties.
 org.apache.jackrabbit.webdav.property.DavProperty getProperty(org.apache.jackrabbit.webdav.property.DavPropertyName name)
          
 org.apache.jackrabbit.webdav.property.DavPropertyName[] getPropertyNames()
          
 java.lang.String getResourcePath()
          
 org.apache.jackrabbit.webdav.DavSession getSession()
          
 java.lang.String getSupportedMethods()
          
 java.util.List<XWikiDavResource> getVirtualMembers()
          
 org.apache.jackrabbit.webdav.property.DavPropertySet getVirtualProperties()
          
 int hashCode()
          
 boolean hasLock(org.apache.jackrabbit.webdav.lock.Type type, org.apache.jackrabbit.webdav.lock.Scope scope)
          
 void init(java.lang.String name, org.apache.jackrabbit.webdav.DavResourceLocator locator, XWikiDavContext context)
          Initializes this resource with the given parameters.
 void init(XWikiDavResource parent, java.lang.String name, java.lang.String relativePath)
          Initializes this resource with common attributes inherited from the parent.
 boolean isLockable(org.apache.jackrabbit.webdav.lock.Type type, org.apache.jackrabbit.webdav.lock.Scope scope)
          
 boolean isTempResource(java.lang.String resourceName)
          Checks if the given resource name corresponds to a temporary resource.
 org.apache.jackrabbit.webdav.lock.ActiveLock lock(org.apache.jackrabbit.webdav.lock.LockInfo reqLockInfo)
          
 org.apache.jackrabbit.webdav.lock.ActiveLock refreshLock(org.apache.jackrabbit.webdav.lock.LockInfo reqLockInfo, java.lang.String lockToken)
          
 void removeProperty(org.apache.jackrabbit.webdav.property.DavPropertyName propertyName)
          
 void removeVirtualMember(org.apache.jackrabbit.webdav.DavResource member)
          Utility method for removing virtual members.
 void setProperty(org.apache.jackrabbit.webdav.property.DavProperty property)
          
 void unlock(java.lang.String lockToken)
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jackrabbit.webdav.DavResource
addMember, exists, getMembers, getModificationTime, isCollection, move, removeMember, spool
 

Field Detail

name

protected java.lang.String name
Name of this resource.


locator

protected org.apache.jackrabbit.webdav.DavResourceLocator locator
Resource locator for this resource. DavResourceLocator.


parentResource

protected XWikiDavResource parentResource
Parent resource (collection).

Constructor Detail

AbstractDavResource

public AbstractDavResource()
Method Detail

init

public void init(XWikiDavResource parent,
                 java.lang.String name,
                 java.lang.String relativePath)
          throws org.apache.jackrabbit.webdav.DavException
Initializes this resource with common attributes inherited from the parent.

Specified by:
init in interface XWikiDavResource
Parameters:
parent - Parent resource.
name - Name of this resource.
relativePath - Path relative to the parent resource.
Throws:
org.apache.jackrabbit.webdav.DavException - If the initialization fails.

init

public void init(java.lang.String name,
                 org.apache.jackrabbit.webdav.DavResourceLocator locator,
                 XWikiDavContext context)
          throws org.apache.jackrabbit.webdav.DavException
Initializes this resource with the given parameters.

Specified by:
init in interface XWikiDavResource
Parameters:
name - Name of this resource.
locator - Dav resource locator.
context - XWiki dav context.
Throws:
org.apache.jackrabbit.webdav.DavException - If the initialization fails.

decode

public XWikiDavResource decode(java.lang.String[] tokens,
                               int next)
                        throws org.apache.jackrabbit.webdav.DavException

The default decode implementation assumes the next resource in chain to be a temporary resource. Sub classes should override this method to provide their own implementation.

Specified by:
decode in interface XWikiDavResource
Parameters:
tokens - segmented URL.
next - next index to be processed by this resource.
Returns:
the XWikiDavResource corresponding to the given URL.
Throws:
org.apache.jackrabbit.webdav.DavException - If it's not possible to decode the URL.

isLockable

public boolean isLockable(org.apache.jackrabbit.webdav.lock.Type type,
                          org.apache.jackrabbit.webdav.lock.Scope scope)

Specified by:
isLockable in interface org.apache.jackrabbit.webdav.DavResource

getLock

public org.apache.jackrabbit.webdav.lock.ActiveLock getLock(org.apache.jackrabbit.webdav.lock.Type type,
                                                            org.apache.jackrabbit.webdav.lock.Scope scope)

Specified by:
getLock in interface org.apache.jackrabbit.webdav.DavResource

getLocks

public org.apache.jackrabbit.webdav.lock.ActiveLock[] getLocks()

Specified by:
getLocks in interface org.apache.jackrabbit.webdav.DavResource

hasLock

public boolean hasLock(org.apache.jackrabbit.webdav.lock.Type type,
                       org.apache.jackrabbit.webdav.lock.Scope scope)

Specified by:
hasLock in interface org.apache.jackrabbit.webdav.DavResource

lock

public org.apache.jackrabbit.webdav.lock.ActiveLock lock(org.apache.jackrabbit.webdav.lock.LockInfo reqLockInfo)
                                                  throws org.apache.jackrabbit.webdav.DavException

Specified by:
lock in interface org.apache.jackrabbit.webdav.DavResource
Throws:
org.apache.jackrabbit.webdav.DavException

refreshLock

public org.apache.jackrabbit.webdav.lock.ActiveLock refreshLock(org.apache.jackrabbit.webdav.lock.LockInfo reqLockInfo,
                                                                java.lang.String lockToken)
                                                         throws org.apache.jackrabbit.webdav.DavException

Specified by:
refreshLock in interface org.apache.jackrabbit.webdav.DavResource
Throws:
org.apache.jackrabbit.webdav.DavException

unlock

public void unlock(java.lang.String lockToken)
            throws org.apache.jackrabbit.webdav.DavException

Specified by:
unlock in interface org.apache.jackrabbit.webdav.DavResource
Throws:
org.apache.jackrabbit.webdav.DavException

copy

public void copy(org.apache.jackrabbit.webdav.DavResource destination,
                 boolean shallow)
          throws org.apache.jackrabbit.webdav.DavException

Specified by:
copy in interface org.apache.jackrabbit.webdav.DavResource
Throws:
org.apache.jackrabbit.webdav.DavException

getProperties

public org.apache.jackrabbit.webdav.property.DavPropertySet getProperties()
Default implementation simply returns all the cached properties.

Specified by:
getProperties in interface org.apache.jackrabbit.webdav.DavResource
Returns:
The set of properties associated with this resource.

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

getPropertyNames

public org.apache.jackrabbit.webdav.property.DavPropertyName[] getPropertyNames()

Specified by:
getPropertyNames in interface org.apache.jackrabbit.webdav.DavResource

alterProperties

public org.apache.jackrabbit.webdav.MultiStatusResponse alterProperties(org.apache.jackrabbit.webdav.property.DavPropertySet setProperties,
                                                                        org.apache.jackrabbit.webdav.property.DavPropertyNameSet removePropertyNames)
                                                                 throws org.apache.jackrabbit.webdav.DavException

Specified by:
alterProperties in interface org.apache.jackrabbit.webdav.DavResource
Throws:
org.apache.jackrabbit.webdav.DavException

alterProperties

public org.apache.jackrabbit.webdav.MultiStatusResponse alterProperties(java.util.List changeList)
                                                                 throws org.apache.jackrabbit.webdav.DavException

Specified by:
alterProperties in interface org.apache.jackrabbit.webdav.DavResource
Throws:
org.apache.jackrabbit.webdav.DavException

removeProperty

public void removeProperty(org.apache.jackrabbit.webdav.property.DavPropertyName propertyName)
                    throws org.apache.jackrabbit.webdav.DavException

Specified by:
removeProperty in interface org.apache.jackrabbit.webdav.DavResource
Throws:
org.apache.jackrabbit.webdav.DavException

setProperty

public void setProperty(org.apache.jackrabbit.webdav.property.DavProperty property)
                 throws org.apache.jackrabbit.webdav.DavException

Specified by:
setProperty in interface org.apache.jackrabbit.webdav.DavResource
Throws:
org.apache.jackrabbit.webdav.DavException

addLockManager

public void addLockManager(org.apache.jackrabbit.webdav.lock.LockManager lockmgr)

Specified by:
addLockManager in interface org.apache.jackrabbit.webdav.DavResource

getDisplayName

public java.lang.String getDisplayName()

Specified by:
getDisplayName in interface org.apache.jackrabbit.webdav.DavResource

getComplianceClass

public java.lang.String getComplianceClass()

Specified by:
getComplianceClass in interface org.apache.jackrabbit.webdav.DavResource

getSupportedMethods

public java.lang.String getSupportedMethods()

Specified by:
getSupportedMethods in interface org.apache.jackrabbit.webdav.DavResource

getFactory

public org.apache.jackrabbit.webdav.DavResourceFactory getFactory()

Specified by:
getFactory in interface org.apache.jackrabbit.webdav.DavResource

getLocator

public org.apache.jackrabbit.webdav.DavResourceLocator getLocator()

Specified by:
getLocator in interface org.apache.jackrabbit.webdav.DavResource

getResourcePath

public java.lang.String getResourcePath()

Specified by:
getResourcePath in interface org.apache.jackrabbit.webdav.DavResource

getHref

public java.lang.String getHref()

Specified by:
getHref in interface org.apache.jackrabbit.webdav.DavResource

getSession

public org.apache.jackrabbit.webdav.DavSession getSession()

Specified by:
getSession in interface org.apache.jackrabbit.webdav.DavResource

getCollection

public org.apache.jackrabbit.webdav.DavResource getCollection()

Specified by:
getCollection in interface org.apache.jackrabbit.webdav.DavResource

getContext

public XWikiDavContext getContext()

Specified by:
getContext in interface XWikiDavResource
Returns:
The XWikiDavContext for this resource.

getVirtualMembers

public java.util.List<XWikiDavResource> getVirtualMembers()

Specified by:
getVirtualMembers in interface XWikiDavResource
Returns:
List of virtual members for this resource.

getVirtualProperties

public org.apache.jackrabbit.webdav.property.DavPropertySet getVirtualProperties()

Specified by:
getVirtualProperties in interface XWikiDavResource
Returns:
Set of virtual properties for this resource.

getInitMembers

public java.util.List<XWikiDavResource> getInitMembers()

Specified by:
getInitMembers in interface XWikiDavResource
Returns:
List of members that is added to the initial virtual member list.

clearCache

public void clearCache()
Removes everything belonging to this resource from the cache.

Specified by:
clearCache in interface XWikiDavResource

addVirtualMember

public void addVirtualMember(org.apache.jackrabbit.webdav.DavResource resource,
                             org.apache.jackrabbit.webdav.io.InputContext inputContext)
                      throws org.apache.jackrabbit.webdav.DavException
Utility method for adding virtual members.

Parameters:
resource - XWikiDavResource instance.
inputContext - InputContext
Throws:
org.apache.jackrabbit.webdav.DavException

removeVirtualMember

public void removeVirtualMember(org.apache.jackrabbit.webdav.DavResource member)
                         throws org.apache.jackrabbit.webdav.DavException
Utility method for removing virtual members.

Parameters:
member - XWikiDavResource to be removed.
Throws:
org.apache.jackrabbit.webdav.DavException

isTempResource

public boolean isTempResource(java.lang.String resourceName)
Checks if the given resource name corresponds to a temporary resource.

Parameters:
resourceName - Name of the resource.
Returns:
True if the resourceName corresponds to a temporary file / directory. False otherwise.

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object


Copyright © 2004-2011 XWiki. All Rights Reserved.