     constructor : ->
       @cryptoServiceLoader  = new CryptoServiceLoader()
       @documentSearchKeyApi = new DocumentSearchKeyApi()
-      @kryptnosticEngine    = new MockKryptnosticEngine()
+      @engine               = new MockKryptnosticEngine()
       @metadataApi          = new MetadataApi()
       @metadataMapper       = new MetadataMapper()
       @objectIndexer        = new ObjectIndexer()


  Promise               = require 'bluebird'

  BinaryUtils           = require 'kryptnostic.binary-utils'
  CryptoServiceLoader   = require 'kryptnostic.crypto-service-loader'
  DocumentSearchKeyApi  = require 'kryptnostic.document-search-key-api'
  IndexedMetadata       = require 'kryptnostic.indexed-metadata'

        return Promise.resolve()

      { body } = storageRequest
      { objectAddressMatrix, objectSearchKey, objectIndexPair } = {}

      Promise.resolve()
      .then =>
        objectAddressMatrix = @engine.getObjectAddressMatrix()
        objectSearchKey     = @engine.getObjectSearchKey()
        objectIndexPair     = @engine.getObjectIndexPair({ objectSearchKey, objectAddressMatrix })

        encryptedAddressFunction = @searchKeySerializer.encrypt(objectAddressMatrix)
        @documentSearchKeyApi.uploadAddressFunction(id, encryptedAddressFunction)
      .then =>
        @documentSearchKeyApi.uploadSharingPair(id, objectIndexPair)
      .then =>
        @objectIndexer.index(id, body)
      .then (metadata) =>
        @prepareMetadataRequest({ id, metadata, objectAddressMatrix, objectSearchKey })
      .then (metadataRequest) =>
        @metadataApi.uploadMetadata( metadataRequest )

    # currently produces a single request, batch later if needed.
    prepareMetadataRequest: ({ id, metadata, objectAddressMatrix, objectSearchKey }) ->
      Promise.resolve()
      .then =>
        @cryptoServiceLoader.getObjectCryptoService(id, { expectMiss : false })
