org.opencrx.application.caldav
Class CalDavStore

java.lang.Object
  extended by org.opencrx.application.caldav.CalDavStore
All Implemented Interfaces:
WebDavStore

public class CalDavStore
extends Object
implements WebDavStore


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.opencrx.application.uses.net.sf.webdav.WebDavStore
WebDavStore.MoveResourceStatus, WebDavStore.PutResourceStatus
 
Field Summary
protected static Set<String> CALENDAR_TYPES
           
protected  javax.jdo.PersistenceManagerFactory pmf
           
protected  Map<String,String> uidMapping
           
 
Constructor Summary
CalDavStore(javax.jdo.PersistenceManagerFactory pmf)
           
 
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.
static ActivityQueryHelper getActivityQueryHelper(javax.jdo.PersistenceManager pm, String filterId, String isDisabledFilter)
           
 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 res)
          Gets mime type of stored object.
protected  String getParentPath(String path)
           
static javax.jdo.PersistenceManager getPersistenceManager(HttpServletRequest req, javax.jdo.PersistenceManagerFactory pmf)
           
 Resource getResourceByPath(RequestContext requestContext, String path)
          Gets the storedObject specified by uri
protected  Resource getResourceByPath(RequestContext requestContext, String path, boolean allowRunAs)
          Path is of the form: - Format 1: {provider.id} "/" {segment.id} "/user/" {user.id} "/profile/" {profile.name} - Format 2: {provider.id} "/" {segment.id} "/" {user.id} "/" {profile.id} "/" {feed.id} [":VTODO"] "/" {activity.id} - Format 3: {provider.id} "/" {segment.id} ["/user/" {user.id} ] "/" {tracker|milestone|category|home|resource|filter} "/" {calendar.name} ["/filter/" {filter.name}] ["/VTODO"] "/" {activity.id}
 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 requestContext, 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.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CALENDAR_TYPES

protected static final Set<String> CALENDAR_TYPES

pmf

protected javax.jdo.PersistenceManagerFactory pmf

uidMapping

protected final Map<String,String> uidMapping
Constructor Detail

CalDavStore

public CalDavStore(javax.jdo.PersistenceManagerFactory pmf)
Method Detail

getPersistenceManager

public static javax.jdo.PersistenceManager getPersistenceManager(HttpServletRequest req,
                                                                 javax.jdo.PersistenceManagerFactory pmf)

getActivityQueryHelper

public static ActivityQueryHelper getActivityQueryHelper(javax.jdo.PersistenceManager pm,
                                                         String filterId,
                                                         String isDisabledFilter)

getResourceByPath

protected Resource getResourceByPath(RequestContext requestContext,
                                     String path,
                                     boolean allowRunAs)
Path is of the form: - Format 1: {provider.id} "/" {segment.id} "/user/" {user.id} "/profile/" {profile.name} - Format 2: {provider.id} "/" {segment.id} "/" {user.id} "/" {profile.id} "/" {feed.id} [":VTODO"] "/" {activity.id} - Format 3: {provider.id} "/" {segment.id} ["/user/" {user.id} ] "/" {tracker|milestone|category|home|resource|filter} "/" {calendar.name} ["/filter/" {filter.name}] ["/VTODO"] "/" {activity.id}


begin

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

Specified by:
begin in interface WebDavStore

commit

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

Specified by:
commit in interface WebDavStore
Parameters:
requestContext - indicates that the method is within the scope of a WebDAV transaction

createCollection

public void createCollection(RequestContext requestContext,
                             String path)
Description copied from interface: WebDavStore
Creates a folder at the position specified by folderUri.

Specified by:
createCollection in interface WebDavStore
Parameters:
requestContext - indicates that the method is within the scope of a WebDAV transaction
path - URI of the folder

getChildren

public Collection<Resource> getChildren(RequestContext requestContext,
                                        Resource res)
Description copied from interface: WebDavStore
Gets the names of the children of the folder specified by folderUri.

Specified by:
getChildren in interface WebDavStore
Parameters:
requestContext - indicates that the method is within the scope of a WebDAV transaction
Returns:
a (possibly empty) list of children

getResourceContent

public BinaryLargeObject getResourceContent(RequestContext requestContext,
                                            Resource res)
Description copied from interface: WebDavStore
Gets the content of the resource specified by resourceUri.

Specified by:
getResourceContent in interface WebDavStore
Parameters:
requestContext - indicates that the method is within the scope of a WebDAV transaction
Returns:
input stream you can read the content of the resource from

getResourceByPath

public Resource getResourceByPath(RequestContext requestContext,
                                  String path)
Description copied from interface: WebDavStore
Gets the storedObject specified by uri

Specified by:
getResourceByPath in interface WebDavStore
Parameters:
requestContext - indicates that the method is within the scope of a WebDAV transaction
path - URI
Returns:
StoredObject

removeResource

public void removeResource(RequestContext requestContext,
                           Resource res)
Description copied from interface: WebDavStore
Removes the object specified by uri.

Specified by:
removeResource in interface WebDavStore
Parameters:
requestContext - indicates that the method is within the scope of a WebDAV transaction

moveResource

public WebDavStore.MoveResourceStatus moveResource(RequestContext requestContext,
                                                   Resource res,
                                                   String sourcePath,
                                                   String destinationPath)
Description copied from interface: WebDavStore
Moves the resource from sourcePath to destinationPath

Specified by:
moveResource in interface WebDavStore

rollback

public void rollback(RequestContext requestContext)
Description copied from interface: WebDavStore
Indicates that all changes done inside this request shall be undone and any transactions, connections and other temporary resources shall be terminated.

Specified by:
rollback in interface WebDavStore
Parameters:
requestContext - indicates that the method is within the scope of a WebDAV transaction

getMimeType

public String getMimeType(Resource res)
Description copied from interface: WebDavStore
Gets mime type of stored object.

Specified by:
getMimeType in interface WebDavStore

getParentPath

protected String getParentPath(String path)

putResource

public WebDavStore.PutResourceStatus putResource(RequestContext requestContext,
                                                 String path,
                                                 InputStream content,
                                                 String contentType)
Specified by:
putResource in interface WebDavStore

getLocksByPath

public List<Lock> getLocksByPath(RequestContext requestContext,
                                 String path)
Description copied from interface: WebDavStore
Gets the LockedObject on specified path.

Specified by:
getLocksByPath in interface WebDavStore
path - Path to requested resource
Returns:
LockedObject or null if no LockedObject on specified path exists

lock

public Lock lock(RequestContext requestContext,
                 String path,
                 String owner,
                 String scope,
                 String type,
                 int depth,
                 int timeout)
          throws LockFailedException
Description copied from interface: WebDavStore
Tries to lock the resource at "path".

Specified by:
lock in interface WebDavStore
path - what resource to lock
owner - the owner of the lock
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

setLockTimeout

public void setLockTimeout(RequestContext requestContext,
                           String id,
                           int timeout)
Description copied from interface: WebDavStore
Set timeout for specified lock.

Specified by:
setLockTimeout in interface WebDavStore

unlock

public boolean unlock(RequestContext requestContext,
                      String id)
Description copied from interface: WebDavStore
Unlocks all resources at "path" (and all subfolders if existing)

that have the same owner.

Specified by:
unlock in interface WebDavStore
id - id to the resource to unlock


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