Path

ez components / documentation / api reference / trunk / webdav


eZ Components trunk

Webdav: ezcWebdavSimpleBackend

[ Tutorial ] [ Clients ] [ Plugin architecture ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcWebdavSimpleBackend

Abstract base class for common backend operations. [source]

Implemented Interfaces

This base backend provides the generic handling of requests and dispatches the required actions to some basic manipulation methods, which you are required to implement, when extending this base class.
This backend does not provide support for extended Webdav features, like compression, or lock handling by the backend, therefore the getFeatures() method is final. If you want to develop a backend which is capable of manual handling those features directly extend from ezcWebdavBackend.

Parents

ezcWebdavBackend
   |
   --ezcWebdavSimpleBackend

Descendents

Child Class Description
ezcWebdavFileBackend File system based backend.

Inherited Constants

From ezcWebdavBackend:
ezcWebdavBackend::COMPRESSION_BZIP2    Backend has native support for bzip2 compression.
ezcWebdavBackend::COMPRESSION_GZIP    Backend has native support for gzip compression.
ezcWebdavBackend::CUSTOM_LOCK    Backend performs locking itself - no handling by server is required.
ezcWebdavBackend::MULTIPART    Backend has native support for multipart requests.
ezcWebdavBackend::PARTIAL    Backend has native support for partial requests.

Method Summary

protected ezcWebdavErrorResponse|null checkIfMatchHeaders( $req, $path )
Checks the If-Match and If-None-Match headers.
public ezcWebdavResponse copy( $request )
Serves COPY requests.
protected abstract void createCollection( $path )
Create a new collection.
protected abstract void createResource( $path, [$content = null] )
Create a new resource.
public ezcWebdavResponse delete( $request )
Serves DELETE requests.
protected ezcWebdavMultistatusResponse fetchAllProperties( $request )
Returns all available properties for a resource.
protected ezcWebdavResponse fetchProperties( $request )
Returns properties, fetched by name.
protected ezcWebdavResponse fetchPropertyNames( $request )
Returns names of all available properties for a resource.
public ezcWebdavResponse get( $request )
Serves GET requests.
public abstract ezcWebdavPropertyStorage getAllProperties( $path )
Returns all properties for a resource.
protected abstract array(ezcWebdavResource|ezcWebdavCollection) getCollectionMembers( $path )
Returns members of collection.
protected void getETag( $path )
Returns the etag representing the current state of $path.
public int getFeatures( )
Returns additional features supported by the backend.
protected array(ezcWebdavResource|ezcWebdavCollection) getNodes( $source, $depth )
Returns all child nodes.
public abstract ezcWebdavProperty getProperty( $path, $propertyName, [$namespace = 'DAV:'] )
Returns a property of a resource.
protected abstract string getResourceContents( $path )
Returns the content of a resource.
public ezcWebdavResponse head( $request )
Serves HEAD requests.
protected abstract bool isCollection( $path )
Returns if resource is a collection.
public ezcWebdavResponse makeCollection( $request )
Serves MKCOL (make collection) requests.
public ezcWebdavResponse move( $request )
Serves MOVE requests.
protected abstract bool nodeExists( $path )
Returns if a resource exists.
public ezcWebdavOptionsResponse options( $request )
Handles the OPTIONS request.
protected abstract array(ezcWebdavErrorResponse) performCopy( $fromPath, $toPath, [$depth = ezcWebdavRequest::DEPTH_INFINITY] )
Copies resources recursively from one path to another.
protected abstract ezcWebdavMultitstatusResponse|null performDelete( $path )
Deletes everything below a path.
public ezcWebdavResponse propFind( $request )
Serves PROPFIND requests.
public ezcWebdavResponse propPatch( $request )
Serves PROPPATCH requests.
public ezcWebdavResponse put( $request )
Serves PUT requests.
public abstract bool removeProperty( $path, $property )
Manually removes a property from a resource.
public abstract bool resetProperties( $path, $properties )
Resets the property storage for a resource.
public abstract bool setProperty( $path, $property )
Manually sets a property on a resource.
protected abstract void setResourceContents( $path, $content )
Changes contents of a resource.

Inherited Methods

From ezcWebdavBackend :
public abstract ezcWebdavResponse ezcWebdavBackend::get()
Serves GET requests.
public int ezcWebdavBackend::getFeatures()
Returns additional features supported by the backend.
public abstract ezcWebdavResponse ezcWebdavBackend::head()
Serves HEAD requests.
public ezcWebdavResponse ezcWebdavBackend::options()
Required method to serve OPTIONS requests.
public ezcWebdavResponse ezcWebdavBackend::performRequest()
Performs the given request.
public abstract ezcWebdavResponse ezcWebdavBackend::propFind()
Serves PROPFIND requests.
public abstract ezcWebdavResponse ezcWebdavBackend::propPatch()
Serves PROPPATCH requests.

Methods

checkIfMatchHeaders

ezcWebdavErrorResponse|null checkIfMatchHeaders( ezcWebdavRequest $req, string $path )
Checks the If-Match and If-None-Match headers.
Checks if the If-Match and If-None-Match headers (potentially) provided by $req are valid for the resource identified by $path.
Returns null if everything is alright, ezcWebdavErrorResponse if any ETag check failed.

Parameters

Name Type Description
$req ezcWebdavRequest  
$path string  

copy

Serves COPY requests.
The method receives a ezcWebdavCopyRequest objects containing all relevant information obout the clients request and will return an instance of ezcWebdavErrorResponse on error or ezcWebdavCopyResponse on success. If only some operations failed, this method may return an instance of ezcWebdavMultistatusResponse.

Parameters

Name Type Description
$request ezcWebdavCopyRequest  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::copy() Serves COPY requests.

createCollection

void createCollection( string $path )
Create a new collection.
Creates a new collection at the given $path.

Parameters

Name Type Description
$path string  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::createCollection() Creates a new collection.

createResource

void createResource( string $path, [string $content = null] )
Create a new resource.
Creates a new resource at the given $path, optionally with the given $content.

Parameters

Name Type Description
$path string  
$content string  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::createResource() Creates a new resource.

delete

Serves DELETE requests.
The method receives a ezcWebdavDeleteRequest objects containing all relevant information obout the clients request and will return an instance of ezcWebdavErrorResponse on error or ezcWebdavDeleteResponse on success.

Parameters

Name Type Description
$request ezcWebdavDeleteRequest  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::delete() Serves DELETE requests.

fetchAllProperties

Returns all available properties for a resource.
Fetches all available properties assigned to the reosource referenced in $request and, if the resource is a collection, also returns properties for its children, depending on the depth header of the $request. The instances of ezcWebdavPropFindResponse generated by this method are encapsulated in a ezcWebdavMultistatusResponse object.

Parameters

Name Type Description
$request ezcWebdavPropFindRequest  

fetchProperties

ezcWebdavResponse fetchProperties( ezcWebdavPropFindRequest $request )
Returns properties, fetched by name.
Fetch properties as defined by the passed $request for the resource referenced. Properties are fetched by their names.
This method checks also for each of the nodes affected by the request if authorization suceeds.

Parameters

Name Type Description
$request ezcWebdavPropFindRequest  

fetchPropertyNames

ezcWebdavResponse fetchPropertyNames( ezcWebdavPropFindRequest $request )
Returns names of all available properties for a resource.
Fetches the names of all properties assigned to the reosource referenced in $request and, if the resozurce is a collection, also returns property names for its children, depending on the depth header of the $request.

Parameters

Name Type Description
$request ezcWebdavPropFindRequest  

get

Serves GET requests.
The method receives a ezcWebdavGetRequest object containing all relevant information obout the clients request and will return an ezcWebdavErrorResponse instance on error or an instance of ezcWebdavGetResourceResponse or ezcWebdavGetCollectionResponse on success, depending on the type of resource that is referenced by the request.

Parameters

Name Type Description
$request ezcWebdavGetRequest  

Redefinition of

Method Description
ezcWebdavBackend::get() Serves GET requests.

Redefined in descendants as

Method Description
ezcWebdavFileBackend::get() Serves GET requests.

getAllProperties

ezcWebdavPropertyStorage getAllProperties( string $path )
Returns all properties for a resource.
Returns all properties for the resource identified by $path as a ezcWebdavBasicPropertyStorage.

Parameters

Name Type Description
$path string  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::getAllProperties() Returns all properties for a resource.

getCollectionMembers

array(ezcWebdavResource|ezcWebdavCollection) getCollectionMembers( string $path )
Returns members of collection.
Returns an array with the members of the collection identified by $path. The returned array can contain ezcWebdavCollection, and ezcWebdavResource instances and might also be empty, if the collection has no members.

Parameters

Name Type Description
$path string  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::getCollectionMembers() Returns members of collection.

getETag

void getETag( mixed $path )
Returns the etag representing the current state of $path.
Calculates and returns the ETag for the resource represented by $path. The ETag is calculated from the $path itself and the following properties, which are concatenated and md5 hashed:
  • getcontentlength
  • getlastmodified
This method can be overwritten in custom backend implementations to access the information needed directly without using the way around properties.
Custom backend implementations are encouraged to use the same mechanism (or this method itself) to determine and generate ETags.

Parameters

Name Type Description
$path mixed  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::getETag() Returns the etag representing the current state of $path.

getFeatures

int getFeatures( )
Returns additional features supported by the backend.
Returns a bitmap of additional features supported by the backend, referenced by constants from the basic ezcWebdavBackend class.

Redefinition of

Method Description
ezcWebdavBackend::getFeatures() Returns additional features supported by the backend.

getNodes

array(ezcWebdavResource|ezcWebdavCollection) getNodes( string $source, int $depth )
Returns all child nodes.
Get all nodes from the resource identified by $source up to the given depth. Reuses the method getCollectionMembers(), but you may want to overwrite this implementation by somethings which fits better with your backend.

Parameters

Name Type Description
$source string  
$depth int  

getProperty

ezcWebdavProperty getProperty( string $path, string $propertyName, [string $namespace = 'DAV:'] )
Returns a property of a resource.
Returns the property with the given $propertyName, from the resource identified by $path. You may optionally define a $namespace to receive the property from.

Parameters

Name Type Description
$path string  
$propertyName string  
$namespace string  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::getProperty() Returns a property of a resource.

getResourceContents

string getResourceContents( string $path )
Returns the content of a resource.
Returns the content of the resource identified by $path.

Parameters

Name Type Description
$path string  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::getResourceContents() Returns the contents of a resource.

head

Serves HEAD requests.
The method receives a ezcWebdavHeadRequest object containing all relevant information obout the clients request and will return an ezcWebdavErrorResponse instance on error or an instance of ezcWebdavHeadResponse on success.

Parameters

Name Type Description
$request ezcWebdavHeadRequest  

Redefinition of

Method Description
ezcWebdavBackend::head() Serves HEAD requests.

Redefined in descendants as

Method Description
ezcWebdavFileBackend::head() Serves HEAD requests.

isCollection

bool isCollection( string $path )
Returns if resource is a collection.
Returns if the resource identified by $path is a collection resource (true) or a non-collection one (false).

Parameters

Name Type Description
$path string  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::isCollection() Returns if resource is a collection.

makeCollection

Serves MKCOL (make collection) requests.
The method receives a ezcWebdavMakeCollectionRequest objects containing all relevant information obout the clients request and will return an instance of ezcWebdavErrorResponse on error or ezcWebdavMakeCollectionResponse on success.

Parameters

Name Type Description
$request ezcWebdavMakeCollectionRequest  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::makeCollection() Serves MKCOL (make collection) requests.

move

Serves MOVE requests.
The method receives a ezcWebdavMoveRequest objects containing all relevant information obout the clients request and will return an instance of ezcWebdavErrorResponse on error or ezcWebdavMoveResponse on success. If only some operations failed, this method may return an instance of ezcWebdavMultistatusResponse.

Parameters

Name Type Description
$request ezcWebdavMoveRequest  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::move() Serves MOVE requests.

nodeExists

bool nodeExists( string $path )
Returns if a resource exists.
Returns if a the resource identified by $path exists.

Parameters

Name Type Description
$path string  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::nodeExists() Returns if a resource exists.

options

Handles the OPTIONS request.
Applies authorization checking to the OPTIONS request and returns the parent response.

Parameters

Name Type Description
$request ezcWebdavOptionsRequest  

Redefinition of

Method Description
ezcWebdavBackend::options() Required method to serve OPTIONS requests.

performCopy

array(ezcWebdavErrorResponse) performCopy( string $fromPath, string $toPath, [int $depth = ezcWebdavRequest::DEPTH_INFINITY] )
Copies resources recursively from one path to another.
Copies the resourced identified by $fromPath recursively to $toPath with the given $depth, where $depth is one of ezcWebdavRequest::DEPTH_ZERO, ezcWebdavRequest::DEPTH_ONE, ezcWebdavRequest::DEPTH_INFINITY.
Returns an array with ezcWebdavErrorResponses for all subtrees, where the copy operation failed. Errors for subsequent resources in a subtree should be ommitted.
If an empty array is return, the operation has been completed successfully.

Parameters

Name Type Description
$fromPath string  
$toPath string  
$depth int  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::performCopy() Copies resources recursively from one path to another.

performDelete

ezcWebdavMultitstatusResponse|null performDelete( string $path )
Deletes everything below a path.
Deletes the resource identified by $path recursively. Returns an instance of ezcWebdavMultistatusResponse if the deletion failed, and null on success.

Parameters

Name Type Description
$path string  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::performDelete() Deletes everything below a path.

propFind

Serves PROPFIND requests.
The method receives a ezcWebdavPropFindRequest object containing all relevant information obout the clients request and will either return an instance of ezcWebdavErrorResponse to indicate an error or a ezcWebdavPropFindResponse on success. If the referenced resource is a collection or if some properties produced errors, an instance of ezcWebdavMultistatusResponse may be returned.
The ezcWebdavPropFindRequest object contains a definition to find one or more properties of a given collection or non-collection resource.

Parameters

Name Type Description
$request ezcWebdavPropFindRequest  

Redefinition of

Method Description
ezcWebdavBackend::propFind() Serves PROPFIND requests.

Redefined in descendants as

Method Description
ezcWebdavFileBackend::propFind() Serves PROPFIND requests.

propPatch

Serves PROPPATCH requests.
The method receives a ezcWebdavPropPatchRequest object containing all relevant information obout the clients request and will return an instance of ezcWebdavErrorResponse on error or a ezcWebdavPropPatchResponse response on success. If the referenced resource is a collection or if only some properties produced errors, an instance of ezcWebdavMultistatusResponse may be returned.

Parameters

Name Type Description
$request ezcWebdavPropPatchRequest  

Redefinition of

Method Description
ezcWebdavBackend::propPatch() Serves PROPPATCH requests.

Redefined in descendants as

Method Description
ezcWebdavFileBackend::propPatch() Serves PROPPATCH requests.

put

Serves PUT requests.
The method receives a ezcWebdavPutRequest objects containing all relevant information obout the clients request and will return an instance of ezcWebdavErrorResponse on error or ezcWebdavPutResponse on success.

Parameters

Name Type Description
$request ezcWebdavPutRequest  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::put() Serves PUT requests.

removeProperty

bool removeProperty( string $path, ezcWebdavProperty $property )
Manually removes a property from a resource.
Removes the given $property form the resource identified by $path.

Parameters

Name Type Description
$path string  
$property ezcWebdavProperty  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::removeProperty() Manually removes a property from a resource.

resetProperties

bool resetProperties( string $path, ezcWebdavPropertyStorage $properties )
Resets the property storage for a resource.
Discardes the current ezcWebdavPropertyStorage of the resource identified by $path and replaces it with the given $properties.

Parameters

Name Type Description
$path string  
$properties ezcWebdavPropertyStorage  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::resetProperties() Resets the property storage for a resource.

setProperty

bool setProperty( string $path, ezcWebdavProperty $property )
Manually sets a property on a resource.
Sets the given $propertyBackup for the resource identified by $path.

Parameters

Name Type Description
$path string  
$property ezcWebdavProperty  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::setProperty() Manually sets a property on a resource.

setResourceContents

void setResourceContents( string $path, string $content )
Changes contents of a resource.
This method is used to change the contents of the resource identified by $path to the given $content.

Parameters

Name Type Description
$path string  
$content string  

Redefined in descendants as

Method Description
ezcWebdavFileBackend::setResourceContents() Sets the contents of a resource.

Last updated: Mon, 21 Dec 2009