Package org.drjekyll.webdav.store
Interface WebdavStore
-
- All Known Implementing Classes:
LocalFileSystemStore
public interface WebdavStore
Interface for simple implementation of any store for the WebdavServletbased on the BasicWebdavStore from Oliver Zeigermann, that was part of the Webdav Construcktion Kit from slide
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Transaction
begin(Principal principal)
Indicates that a new request or transaction with this store involved has been started.void
checkAuthentication(Transaction transaction)
Checks if authentication information passed in is valid.void
commit(Transaction transaction)
Indicates that all changes done inside this request shall be made permanent and any transactions, connections and other temporary resources shall be terminated.void
createFolder(Transaction transaction, String folderUri)
Creates a folder at the position specified byfolderUri
.void
createResource(Transaction transaction, String resourceUri)
Creates a content resource at the position specified byresourceUri
.void
destroy()
Life cycle method, called by WebdavServlet's destroy() method.String[]
getChildrenNames(Transaction transaction, String folderUri)
Gets the names of the children of the folder specified byfolderUri
.InputStream
getResourceContent(Transaction transaction, String resourceUri)
Gets the content of the resource specified byresourceUri
.long
getResourceLength(Transaction transaction, String path)
Gets the length of the content resource specified byresourceUri
.StoredObject
getStoredObject(Transaction transaction, String uri)
Gets the storedObject specified byuri
void
removeObject(Transaction transaction, String uri)
Removes the object specified byuri
.void
rollback(Transaction transaction)
Indicates that all changes done inside this request shall be undone and any transactions, connections and other temporary resources shall be terminated.long
setResourceContent(Transaction transaction, String resourceUri, InputStream content, String contentType, String characterEncoding)
Sets / stores the content of the resource specified byresourceUri
.
-
-
-
Method Detail
-
destroy
void destroy()
Life cycle method, called by WebdavServlet's destroy() method. Should be used to clean up resources.
-
begin
Transaction begin(Principal principal)
Indicates that a new request or transaction with this store involved has been started. The request will be terminated by eithercommit(org.drjekyll.webdav.Transaction)
orrollback(org.drjekyll.webdav.Transaction)
. If only non-read methods have been called, the request will be terminated by acommit(org.drjekyll.webdav.Transaction)
. This method will be called by (@link WebdavStoreAdapter} at the beginning of each request.- Parameters:
principal
- the principal that started this request ornull
if there is non available- Throws:
WebdavException
-
checkAuthentication
void checkAuthentication(Transaction transaction)
Checks if authentication information passed in is valid. If not throws an exception.- Parameters:
transaction
- indicates that the method is within the scope of a WebDAV transaction
-
commit
void commit(Transaction transaction)
Indicates that all changes done inside this request shall be made permanent and any transactions, connections and other temporary resources shall be terminated.- Parameters:
transaction
- 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(Transaction transaction)
Indicates that all changes done inside this request shall be undone and any transactions, connections and other temporary resources shall be terminated.- Parameters:
transaction
- indicates that the method is within the scope of a WebDAV transaction- Throws:
WebdavException
- if something goes wrong on the store level
-
createFolder
void createFolder(Transaction transaction, String folderUri)
Creates a folder at the position specified byfolderUri
.- Parameters:
transaction
- indicates that the method is within the scope of a WebDAV transactionfolderUri
- URI of the folder- Throws:
WebdavException
- if something goes wrong on the store level
-
createResource
void createResource(Transaction transaction, String resourceUri)
Creates a content resource at the position specified byresourceUri
.- Parameters:
transaction
- indicates that the method is within the scope of a WebDAV transactionresourceUri
- URI of the content resource- Throws:
WebdavException
- if something goes wrong on the store level
-
getResourceContent
InputStream getResourceContent(Transaction transaction, String resourceUri)
Gets the content of the resource specified byresourceUri
.- Parameters:
transaction
- indicates that the method is within the scope of a WebDAV transactionresourceUri
- URI of the content resource- Returns:
- input stream you can read the content of the resource from
- Throws:
WebdavException
- if something goes wrong on the store level
-
setResourceContent
long setResourceContent(Transaction transaction, String resourceUri, InputStream content, String contentType, String characterEncoding)
Sets / stores the content of the resource specified byresourceUri
.- Parameters:
transaction
- indicates that the method is within the scope of a WebDAV transactionresourceUri
- URI of the resource where the content will be storedcontent
- input stream from which the content will be read fromcontentType
- content type of the resource ornull
if unknowncharacterEncoding
- character encoding of the resource ornull
if unknown or not applicable- Returns:
- lenght of resource
- Throws:
WebdavException
- if something goes wrong on the store level
-
getChildrenNames
String[] getChildrenNames(Transaction transaction, String folderUri)
Gets the names of the children of the folder specified byfolderUri
.- Parameters:
transaction
- indicates that the method is within the scope of a WebDAV transactionfolderUri
- URI of the folder- Returns:
- a (possibly empty) list of children, or
null
if the uri points to a file - Throws:
WebdavException
- if something goes wrong on the store level
-
getResourceLength
long getResourceLength(Transaction transaction, String path)
Gets the length of the content resource specified byresourceUri
.- Parameters:
transaction
- indicates that the method is within the scope of a WebDAV transactionpath
- URI of the content resource- Returns:
- length of the resource in bytes,
-1
declares this value as invalid and asks the adapter to try to set it from the properties if possible - Throws:
WebdavException
- if something goes wrong on the store level
-
removeObject
void removeObject(Transaction transaction, String uri)
Removes the object specified byuri
.- Parameters:
transaction
- indicates that the method is within the scope of a WebDAV transactionuri
- URI of the object, i.e. content resource or folder- Throws:
WebdavException
- if something goes wrong on the store level
-
getStoredObject
StoredObject getStoredObject(Transaction transaction, String uri)
Gets the storedObject specified byuri
- Parameters:
transaction
- indicates that the method is within the scope of a WebDAV transactionuri
- URI- Returns:
- StoredObject
-
-