new FileSystemBlobStore(storeConfig : Object, appInstance : App, sessionInstance : UBSession) #

Blob store implementation for storing content inside models public folders. Key conceptions:

  • relative path created in format modelName|relativePathFromModelDir to hide real file place from client
  • OS user temp folder used for store temporary content
  • delete operation is forbidden since models must be under version control

    Used in:

  • ubm_form for store form def & js inside /public/forms

  • ubm_diagrams for store diagram inside /public/erdiagrams
  • ubs_report for store report template inside /public/reports
  • e.t.c.

Members

fullStorePath instance #

Normalized path to the store root

Methods

doDeletion(attribute : UBEntityAttribute, ID : Number, blobInfo : BlobStoreItem) instance #

fillResponse(requestParams : BlobStoreRequest, blobInfo : BlobStoreItem, req : THTTPRequest, resp : THTTPResponse)→Boolean instance #

Fill HTTP response for getDocument request

Arguments info:

  • blobInfo: BlobStoreItem

    Document metadata. Not used for dirty requests

genNewPlacement(attribute : UBEntityAttribute, dirtyItem : BlobStoreItem, ID : Number)→Object instance #

Calculate a relative path & file name for a new BLOB item. If new folder dose not exists - create it

getContent(request : BlobStoreRequest, blobInfo : BlobStoreItem, optionsopt : Object)→String | ArrayBuffer instance #

Retrieve BLOB content from blob store.

Arguments info:

  • options: Object
    • encoding: String

      Default to 'bin'. Possible values: 'bin'|'ascii'|'utf-8' If undefined UB will send query to entity anf get it from DB. At last one parameter {store: storeName} should be defined to prevent loading actual JSON from DB

  • blobInfo: BlobStoreItem

    JSON retrieved from a DB.

getPermanentFileName(blobItem : BlobStoreItem, requestopt : BlobStoreRequest)→String instance #

For file based store:

  • store.path + relativePath + fileName

Arguments info:

persist(attribute : UBEntityAttribute, ID : Number, dirtyItem : BlobStoreItem, newRevision : number)→BlobStoreItem | null instance #

Move content defined by dirtyItem from temporary to permanent store. TIPS: in v0 (UB<5) if file updated then implementation takes a store from old item. This raise a problem - old store may be in archive state (readonly) So in UB5 we change implementation to use a store defined in the attribute for new items

Return a new attribute content which describe a place of BLOB in permanent store

saveContentToTempStore(request : BlobStoreRequest, attribute : UBEntityAttribute, content : ArrayBuffer)→BlobStoreItem instance #

Arguments info: