org.modeshape.webdav

## Class LocalFileSystemStore

- java.lang.Object
- - org.modeshape.webdav.LocalFileSystemStore

- All Implemented Interfaces:
    IWebdavStore

      public class LocalFileSystemStore
      extends Object
      implements IWebdavStore

  Reference Implementation of WebdavStore

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LocalFileSystemStore(File root)`

  - ### Method Summary

    Methods
    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`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LocalFileSystemStore

          public LocalFileSystemStore(File root)

  - ### Method Detail

    - #### destroy

          public void destroy()

      Description copied from interface: `IWebdavStore`
      Life cycle method, called by WebdavServlet's destroy() method. Should be used to clean up resources.
      Specified by:
        `destroy` in interface `IWebdavStore`

    - #### begin

          public ITransaction begin(Principal principal)
                             throws WebdavException

      Description copied from interface: `IWebdavStore`
      Indicates that a new request or transaction with this store involved has been started. The request will be terminated by either `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.
      Specified by:
        `begin` in interface `IWebdavStore`
      Parameters:
        `principal` - the principal that started this request or `null` if there is non available
      Returns:
        a new `transaction`
      Throws:
        `WebdavException`

    - #### checkAuthentication

          public void checkAuthentication(ITransaction transaction)
                                   throws SecurityException

      Description copied from interface: `IWebdavStore`
      Checks if authentication information passed in is valid. If not throws an exception.
      Specified by:
        `checkAuthentication` in interface `IWebdavStore`
      Parameters:
        `transaction` - indicates that the method is within the scope of a WebDAV transaction
      Throws:
        `SecurityException`

    - #### commit

          public void commit(ITransaction transaction)
                      throws WebdavException

      Description copied from interface: `IWebdavStore`
      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 `IWebdavStore`
      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

          public void rollback(ITransaction transaction)
                        throws WebdavException

      Description copied from interface: `IWebdavStore`
      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 `IWebdavStore`
      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

          public void createFolder(ITransaction transaction,
                          String uri)
                            throws WebdavException

      Description copied from interface: `IWebdavStore`
      Creates a folder at the position specified by `folderUri`.
      Specified by:
        `createFolder` in interface `IWebdavStore`
      Parameters:
        `transaction` - indicates that the method is within the scope of a WebDAV transaction
        `uri` - URI of the folder
      Throws:
        `WebdavException` - if something goes wrong on the store level

    - #### createResource

          public void createResource(ITransaction transaction,
                            String uri)
                              throws WebdavException

      Description copied from interface: `IWebdavStore`
      Creates a content resource at the position specified by `resourceUri`.
      Specified by:
        `createResource` in interface `IWebdavStore`
      Parameters:
        `transaction` - indicates that the method is within the scope of a WebDAV transaction
        `uri` - URI of the content resource
      Throws:
        `WebdavException` - if something goes wrong on the store level

    - #### setResourceContent

          public long setResourceContent(ITransaction transaction,
                                String uri,
                                InputStream is,
                                String contentType,
                                String characterEncoding)
                                  throws WebdavException

      Description copied from interface: `IWebdavStore`
      Sets / stores the content of the resource specified by `resourceUri`.
      Specified by:
        `setResourceContent` in interface `IWebdavStore`
      Parameters:
        `transaction` - indicates that the method is within the scope of a WebDAV transaction
        `uri` - URI of the resource where the content will be stored
        `is` - 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
      Returns:
        lenght of resource
      Throws:
        `WebdavException` - if something goes wrong on the store level

    - #### getChildrenNames

          public String[] getChildrenNames(ITransaction transaction,
                                  String uri)
                                    throws WebdavException

      Description copied from interface: `IWebdavStore`
      Gets the names of the children of the folder specified by `folderUri`.
      Specified by:
        `getChildrenNames` in interface `IWebdavStore`
      Parameters:
        `transaction` - indicates that the method is within the scope of a WebDAV transaction
        `uri` - 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

    - #### removeObject

          public void removeObject(ITransaction transaction,
                          String uri)
                            throws WebdavException

      Description copied from interface: `IWebdavStore`
      Removes the object specified by `uri`.
      Specified by:
        `removeObject` in interface `IWebdavStore`
      Parameters:
        `transaction` - indicates that the method is within the scope of a WebDAV transaction
        `uri` - URI of the object, i.e. content resource or folder
      Throws:
        `WebdavException` - if something goes wrong on the store level

    - #### getResourceContent

          public InputStream getResourceContent(ITransaction transaction,
                                       String uri)
                                         throws WebdavException

      Description copied from interface: `IWebdavStore`
      Gets the content of the resource specified by `resourceUri`.
      Specified by:
        `getResourceContent` in interface `IWebdavStore`
      Parameters:
        `transaction` - indicates that the method is within the scope of a WebDAV transaction
        `uri` - 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

    - #### getResourceLength

          public long getResourceLength(ITransaction transaction,
                               String resourceUri)
                                 throws WebdavException

      Description copied from interface: `IWebdavStore`
      Gets the length of the content resource specified by `resourceUri`.
      Specified by:
        `getResourceLength` in interface `IWebdavStore`
      Parameters:
        `transaction` - indicates that the method is within the scope of a WebDAV transaction
        `resourceUri` - URI of the resource for which the length should be retrieved
      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

    - #### getStoredObject

          public StoredObject getStoredObject(ITransaction transaction,
                                     String uri)

      Description copied from interface: `IWebdavStore`
      Gets the storedObject specified by `uri`
      Specified by:
        `getStoredObject` in interface `IWebdavStore`
      Parameters:
        `transaction` - indicates that the method is within the scope of a WebDAV transaction
        `uri` - URI
      Returns:
        StoredObject

    - #### setCustomProperties

          public Map<String,String> setCustomProperties(ITransaction transaction,
                                               String resourceUri,
                                               Map<String,Object> propertiesToSet,
                                               List<String> propertiesToRemove)

      Description copied from interface: `IWebdavStore`
      Updates the custom properties on the given resource. NOTE: Nested properties are not supported
      Specified by:
        `setCustomProperties` in interface `IWebdavStore`
      Parameters:
        `transaction` - the `ITransaction` within which the operation takes place; may not be null
        `resourceUri` - the URI of the object on which the properties should be updated; may not be null
        `propertiesToSet` - 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 removed
      Returns:
        a Map of (property name, error message) for the properties which could not changed (either set or removed). If the operation was successful, this may be null.

    - #### getCustomProperties

          public Map<String,Object> getCustomProperties(ITransaction transaction,
                                               String resourceUri)

      Description copied from interface: `IWebdavStore`
      Returns the map of (propertyName, propertyValue) of custom properties of the given resource. NOTE: Nested properties are not supported
      Specified by:
        `getCustomProperties` in interface `IWebdavStore`
      Parameters:
        `transaction` - the `ITransaction` within which the operation takes place; may not be null
        `resourceUri` - the URI of the object on which the properties should be updated; may not be null
      Returns:
        a Map of (property name, property value) pairs; may not be null; if the property name is namespace-aware it is expected to have the [namespaceUri]:[localPropertyName] format

    - #### getCustomNamespaces

          public Map<String,String> getCustomNamespaces(ITransaction transaction,
                                               String resourceUri)

      Description copied from interface: `IWebdavStore`
      Returns a map of custom namespaces that are specific to the store.
      Specified by:
        `getCustomNamespaces` in interface `IWebdavStore`
      Parameters:
        `transaction` - the `ITransaction` within which the operation takes place; may not be null
        `resourceUri` - resourceUri the URI of the object on which the properties should be updated; may not be null
      Returns:
        a Map of (namespaceUri, namespacePrefix) pairs;may not be null;

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.