org.axonframework.eventstore.mongo
Class MongoTemplate

java.lang.Object
  extended by org.axonframework.eventstore.mongo.MongoTemplate

public class MongoTemplate
extends Object

Helper class for interacting with the MongoDB instance containing the axon event store data. You can use the helper to get access to the MongoDB database and obtain references to the collection required by axon.

By configuring this object, you can change the name of the database as well as the names of the collections that are used.

Since:
0.7
Author:
Jettro Coenradie

Constructor Summary
MongoTemplate(com.mongodb.Mongo mongoDb)
          The helper requires an actual Mongo connection provided by the java driver.
 
Method Summary
 com.mongodb.DB database()
          Returns the database for the axon event store.
 com.mongodb.DBCollection domainEventCollection()
          Returns a reference to the collection containing the domain events.
 void setDatabaseName(String databaseName)
          Changes the name of the database where axon events will be stored.
 void setDomainEventsCollectionName(String domainEventsCollectionName)
          Changes the name of the collection to store the domain events.
 void setSnapshotEventsCollectionName(String snapshotEventsCollectionName)
          Changes the name of the collection to store the snapshot events in.
 com.mongodb.DBCollection snapshotEventCollection()
          Returtns a reference to the collection containing the snapshot events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MongoTemplate

public MongoTemplate(com.mongodb.Mongo mongoDb)
The helper requires an actual Mongo connection provided by the java driver.

Parameters:
mongoDb - The actual connection to a MongoDB instance
Method Detail

domainEventCollection

public com.mongodb.DBCollection domainEventCollection()
Returns a reference to the collection containing the domain events.

Returns:
DBCollection containing the domain events

snapshotEventCollection

public com.mongodb.DBCollection snapshotEventCollection()
Returtns a reference to the collection containing the snapshot events.

Returns:
DBCollection containing the snapshot events

database

public com.mongodb.DB database()
Returns the database for the axon event store.

Returns:
The axon event store database

setDatabaseName

public void setDatabaseName(String databaseName)
Changes the name of the database where axon events will be stored.

Parameters:
databaseName - String containing the name of the database for axon events

setDomainEventsCollectionName

public void setDomainEventsCollectionName(String domainEventsCollectionName)
Changes the name of the collection to store the domain events.

Parameters:
domainEventsCollectionName - String containing the name of the collection containing the domain events

setSnapshotEventsCollectionName

public void setSnapshotEventsCollectionName(String snapshotEventsCollectionName)
Changes the name of the collection to store the snapshot events in.

Parameters:
snapshotEventsCollectionName - String containing the name of the collection containing the snapshot events


Copyright © 2011. All Rights Reserved.