com.trackstudio.app.webdav
Interface IWebdavStorage

All Known Implementing Classes:
TSStorage

public interface IWebdavStorage

Interface for simple implementation of any store for the WebdavServlet

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


Method Summary
 void begin(java.security.Principal principal, java.util.Hashtable parameters, SessionContext sc)
          Indicates that a new request or transaction with this store involved has been started.
 void checkAuthentication(SessionContext sc)
          Checks if authentication information passed in begin(Principal, Hashtable, SessionContext) is valid.
 void commit()
          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(java.lang.String folderUri, SessionContext sc)
          Creates a folder at the position specified by folderUri.
 void createResource(java.lang.String resourceUri, SessionContext sc)
          Creates a content resource at the position specified by resourceUri.
 java.lang.String[] getChildrenNames(java.lang.String folderUri, SessionContext sc)
          Gets the names of the children of the folder specified by folderUri.
 java.util.Date getCreationDate(java.lang.String uri, SessionContext sc)
          Gets the date of the creation of the object specified by uri.
 java.util.Date getLastModified(java.lang.String uri, SessionContext sc)
          Gets the date of the last modiciation of the object specified by uri.
 java.io.InputStream getResourceContent(java.lang.String resourceUri, SessionContext sc)
          Gets the content of the resource specified by resourceUri.
 long getResourceLength(java.lang.String resourceUri, SessionContext sc)
          Gets the length of the content resource specified by resourceUri.
 boolean isFolder(java.lang.String uri, SessionContext sc)
          Checks if there is an object at the position specified by uri and if so if it is a folder.
 boolean isResource(java.lang.String uri, SessionContext sc)
          Checks if there is an object at the position specified by uri and if so if it is a content resource.
 boolean objectExists(java.lang.String uri, SessionContext sc)
          Checks if there is an object at the position specified by uri.
 void removeObject(java.lang.String uri, SessionContext sc)
          Removes the object specified by uri.
 void rollback()
          Indicates that all changes done inside this request shall be undone and any transactions, connections and other temporary resources shall be terminated.
 void setResourceContent(java.lang.String resourceUri, java.io.InputStream content, java.lang.String contentType, java.lang.String characterEncoding, SessionContext sc)
          Sets / stores the content of the resource specified by resourceUri.
 

Method Detail

begin

void begin(java.security.Principal principal,
           java.util.Hashtable parameters,
           SessionContext sc)
           throws java.lang.Exception
Indicates that a new request or transaction with this store involved has been started. The request will be terminated by either commit() or rollback(). If only non-read methods have been called, the request will be terminated by a commit(). 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
parameters - Hashtable containing the parameters' names and associated values configured in the from web.xml
Throws:
java.lang.Exception

checkAuthentication

void checkAuthentication(SessionContext sc)
                         throws java.lang.SecurityException
Checks if authentication information passed in begin(Principal, Hashtable, SessionContext) is valid. If not throws an exception.

Throws:
java.lang.SecurityException - if authentication is not valid

commit

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

Throws:
java.io.IOException - if something goes wrong on the store level

rollback

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

Throws:
java.io.IOException - if something goes wrong on the store level

objectExists

boolean objectExists(java.lang.String uri,
                     SessionContext sc)
                     throws java.io.IOException,
                            GranException
Checks if there is an object at the position specified by uri.

Parameters:
uri - URI of the object to check
Returns:
true if the object at uri exists
Throws:
java.io.IOException - if something goes wrong on the store level
GranException

isFolder

boolean isFolder(java.lang.String uri,
                 SessionContext sc)
                 throws java.io.IOException,
                        GranException
Checks if there is an object at the position specified by uri and if so if it is a folder.

Parameters:
uri - URI of the object to check
Returns:
true if the object at uri exists and is a folder
Throws:
java.io.IOException - if something goes wrong on the store level
GranException

isResource

boolean isResource(java.lang.String uri,
                   SessionContext sc)
                   throws java.io.IOException,
                          GranException
Checks if there is an object at the position specified by uri and if so if it is a content resource.

Parameters:
uri - URI of the object to check
Returns:
true if the object at uri exists and is a content resource
Throws:
java.io.IOException - if something goes wrong on the store level
GranException

createFolder

void createFolder(java.lang.String folderUri,
                  SessionContext sc)
                  throws java.io.IOException
Creates a folder at the position specified by folderUri.

Parameters:
folderUri - URI of the folder
Throws:
java.io.IOException - if something goes wrong on the store level

createResource

void createResource(java.lang.String resourceUri,
                    SessionContext sc)
                    throws java.io.IOException,
                           GranException
Creates a content resource at the position specified by resourceUri.

Parameters:
resourceUri - URI of the content resource
Throws:
java.io.IOException - if something goes wrong on the store level
GranException

setResourceContent

void setResourceContent(java.lang.String resourceUri,
                        java.io.InputStream content,
                        java.lang.String contentType,
                        java.lang.String characterEncoding,
                        SessionContext sc)
                        throws java.io.IOException,
                               GranException
Sets / stores the content of the resource specified by resourceUri.

Parameters:
resourceUri - URI of the resource where the content will be stored
content - input stream from which the content will be read from
contentType - content type of the resource or null if unknown
characterEncoding - character encoding of the resource or null if unknown or not applicable
Throws:
java.io.IOException - if something goes wrong on the store level
GranException

getLastModified

java.util.Date getLastModified(java.lang.String uri,
                               SessionContext sc)
                               throws java.io.IOException,
                                      GranException
Gets the date of the last modiciation of the object specified by uri.

Parameters:
uri - URI of the object, i.e. content resource or folder
Returns:
date of last modification, null declares this value as invalid and asks the adapter to try to set it from the properties if possible
Throws:
java.io.IOException - if something goes wrong on the store level
GranException

getCreationDate

java.util.Date getCreationDate(java.lang.String uri,
                               SessionContext sc)
                               throws java.io.IOException,
                                      GranException
Gets the date of the creation of the object specified by uri.

Parameters:
uri - URI of the object, i.e. content resource or folder
Returns:
date of creation, null declares this value as invalid and asks the adapter to try to set it from the properties if possible
Throws:
java.io.IOException - if something goes wrong on the store level
GranException

getChildrenNames

java.lang.String[] getChildrenNames(java.lang.String folderUri,
                                    SessionContext sc)
                                    throws java.io.IOException,
                                           GranException
Gets the names of the children of the folder specified by folderUri.

Parameters:
folderUri - URI of the folder
Returns:
array containing names of the children or null if it is no folder
Throws:
java.io.IOException - if something goes wrong on the store level
GranException

getResourceContent

java.io.InputStream getResourceContent(java.lang.String resourceUri,
                                       SessionContext sc)
                                       throws java.io.IOException,
                                              GranException
Gets the content of the resource specified by resourceUri.

Parameters:
resourceUri - URI of the content resource
Returns:
input stream you can read the content of the resource from
Throws:
java.io.IOException - if something goes wrong on the store level
GranException

getResourceLength

long getResourceLength(java.lang.String resourceUri,
                       SessionContext sc)
                       throws java.io.IOException,
                              GranException
Gets the length of the content resource specified by resourceUri.

Parameters:
resourceUri - 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:
java.io.IOException - if something goes wrong on the store level
GranException

removeObject

void removeObject(java.lang.String uri,
                  SessionContext sc)
                  throws java.io.IOException,
                         GranException
Removes the object specified by uri.

Parameters:
uri - URI of the object, i.e. content resource or folder
Throws:
java.io.IOException - if something goes wrong on the store level
GranException


Copyright © 2002-2009 TrackStudio, Ltd. All Rights Reserved.