org.opencrx.application.uses.net.sf.webdav
Interface WebDavStore

All Known Implementing Classes:
CalDavStore, CardDavStore, WebDavStore

public interface WebDavStore

Interface for simple implementation of any store for the WebdavServlet

based on the BasicWebdavStore from Oliver Zeigermann, that was part of the Webdav Construction Kit from slide


Nested Class Summary
static class WebDavStore.MoveResourceStatus
           
static class WebDavStore.PutResourceStatus
          Sets / stores the content of the resource specified by resourceUri.
 
Method Summary
 RequestContext begin(HttpServletRequest req, HttpServletResponse resp)
          Indicates that a new request or transaction with this store involved has been started.
 void commit(RequestContext requestContext)
          Indicates that all changes done inside this request shall be made permanent and any transactions, connections and other temporary resources shall be terminated.
 void createCollection(RequestContext requestContext, String path)
          Creates a folder at the position specified by folderUri.
 Collection<Resource> getChildren(RequestContext requestContext, Resource res)
          Gets the names of the children of the folder specified by folderUri.
 List<Lock> getLocksByPath(RequestContext requestContext, String path)
          Gets the LockedObject on specified path.
 String getMimeType(Resource so)
          Gets mime type of stored object.
 Resource getResourceByPath(RequestContext requestContext, String path)
          Gets the storedObject specified by uri
 BinaryLargeObject getResourceContent(RequestContext requestContext, Resource res)
          Gets the content of the resource specified by resourceUri.
 Lock lock(RequestContext requestContext, String path, String owner, String scope, String type, int depth, int timeout)
          Tries to lock the resource at "path".
 WebDavStore.MoveResourceStatus moveResource(RequestContext requestContext, Resource res, String sourcePath, String destinationPath)
          Moves the resource from sourcePath to destinationPath
 WebDavStore.PutResourceStatus putResource(RequestContext transaction, String path, InputStream content, String contentType)
           
 void removeResource(RequestContext requestContext, Resource res)
          Removes the object specified by uri.
 void rollback(RequestContext requestContext)
          Indicates that all changes done inside this request shall be undone and any transactions, connections and other temporary resources shall be terminated.
 void setLockTimeout(RequestContext requestContext, String id, int timeout)
          Set timeout for specified lock.
 boolean unlock(RequestContext requestContext, String id)
          Unlocks all resources at "path" (and all subfolders if existing)

that have the same owner.

 

Method Detail

begin

RequestContext begin(HttpServletRequest req,
                     HttpServletResponse resp)
Indicates that a new request or transaction with this store involved has been started. The request will be terminated by either commit(RequestContext transaction) or rollback(RequestContext transaction). If only non-read methods have been called, the request will be terminated by a commit(RequestContext transaction). This method will be called by (@link WebdavStoreAdapter} at the beginning of each request.

Parameters:
principal - the principal that started this request or null if there is non available
Throws:
WebdavException

commit

void commit(RequestContext requestContext)
Indicates that all changes done inside this request shall be made permanent and any transactions, connections and other temporary resources shall be terminated.

Parameters:
requestContext - indicates that the method is within the scope of a WebDAV transaction
Throws:
WebdavException - if something goes wrong on the store level

rollback

void rollback(RequestContext requestContext)
Indicates that all changes done inside this request shall be undone and any transactions, connections and other temporary resources shall be terminated.

Parameters:
requestContext - indicates that the method is within the scope of a WebDAV transaction
Throws:
WebdavException - if something goes wrong on the store level

createCollection

void createCollection(RequestContext requestContext,
                      String path)
Creates a folder at the position specified by folderUri.

Parameters:
requestContext - indicates that the method is within the scope of a WebDAV transaction
path - URI of the folder
Throws:
WebdavException - if something goes wrong on the store level

getResourceContent

BinaryLargeObject getResourceContent(RequestContext requestContext,
                                     Resource res)
Gets the content of the resource specified by resourceUri.

Parameters:
requestContext - indicates that the method is within the scope of a WebDAV transaction
so - content of the resource
Returns:
input stream you can read the content of the resource from
Throws:
WebdavException - if something goes wrong on the store level

putResource

WebDavStore.PutResourceStatus putResource(RequestContext transaction,
                                          String path,
                                          InputStream content,
                                          String contentType)

getChildren

Collection<Resource> getChildren(RequestContext requestContext,
                                 Resource res)
Gets the names of the children of the folder specified by folderUri.

Parameters:
requestContext - indicates that the method is within the scope of a WebDAV transaction
path - URI of the collection
Returns:
a (possibly empty) list of children
Throws:
WebdavException - if something goes wrong on the store level

removeResource

void removeResource(RequestContext requestContext,
                    Resource res)
Removes the object specified by uri.

Parameters:
requestContext - indicates that the method is within the scope of a WebDAV transaction
path - URI of the object, i.e. content resource or folder
Throws:
WebdavException - if something goes wrong on the store level

moveResource

WebDavStore.MoveResourceStatus moveResource(RequestContext requestContext,
                                            Resource res,
                                            String sourcePath,
                                            String destinationPath)
Moves the resource from sourcePath to destinationPath

Parameters:
requestContext -
res -
sourcePath -
destinationPath -

getResourceByPath

Resource getResourceByPath(RequestContext requestContext,
                           String path)
Gets the storedObject specified by uri

Parameters:
requestContext - indicates that the method is within the scope of a WebDAV transaction
path - URI
Returns:
StoredObject

getMimeType

String getMimeType(Resource so)
Gets mime type of stored object.


lock

Lock lock(RequestContext requestContext,
          String path,
          String owner,
          String scope,
          String type,
          int depth,
          int timeout)
          throws LockFailedException
Tries to lock the resource at "path".

Parameters:
requestContext -
path - what resource to lock
owner - the owner of the lock
exclusive - if the lock should be exclusive (or shared)
depth - depth
timeout - Lock Duration in seconds.
Returns:
true if the resource at path was successfully locked, false if an existing lock prevented this
Throws:
LockFailedException

unlock

boolean unlock(RequestContext requestContext,
               String id)
Unlocks all resources at "path" (and all subfolders if existing)

that have the same owner.

Parameters:
requestContext -
id - id to the resource to unlock

setLockTimeout

void setLockTimeout(RequestContext requestContext,
                    String id,
                    int timeout)
Set timeout for specified lock.

Parameters:
requestContext -
id -
timeout -

getLocksByPath

List<Lock> getLocksByPath(RequestContext requestContext,
                          String path)
Gets the LockedObject on specified path.

Parameters:
requestContext -
path - Path to requested resource
Returns:
LockedObject or null if no LockedObject on specified path exists


This software is published under the BSD license. Copyright © 2003-2012, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.