org.axonframework.common.mongo
Class AuthenticatingMongoTemplate

java.lang.Object
  extended by org.axonframework.common.mongo.AuthenticatingMongoTemplate
Direct Known Subclasses:
DefaultMongoTemplate, DefaultMongoTemplate

public abstract class AuthenticatingMongoTemplate
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 AuthenticatingMongoTemplate takes care of the authentication against the Mongo database.

Since:
2.0
Author:
Allard Buijze

Constructor Summary
protected AuthenticatingMongoTemplate(com.mongodb.Mongo mongo, String userName, char[] password)
          Initializes the MongoTemplate to connect using the given mongo instance and a database with default name "axonframework".
protected AuthenticatingMongoTemplate(com.mongodb.Mongo mongo, String databaseName, String userName, char[] password)
          Initializes the MongoTemplate to connect using the given mongo instance and the database with given databaseName.
protected AuthenticatingMongoTemplate(com.mongodb.Mongo mongo, String databaseName, String authenticationDatabaseName, String userName, char[] password)
          Initializes the MongoTemplate to connect using the given mongo instance and the database with given databaseName.
 
Method Summary
protected  com.mongodb.DB 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

AuthenticatingMongoTemplate

protected AuthenticatingMongoTemplate(com.mongodb.Mongo mongo,
                                      String userName,
                                      char[] password)
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:
mongo - The Mongo instance configured to connect to the Mongo Server
userName - The username to authenticate with. Use null to skip authentication
password - The password to authenticate with. Use null to skip authentication

AuthenticatingMongoTemplate

protected AuthenticatingMongoTemplate(com.mongodb.Mongo mongo,
                                      String databaseName,
                                      String userName,
                                      char[] password)
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:
mongo - The Mongo instance configured to connect to the Mongo Server
databaseName - The name of the database containing the data
userName - The username to authenticate with. Use null to skip authentication
password - The password to authenticate with. Use null to skip authentication

AuthenticatingMongoTemplate

protected AuthenticatingMongoTemplate(com.mongodb.Mongo mongo,
                                      String databaseName,
                                      String authenticationDatabaseName,
                                      String userName,
                                      char[] password)
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:
mongo - The Mongo instance configured to connect to the Mongo Server
databaseName - The name of the database containing the data
userName - The username to authenticate with. Use null to skip authentication
password - The password to authenticate with. Use null to skip authentication
Method Detail

database

protected com.mongodb.DB 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 DB instance, referring to the database with configured name.
See Also:
com.mongodb.DB#isAuthenticated(), DB#authenticate(String, char[])


Copyright © 2010-2016. All Rights Reserved.