org.axonframework.saga.annotation
Class AnnotatedSagaManager

java.lang.Object
  extended by org.axonframework.saga.AbstractSagaManager
      extended by org.axonframework.saga.annotation.AnnotatedSagaManager
All Implemented Interfaces:
Subscribable, EventListener, EventListenerProxy, SagaManager

public class AnnotatedSagaManager
extends AbstractSagaManager

Implementation of the SagaManager that uses annotations on the Sagas to describe the lifecycle management. Unlike the SimpleSagaManager, this implementation can manage several types of Saga in a single AnnotatedSagaManager.

Since:
0.7
Author:
Allard Buijze

Constructor Summary
AnnotatedSagaManager(SagaRepository sagaRepository, EventBus eventBus, Class<? extends AbstractAnnotatedSaga>... sagaClasses)
          Initialize the AnnotatedSagaManager using the given resources, and using a GenericSagaFactory.
AnnotatedSagaManager(SagaRepository sagaRepository, SagaFactory sagaFactory, EventBus eventBus, Class<? extends AbstractAnnotatedSaga>... sagaClasses)
          Initialize the AnnotatedSagaManager using the given resources.
 
Method Summary
protected  AssociationValue extractAssociationValue(Class<? extends Saga> sagaType, EventMessage event)
          Extracts the AssociationValue from the given event as relevant for a Saga of given sagaType.
protected  SagaCreationPolicy getSagaCreationPolicy(Class<? extends Saga> sagaType, EventMessage event)
          Returns the Saga Creation Policy for a Saga of the given sagaType and event.
 Class<?> getTargetType()
          Returns the instance type that this proxy delegates all event handling to.
 
Methods inherited from class org.axonframework.saga.AbstractSagaManager
commit, handle, setSuppressExceptions, setSynchronizeSagaAccess, subscribe, unsubscribe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotatedSagaManager

public AnnotatedSagaManager(SagaRepository sagaRepository,
                            EventBus eventBus,
                            Class<? extends AbstractAnnotatedSaga>... sagaClasses)
Initialize the AnnotatedSagaManager using the given resources, and using a GenericSagaFactory.

Parameters:
sagaRepository - The repository providing access to the Saga instances
eventBus - The event bus publishing the events
sagaClasses - The types of Saga that this instance should manage

AnnotatedSagaManager

public AnnotatedSagaManager(SagaRepository sagaRepository,
                            SagaFactory sagaFactory,
                            EventBus eventBus,
                            Class<? extends AbstractAnnotatedSaga>... sagaClasses)
Initialize the AnnotatedSagaManager using the given resources.

Parameters:
sagaRepository - The repository providing access to the Saga instances
sagaFactory - The factory creating new instances of a Saga
eventBus - The event bus publishing the events
sagaClasses - The types of Saga that this instance should manage
Method Detail

getSagaCreationPolicy

protected SagaCreationPolicy getSagaCreationPolicy(Class<? extends Saga> sagaType,
                                                   EventMessage event)
Description copied from class: AbstractSagaManager
Returns the Saga Creation Policy for a Saga of the given sagaType and event.

Specified by:
getSagaCreationPolicy in class AbstractSagaManager
Parameters:
sagaType - The type of Saga to get the creation policy for
event - The Event that is being dispatched to Saga instances
Returns:
the creation policy for the Saga

extractAssociationValue

protected AssociationValue extractAssociationValue(Class<? extends Saga> sagaType,
                                                   EventMessage event)
Description copied from class: AbstractSagaManager
Extracts the AssociationValue from the given event as relevant for a Saga of given sagaType.

Specified by:
extractAssociationValue in class AbstractSagaManager
Parameters:
sagaType - The type of Saga about to handle the Event
event - The event containing the association information
Returns:
the AssociationValue indicating which Sagas should handle given event

getTargetType

public Class<?> getTargetType()
Description copied from interface: EventListenerProxy
Returns the instance type that this proxy delegates all event handling to.

Returns:
the instance type that this proxy delegates all event handling to


Copyright © 2010-2012. All Rights Reserved.