public class LocalFileSystemStore extends Object implements IWebdavStore
Constructor and Description |
---|
LocalFileSystemStore(File root) |
Modifier and Type | Method and Description |
---|---|
ITransaction |
begin(Principal principal)
Indicates that a new request or transaction with this store involved has
been started.
|
void |
checkAuthentication(ITransaction transaction)
Checks if authentication information passed in is valid.
|
void |
commit(ITransaction 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(ITransaction transaction,
String uri)
Creates a folder at the position specified by
folderUri . |
void |
createResource(ITransaction transaction,
String uri)
Creates a content resource at the position specified by
resourceUri . |
void |
destroy()
Life cycle method, called by WebdavServlet's destroy() method.
|
String[] |
getChildrenNames(ITransaction transaction,
String uri)
Gets the names of the children of the folder specified by
folderUri . |
Map<String,String> |
getCustomNamespaces(ITransaction transaction,
String resourceUri)
Returns a map of custom namespaces that are specific to the store.
|
Map<String,Object> |
getCustomProperties(ITransaction transaction,
String resourceUri)
Returns the map of (propertyName, propertyValue) of custom properties of the given resource.
|
InputStream |
getResourceContent(ITransaction transaction,
String uri)
Gets the content of the resource specified by
resourceUri . |
long |
getResourceLength(ITransaction transaction,
String resourceUri)
Gets the length of the content resource specified by
resourceUri . |
StoredObject |
getStoredObject(ITransaction transaction,
String uri)
Gets the storedObject specified by
uri |
void |
removeObject(ITransaction transaction,
String uri)
Removes the object specified by
uri . |
void |
rollback(ITransaction transaction)
Indicates that all changes done inside this request shall be undone and
any transactions, connections and other temporary resources shall be
terminated.
|
Map<String,String> |
setCustomProperties(ITransaction transaction,
String resourceUri,
Map<String,Object> propertiesToSet,
List<String> propertiesToRemove)
Updates the custom properties on the given resource.
|
long |
setResourceContent(ITransaction transaction,
String uri,
InputStream is,
String contentType,
String characterEncoding)
Sets / stores the content of the resource specified by
resourceUri . |
public LocalFileSystemStore(File root)
public void destroy()
IWebdavStore
destroy
in interface IWebdavStore
public ITransaction begin(Principal principal) throws WebdavException
IWebdavStore
IWebdavStore.commit(ITransaction)
or IWebdavStore.rollback(ITransaction)
. If only non-read methods have been called, the
request will be terminated by a IWebdavStore.commit(ITransaction)
. This method will be
called by (@link WebdavStoreAdapter} at the beginning of each request.begin
in interface IWebdavStore
principal
- the principal that started this request or null
if
there is non availabletransaction
WebdavException
public void checkAuthentication(ITransaction transaction) throws SecurityException
IWebdavStore
checkAuthentication
in interface IWebdavStore
transaction
- indicates that the method is within the scope of a WebDAV
transactionSecurityException
public void commit(ITransaction transaction) throws WebdavException
IWebdavStore
commit
in interface IWebdavStore
transaction
- indicates that the method is within the scope of a WebDAV
transactionWebdavException
- if something goes wrong on the store levelpublic void rollback(ITransaction transaction) throws WebdavException
IWebdavStore
rollback
in interface IWebdavStore
transaction
- indicates that the method is within the scope of a WebDAV
transactionWebdavException
- if something goes wrong on the store levelpublic void createFolder(ITransaction transaction, String uri) throws WebdavException
IWebdavStore
folderUri
.createFolder
in interface IWebdavStore
transaction
- indicates that the method is within the scope of a WebDAV
transactionuri
- URI of the folderWebdavException
- if something goes wrong on the store levelpublic void createResource(ITransaction transaction, String uri) throws WebdavException
IWebdavStore
resourceUri
.createResource
in interface IWebdavStore
transaction
- indicates that the method is within the scope of a WebDAV
transactionuri
- URI of the content resourceWebdavException
- if something goes wrong on the store levelpublic long setResourceContent(ITransaction transaction, String uri, InputStream is, String contentType, String characterEncoding) throws WebdavException
IWebdavStore
resourceUri
.setResourceContent
in interface IWebdavStore
transaction
- indicates that the method is within the scope of a WebDAV
transactionuri
- URI of the resource where the content will be storedis
- input stream from which the content will be read fromcontentType
- content type of the resource or null
if unknowncharacterEncoding
- character encoding of the resource or null
if unknown
or not applicableWebdavException
- if something goes wrong on the store levelpublic String[] getChildrenNames(ITransaction transaction, String uri) throws WebdavException
IWebdavStore
folderUri
.getChildrenNames
in interface IWebdavStore
transaction
- indicates that the method is within the scope of a WebDAV
transactionuri
- URI of the foldernull
if the
uri points to a fileWebdavException
- if something goes wrong on the store levelpublic void removeObject(ITransaction transaction, String uri) throws WebdavException
IWebdavStore
uri
.removeObject
in interface IWebdavStore
transaction
- indicates that the method is within the scope of a WebDAV
transactionuri
- URI of the object, i.e. content resource or folderWebdavException
- if something goes wrong on the store levelpublic InputStream getResourceContent(ITransaction transaction, String uri) throws WebdavException
IWebdavStore
resourceUri
.getResourceContent
in interface IWebdavStore
transaction
- indicates that the method is within the scope of a WebDAV
transactionuri
- URI of the content resourceWebdavException
- if something goes wrong on the store levelpublic long getResourceLength(ITransaction transaction, String resourceUri) throws WebdavException
IWebdavStore
resourceUri
.getResourceLength
in interface IWebdavStore
transaction
- indicates that the method is within the scope of a WebDAV
transactionresourceUri
- URI of the resource for which the length should be retrieved-1
declares this
value as invalid and asks the adapter to try to set it from the
properties if possibleWebdavException
- if something goes wrong on the store levelpublic StoredObject getStoredObject(ITransaction transaction, String uri)
IWebdavStore
uri
getStoredObject
in interface IWebdavStore
transaction
- indicates that the method is within the scope of a WebDAV
transactionuri
- URIpublic Map<String,String> setCustomProperties(ITransaction transaction, String resourceUri, Map<String,Object> propertiesToSet, List<String> propertiesToRemove)
IWebdavStore
setCustomProperties
in interface IWebdavStore
transaction
- the ITransaction
within which the operation takes place; may not be nullresourceUri
- the URI of the object on which the properties should be updated; may not be nullpropertiesToSet
- a map of (propertyName, propertyValue) pairs which should be set on the object; may not be null;
If the name of a property contains a namespace, it is expected to be in the [namespaceUri]:[localPropertyName] format.propertiesToRemove
- a set of property name representing the properties which should be removedpublic Map<String,Object> getCustomProperties(ITransaction transaction, String resourceUri)
IWebdavStore
getCustomProperties
in interface IWebdavStore
transaction
- the ITransaction
within which the operation takes place; may not be nullresourceUri
- the URI of the object on which the properties should be updated; may not be nullpublic Map<String,String> getCustomNamespaces(ITransaction transaction, String resourceUri)
IWebdavStore
getCustomNamespaces
in interface IWebdavStore
transaction
- the ITransaction
within which the operation takes place; may not be nullresourceUri
- resourceUri the URI of the object on which the properties should be updated; may not be nullCopyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.