Document Storage

    Assembly: mindtouch.dream.documentstorage

    Class: MindTouch.Dream.HierarchicalDocumentStorageService
    SID: sid://mindtouch.com/2009/05/dream/documentstorage

    Overview

    Verb:Suffix Description
    GET: Get document
    PUT: Store document
    GET:{path-expression} Get a document fragment
    POST:{path} Insert document fragment at path
    PUT:{path-expression} Insert or replace document fragment
    DELETE: Delete document
    DELETE:{path-expression} Del

    Simplifying assumptions

    • V1 won't have namespace support
    • Path expressions limited to XPath syntax:
      • [n] - match nth child
      • [path='value'] - only element/attribute value equality
    • POST:{path}
      • if path could resolve to multiple sub-trees, insertion happens at end of last
    • PUT:{path-expression}
      • if expression has more than one matches, only the first one is affected
    • DELETE:{path-expression}
      • f

    Alternate approach

    • Do not try to map path/filesystem to XPath semantics
      • In Xml a path does not necessarily refer to a single node
    • A path has to uniquely identify a document fragment
      • use unique attribute/element mapping to generate unique path
        • i.e. /foo/bar:1234 map map to /foo/bar/@id
      • in lieu of a uniqueness mapping for a path, attach the DB element id as @id in a special namespace

    Example

    Document

    <acl>
        <users>
            <user id="1234>
                <name>Bob</name>
            </user>
        </users>
    </acl>

    Get all Users:

    GET:acl/users

    Get user named bob:

    GET:acl/users/user[name=bob]

    Get user with Id 1234

    GET:acl/users/user[@id=1234]

    Get name of user 1234

    GET:acl/users/user[@id=1234]/name

     

    Features

    GET:

    Get a list of all visible storage folders.

    Response
    Status Response Body Description
    OK (200) Folder List opreation completed successfully
    Version History

    Added in Aqua


    GET:{folder}

    Retrieves the list of files from the storage folder.

    Response
    Status Response Body Description
    OK (200) File List opreation completed successfully
    Version History

    Added in Aqua


    PUT:{folder}/{filename}

    Add a file to the storage folder.

    Query Parameters
    Name Type Defaut Description
    ttl double? infinite Time-to-live in seconds for the uploaded file.
    Request body

    application/octet-stream

    Response
    Response Response Body Description
    Ok (200) --- operation completed successfully and a new resource was created
    Bad Request (400) text/html request could not be completed, because of invalid data in the request
    Not Found (409) text/html request could not complete b/c of a conflict; response should contain information about how to resolve the situation (note: usually in response to a PUT action)
    Version History

    Beryl:

    added ttl query parameter

     

    Aqua: added feature


    DELETE:{folder}/{filename}

    Delete file from the storage folder.

    Response
    Response Response Body Description
    OK (200) --- opreation completed successfully
    Bad Request (400) text/html request could not be completed, because of invalid data in the request
    Not Found (404) text/html requested resource could not be found; it is not known if it will come back later
    Version History

    Added in Aqua


    GET:{folder}/{filename}

    Retrieve a file from the storage folder.

    Response
    Response Response Body Description
    OK (200) application/octet-stream opreation completed successfully
    Bad Request (400) --- request could not be completed, because of invalid data in the request
    Not Found (404) --- requested resource could not be found; it is not known if it will come back later

    HEAD:{folder}/{filename}

    Retrieve information about a file from the storage folder.

    Response
    Response Response Body Description
    OK (200) --- (HTTP headers only) opreation completed successfully
    Bad Request (400) --- request could not be completed, because of invalid data in the request
    Not Found (404) --- requested resource could not be found; it is not known if it will come back later
    Version History

    Crimson: added feature parameters

    Acqua: service added

    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by