org.axonframework.saga.repository.mongo
Class MongoSagaRepository

java.lang.Object
  extended by org.axonframework.saga.repository.AbstractSagaRepository
      extended by org.axonframework.saga.repository.mongo.MongoSagaRepository
All Implemented Interfaces:
SagaRepository

public class MongoSagaRepository
extends AbstractSagaRepository

Implementations of the SagaRepository that stores Sagas and their associations in a Mongo Database. Each Saga and its associations is stored as a single document.

Since:
2.0
Author:
Jettro Coenradie, Allard Buijze

Constructor Summary
MongoSagaRepository(MongoTemplate mongoTemplate)
          Initializes the Repository, using given mongoTemplate to access the collections containing the stored Saga instances.
 
Method Summary
protected  void deleteSaga(Saga saga)
           
protected  Set<String> findAssociatedSagaIdentifiers(Class<? extends Saga> type, AssociationValue associationValue)
           
 Saga load(String sagaIdentifier)
           
protected  void removeAssociationValue(AssociationValue associationValue, String sagaType, String sagaIdentifier)
           
 void setResourceInjector(ResourceInjector resourceInjector)
          Sets the ResourceInjector to use to inject Saga instances with any (temporary) resources they might need.
 void setSerializer(Serializer serializer)
          Provide the serializer to use if the default JavaSagaSerializer is not the best solution.
protected  void storeAssociationValue(AssociationValue associationValue, String sagaType, String sagaIdentifier)
           
protected  void storeSaga(Saga saga)
           
protected  String typeOf(Class<? extends Saga> sagaClass)
           
protected  void updateSaga(Saga saga)
           
 
Methods inherited from class org.axonframework.saga.repository.AbstractSagaRepository
add, commit, find
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MongoSagaRepository

public MongoSagaRepository(MongoTemplate mongoTemplate)
Initializes the Repository, using given mongoTemplate to access the collections containing the stored Saga instances.

Parameters:
mongoTemplate - the template providing access to the collections
Method Detail

load

public Saga load(String sagaIdentifier)

findAssociatedSagaIdentifiers

protected Set<String> findAssociatedSagaIdentifiers(Class<? extends Saga> type,
                                                    AssociationValue associationValue)
Specified by:
findAssociatedSagaIdentifiers in class AbstractSagaRepository

typeOf

protected String typeOf(Class<? extends Saga> sagaClass)
Specified by:
typeOf in class AbstractSagaRepository

deleteSaga

protected void deleteSaga(Saga saga)
Specified by:
deleteSaga in class AbstractSagaRepository

updateSaga

protected void updateSaga(Saga saga)
Specified by:
updateSaga in class AbstractSagaRepository

storeSaga

protected void storeSaga(Saga saga)
Specified by:
storeSaga in class AbstractSagaRepository

storeAssociationValue

protected void storeAssociationValue(AssociationValue associationValue,
                                     String sagaType,
                                     String sagaIdentifier)
Specified by:
storeAssociationValue in class AbstractSagaRepository

removeAssociationValue

protected void removeAssociationValue(AssociationValue associationValue,
                                      String sagaType,
                                      String sagaIdentifier)
Specified by:
removeAssociationValue in class AbstractSagaRepository

setSerializer

public void setSerializer(Serializer serializer)
Provide the serializer to use if the default JavaSagaSerializer is not the best solution.

Parameters:
serializer - SagaSerializer to use for sag serialization.

setResourceInjector

public void setResourceInjector(ResourceInjector resourceInjector)
Sets the ResourceInjector to use to inject Saga instances with any (temporary) resources they might need. These are typically the resources that could not be persisted with the Saga.

Parameters:
resourceInjector - The resource injector


Copyright © 2010-2013. All Rights Reserved.