org.axonframework.mongo3.common
Class AbstractMongoTemplate

java.lang.Object
  extended by org.axonframework.mongo3.common.AbstractMongoTemplate
Direct Known Subclasses:
DefaultMongoTemplate, DefaultMongoTemplate

public abstract class AbstractMongoTemplate
extends Object

Abstract implementation for Mongo templates. Mongo templates give access to the collections in a Mongo Database used by components of the Axon Framework. The AbstractMongoTemplate takes care of the authentication against the Mongo database.

Since:
2.0
Author:
Allard Buijze

Constructor Summary
protected AbstractMongoTemplate(com.mongodb.MongoClient mongoClient)
          Initializes the MongoTemplate to connect using the given mongo instance and a database with default name "axonframework".
protected AbstractMongoTemplate(com.mongodb.MongoClient mongoClient, String databaseName)
          Initializes the MongoTemplate to connect using the given mongo instance and the database with given databaseName.
 
Method Summary
protected  com.mongodb.client.MongoDatabase database()
          Returns a reference to the Database with the configured database name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMongoTemplate

protected AbstractMongoTemplate(com.mongodb.MongoClient mongoClient)
Initializes the MongoTemplate to connect using the given mongo instance and a database with default name "axonframework". The given userName and password, when not null, are used to authenticate against the database.

Parameters:
mongoClient - The MongoClient instance configured to connect to the Mongo Server

AbstractMongoTemplate

protected AbstractMongoTemplate(com.mongodb.MongoClient mongoClient,
                                String databaseName)
Initializes the MongoTemplate to connect using the given mongo instance and the database with given databaseName. The given userName and password, when not null, are used to authenticate against the database.

Parameters:
mongoClient - The Mongo instance configured to connect to the Mongo Server
databaseName - The name of the database containing the data
Method Detail

database

protected com.mongodb.client.MongoDatabase database()
Returns a reference to the Database with the configured database name. If a username and/or password have been provided, these are used to authenticate against the database.

Note that the configured userName and password are ignored if the database is already in an authenticated state.

Returns:
a MongoDatabase instance, referring to the database with configured name.


Copyright © 2010-2016. All Rights Reserved.