public class CardDavStore extends java.lang.Object implements WebDavStore
WebDavStore.ResourceContent, WebDavStore.Status
Modifier and Type | Field and Description |
---|---|
protected javax.jdo.PersistenceManagerFactory |
pmf |
protected java.util.Map<java.lang.String,java.lang.String> |
uidMapping |
Constructor and Description |
---|
CardDavStore(javax.jdo.PersistenceManagerFactory pmf)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
RequestContext |
begin(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.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,
java.lang.String path)
Creates a folder at the position specified by
folderUri . |
java.util.Collection<Resource> |
getChildren(RequestContext requestContext,
Resource res,
java.util.Date timeRangeStart,
java.util.Date timeRangeEnd)
Gets the names of the children of the folder specified by
folderUri . |
java.util.List<Lock> |
getLocksByPath(RequestContext requestContext,
java.lang.String path)
Gets the LockedObject on specified path.
|
java.lang.String |
getMimeType(Resource res)
Gets mime type of stored object.
|
protected java.lang.String |
getParentPath(java.lang.String path)
Get parent of given path.
|
static javax.jdo.PersistenceManager |
getPersistenceManager(javax.servlet.http.HttpServletRequest req,
javax.jdo.PersistenceManagerFactory pmf)
Get persistence manager for this store.
|
Resource |
getResourceByPath(RequestContext requestContext,
java.lang.String path)
Path is of the form:
- Format 1: {provider.id} "/" {segment.id} "/" ["user" "/"] {user.id} "/" ["profile" "/"] {profile.id} "/" {feed.id} "/" {account.id}
|
WebDavStore.ResourceContent |
getResourceContent(RequestContext requestContext,
Resource res) |
Lock |
lock(RequestContext requestContext,
java.lang.String path,
java.lang.String id,
java.lang.String owner,
java.lang.String scope,
java.lang.String type,
int depth,
int timeout)
Tries to lock the resource at "path".
|
WebDavStore.Status |
moveResource(RequestContext requestContext,
Resource res,
java.lang.String sourcePath,
java.lang.String destinationPath)
Moves the resource from sourcePath to destinationPath
|
WebDavStore.Status |
putResource(RequestContext requestContext,
java.lang.String path,
java.io.InputStream content,
java.lang.String contentType) |
WebDavStore.Status |
removeResource(RequestContext requestContext,
java.lang.String path,
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.
|
boolean |
unlock(RequestContext requestContext,
java.lang.String path,
java.lang.String id)
Unlocks all resources at "path" (and all subfolders if existing) that
have the same owner.
|
protected javax.jdo.PersistenceManagerFactory pmf
protected final java.util.Map<java.lang.String,java.lang.String> uidMapping
public CardDavStore(javax.jdo.PersistenceManagerFactory pmf)
pmf
- public static javax.jdo.PersistenceManager getPersistenceManager(javax.servlet.http.HttpServletRequest req, javax.jdo.PersistenceManagerFactory pmf)
req
- pmf
- public RequestContext begin(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
WebDavStore
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.begin
in interface WebDavStore
public void commit(RequestContext requestContext)
WebDavStore
commit
in interface WebDavStore
requestContext
- indicates that the method is within the scope of a WebDAV
transactionpublic void createCollection(RequestContext requestContext, java.lang.String path)
WebDavStore
folderUri
.createCollection
in interface WebDavStore
requestContext
- indicates that the method is within the scope of a WebDAV
transactionpath
- URI of the folderpublic java.util.Collection<Resource> getChildren(RequestContext requestContext, Resource res, java.util.Date timeRangeStart, java.util.Date timeRangeEnd)
WebDavStore
folderUri
.getChildren
in interface WebDavStore
requestContext
- indicates that the method is within the scope of a WebDAV
transactiontimeRangeStart
- include children starting fromtimeRangeEnd
- include children end atpublic WebDavStore.ResourceContent getResourceContent(RequestContext requestContext, Resource res)
getResourceContent
in interface WebDavStore
public Resource getResourceByPath(RequestContext requestContext, java.lang.String path)
getResourceByPath
in interface WebDavStore
requestContext
- indicates that the method is within the scope of a WebDAV
transactionpath
- URIpublic WebDavStore.Status removeResource(RequestContext requestContext, java.lang.String path, Resource res)
WebDavStore
uri
.removeResource
in interface WebDavStore
requestContext
- indicates that the method is within the scope of a WebDAV
transactionpath
- URI of the object, i.e. content resource or folderpublic WebDavStore.Status moveResource(RequestContext requestContext, Resource res, java.lang.String sourcePath, java.lang.String destinationPath)
WebDavStore
moveResource
in interface WebDavStore
public void rollback(RequestContext requestContext)
WebDavStore
rollback
in interface WebDavStore
requestContext
- indicates that the method is within the scope of a WebDAV
transactionpublic java.lang.String getMimeType(Resource res)
WebDavStore
getMimeType
in interface WebDavStore
protected java.lang.String getParentPath(java.lang.String path)
path
- public WebDavStore.Status putResource(RequestContext requestContext, java.lang.String path, java.io.InputStream content, java.lang.String contentType)
putResource
in interface WebDavStore
public java.util.List<Lock> getLocksByPath(RequestContext requestContext, java.lang.String path)
WebDavStore
getLocksByPath
in interface WebDavStore
path
- Path to requested resourcepublic Lock lock(RequestContext requestContext, java.lang.String path, java.lang.String id, java.lang.String owner, java.lang.String scope, java.lang.String type, int depth, int timeout) throws LockFailedException
WebDavStore
lock
in interface WebDavStore
path
- what resource to lockowner
- the owner of the lockdepth
- depthtimeout
- Lock Duration in seconds.LockFailedException
public boolean unlock(RequestContext requestContext, java.lang.String path, java.lang.String id)
WebDavStore
unlock
in interface WebDavStore
id
- id to the resource to unlockThis software is published under the BSD license. Copyright © 2003-${build.year}, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.