com.holonplatform.datastore.mongo.core.async.internal

## Class AbstractAsyncMongoDatastore<TX extends MongoTransaction<com.mongodb.reactivestreams.client.ClientSession>>

- java.lang.Object
- - com.holonplatform.core.internal.datastore.AbstractDatastore<X>
  - - com.holonplatform.core.internal.datastore.AbstractInitializableDatastore<X>
    - - com.holonplatform.datastore.mongo.core.internal.datastore.AbstractMongoDatastore<AsyncMongoDatastoreCommodityContext,com.mongodb.reactivestreams.client.ClientSession,TX,com.mongodb.reactivestreams.client.MongoDatabase>
      - - com.holonplatform.datastore.mongo.core.async.internal.AbstractAsyncMongoDatastore<TX>

- Type Parameters:
    `TX` - Concrete transaction type
  All Implemented Interfaces:
    com.holonplatform.core.datastore.DataContextBound, com.holonplatform.core.datastore.DatastoreCommodityContext, com.holonplatform.core.datastore.DatastoreCommodityHandler, com.holonplatform.core.datastore.DatastoreCommodityRegistrar<AsyncMongoDatastoreCommodityContext>, com.holonplatform.core.datastore.DatastoreExpressionResolverRegistrar, com.holonplatform.core.ExpressionResolver.ExpressionResolverHandler, com.holonplatform.core.ExpressionResolver.ExpressionResolverProvider, com.holonplatform.core.ExpressionResolver.ExpressionResolverSupport, AsyncMongoDatastoreCommodityContext, MongoDatastoreCommodityContext<com.mongodb.reactivestreams.client.MongoDatabase,com.mongodb.reactivestreams.client.ClientSession>, MongoContext<com.mongodb.reactivestreams.client.ClientSession>, MongoOperationContext<com.mongodb.reactivestreams.client.MongoDatabase,com.mongodb.reactivestreams.client.ClientSession>, MongoDatabaseHandler<com.mongodb.reactivestreams.client.MongoDatabase>, Serializable
  Direct Known Subclasses:
    DefaultAsyncMongoDatastore, DefaultReactiveMongoDatastore

      public abstract class AbstractAsyncMongoDatastore<TX extends MongoTransaction<com.mongodb.reactivestreams.client.ClientSession>>
      extends com.holonplatform.datastore.mongo.core.internal.datastore.AbstractMongoDatastore<AsyncMongoDatastoreCommodityContext,com.mongodb.reactivestreams.client.ClientSession,TX,com.mongodb.reactivestreams.client.MongoDatabase>
      implements AsyncMongoDatastoreCommodityContext

  Abstract asynchronous MongoDB Datastore implementation.
  Since:
    5.2.0
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `AbstractAsyncMongoDatastore.AsyncBuilder<TX extends MongoTransaction<com.mongodb.reactivestreams.client.ClientSession>,I extends AbstractAsyncMongoDatastore<TX>,D extends com.holonplatform.core.datastore.DatastoreOperations,B extends BaseAsyncMongoDatastore.Builder<D,TX,B>>`

    - ### Nested classes/interfaces inherited from class com.holonplatform.datastore.mongo.core.internal.datastore.AbstractMongoDatastore

      `com.holonplatform.datastore.mongo.core.internal.datastore.AbstractMongoDatastore.AbstractBuilder<MDB,CX extends com.holonplatform.core.datastore.DatastoreCommodityContext,S extends com.mongodb.session.ClientSession,TX extends MongoTransaction<S>,I extends com.holonplatform.datastore.mongo.core.internal.datastore.AbstractMongoDatastore<CX,S,TX,MDB>,D extends com.holonplatform.core.datastore.DatastoreOperations,B extends MongoDatastoreBuilder<D,S,TX,B>>`

    - ### Nested classes/interfaces inherited from interface com.holonplatform.core.datastore.DatastoreCommodityContext

      `com.holonplatform.core.datastore.DatastoreCommodityContext.CommodityConfigurationException, com.holonplatform.core.datastore.DatastoreCommodityContext.CommodityNotAvailableException`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractAsyncMongoDatastore(MongoTransactionFactory<com.mongodb.reactivestreams.client.ClientSession,TX> transactionFactory)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `com.mongodb.reactivestreams.client.MongoClient` | `getClient()` Get the MongoDB client.
    `Optional<com.mongodb.reactivestreams.client.ClientSession>` | `getClientSession()` Get the current client session, if available.
    `org.bson.codecs.configuration.CodecRegistry` | `getDatabaseCodecRegistry()` Get the `CodecRegistry` bound to the current database.
    `boolean` | `isAsync()` Gets whether the MongoDB driver in use is asynchronous.
    `void` | `setClient(com.mongodb.reactivestreams.client.MongoClient client)` Set the MongoDB client to use.
    `<R> R` | `withDatabase(MongoDatabaseOperation<com.mongodb.reactivestreams.client.MongoDatabase,R> operation)` Execute given `MongoDatabaseOperation` using a managed MongoDatabase.

    - ### Methods inherited from class com.holonplatform.datastore.mongo.core.internal.datastore.AbstractMongoDatastore

      `getDatabaseName, getDefaultEnumCodecStrategy, getDefaultReadConcern, getDefaultReadPreference, getDefaultWriteConcern, getDocumentIdResolver, setDatabaseName, setDefaultReadConcern, setDefaultReadPreference, setDefaultWriteConcern, setDocumentIdResolver, setEnumCodecStrategy, setTransactionFactory, trace`

    - ### Methods inherited from class com.holonplatform.core.internal.datastore.AbstractInitializableDatastore

      `getInitializationClassLoader, initialize, isInitialized, setInitializationClassLoader`

    - ### Methods inherited from class com.holonplatform.core.internal.datastore.AbstractDatastore

      `addExpressionResolver, create, getAvailableCommodities, getCommodityFactoryType, getDataContextId, getExpressionResolvers, getExpressionResolverType, isTraceEnabled, registerCommodity, removeExpressionResolver, resolve, setDataContextId, setTraceEnabled, toString`

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

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.holonplatform.datastore.mongo.core.config.MongoDatastoreCommodityContext

      `getDatabaseName`

    - ### Methods inherited from interface com.holonplatform.datastore.mongo.core.context.MongoContext

      `getDefaultEnumCodecStrategy, getDefaultReadConcern, getDefaultReadPreference, getDefaultWriteConcern, getDocumentIdResolver, toJson, toJson, toJson, trace, trace, trace, trace`

    - ### Methods inherited from interface com.holonplatform.core.ExpressionResolver.ExpressionResolverProvider

      `getExpressionResolvers`

    - ### Methods inherited from interface com.holonplatform.datastore.mongo.core.MongoDatabaseHandler

      `withDatabase`

    - ### Methods inherited from interface com.holonplatform.core.datastore.DatastoreCommodityHandler

      `create, getAvailableCommodities, hasCommodity`

    - ### Methods inherited from interface com.holonplatform.core.ExpressionResolver.ExpressionResolverSupport

      `addExpressionResolvers`

- - ### Constructor Detail

    - #### AbstractAsyncMongoDatastore

          public AbstractAsyncMongoDatastore(MongoTransactionFactory<com.mongodb.reactivestreams.client.ClientSession,TX> transactionFactory)

  - ### Method Detail

    - #### isAsync

          public boolean isAsync()

      Description copied from interface: `MongoOperationContext`
      Gets whether the MongoDB driver in use is asynchronous.
      Specified by:
        `isAsync` in interface `MongoOperationContext<com.mongodb.reactivestreams.client.MongoDatabase,com.mongodb.reactivestreams.client.ClientSession>`
      Returns:
        `true` if in asynchronous mode, `false` if in synchronous mode

    - #### getClientSession

          public Optional<com.mongodb.reactivestreams.client.ClientSession> getClientSession()

      Description copied from interface: `MongoContext`
      Get the current client session, if available.
      Specified by:
        `getClientSession` in interface `MongoContext<com.mongodb.reactivestreams.client.ClientSession>`
      Returns:
        Optional client session

    - #### getDatabaseCodecRegistry

          public org.bson.codecs.configuration.CodecRegistry getDatabaseCodecRegistry()

      Description copied from interface: `MongoContext`
      Get the `CodecRegistry` bound to the current database.
      Specified by:
        `getDatabaseCodecRegistry` in interface `MongoContext<com.mongodb.reactivestreams.client.ClientSession>`
      Returns:
        Database `CodecRegistry`

    - #### setClient

          public void setClient(com.mongodb.reactivestreams.client.MongoClient client)

      Set the MongoDB client to use.
      Parameters:
        `client` - the client to set

    - #### getClient

          public com.mongodb.reactivestreams.client.MongoClient getClient()

      Description copied from interface: `AsyncMongoDatastoreCommodityContext`
      Get the MongoDB client.
      Specified by:
        `getClient` in interface `AsyncMongoDatastoreCommodityContext`
      Returns:
        the MongoDB client

    - #### withDatabase

          public <R> R withDatabase(MongoDatabaseOperation<com.mongodb.reactivestreams.client.MongoDatabase,R> operation)

      Description copied from interface: `MongoDatabaseHandler`
      Execute given `MongoDatabaseOperation` using a managed MongoDatabase.
      Specified by:
        `withDatabase` in interface `MongoDatabaseHandler<com.mongodb.reactivestreams.client.MongoDatabase>`
      Type Parameters:
        `R` - Operation result type
      Parameters:
        `operation` - Operation to execute (not null)
      Returns:
        Operation result

Copyright © 2019 The Holon Platform. All rights reserved.