T - The type that this aggregate storespublic abstract class LockingRepository<T,A extends Aggregate<T>> extends AbstractRepository<T,LockAwareAggregate<T,A>>
| Modifier | Constructor and Description | 
|---|---|
protected  | 
LockingRepository(AggregateModel<T> aggregateModel)
Initialize a repository with a pessimistic locking strategy, using the given  
aggregateModel, describing
 the structure of the aggregate. | 
protected  | 
LockingRepository(AggregateModel<T> aggregateModel,
                 LockFactory lockFactory)
Initialize the repository with the given  
LockFactory and aggregateModel | 
protected  | 
LockingRepository(Class<T> aggregateType)
Initialize a repository with a pessimistic locking strategy. 
 | 
protected  | 
LockingRepository(Class<T> aggregateType,
                 LockFactory lockFactory)
Initialize the repository with the given  
LockFactory. | 
protected  | 
LockingRepository(Class<T> aggregateType,
                 LockFactory lockFactory,
                 ParameterResolverFactory parameterResolverFactory)
Initialize the repository with the given  
LockFactory and ParameterResolverFactory. | 
protected  | 
LockingRepository(Class<T> aggregateType,
                 ParameterResolverFactory parameterResolverFactory)
Initialize a repository with a pessimistic locking strategy and a parameter resolver factory. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
protected LockAwareAggregate<T,A> | 
doCreateNew(Callable<T> factoryMethod)
Creates a new aggregate instance using the given  
factoryMethod. | 
protected abstract A | 
doCreateNewForLock(Callable<T> factoryMethod)
Creates a new aggregate instance using the given  
factoryMethod. | 
protected void | 
doDelete(LockAwareAggregate<T,A> aggregate)
Verifies whether all locks are valid and delegates to
  
doDeleteWithLock(Aggregate) to perform actual deleting. | 
protected abstract void | 
doDeleteWithLock(A aggregate)
Perform the actual deleting of the aggregate. 
 | 
protected LockAwareAggregate<T,A> | 
doLoad(String aggregateIdentifier,
      Long expectedVersion)
Perform the actual loading of an aggregate. 
 | 
protected abstract A | 
doLoadWithLock(String aggregateIdentifier,
              Long expectedVersion)
Loads the aggregate with the given aggregateIdentifier. 
 | 
protected void | 
doSave(LockAwareAggregate<T,A> aggregate)
Verifies whether all locks are valid and delegates to
  
doSaveWithLock(Aggregate) to perform actual storage. | 
protected abstract void | 
doSaveWithLock(A aggregate)
Perform the actual saving of the aggregate. 
 | 
protected void | 
prepareForCommit(LockAwareAggregate<T,A> aggregate)
Register handlers with the current Unit of Work that save or delete the given  
aggregate when
 the Unit of Work is committed. | 
aggregateModel, getAggregateType, load, load, managedAggregates, newInstance, postDelete, postSave, reportIllegalState, validateOnLoadprotected LockingRepository(Class<T> aggregateType)
aggregateType - The type of aggregate stored in this repositoryprotected LockingRepository(AggregateModel<T> aggregateModel)
aggregateModel, describing
 the structure of the aggregate.aggregateModel - The model describing the structure of the aggregateprotected LockingRepository(Class<T> aggregateType, ParameterResolverFactory parameterResolverFactory)
aggregateType - The type of aggregate stored in this repositoryparameterResolverFactory - The parameter resolver factory used to resolve parameters of annotated handlersprotected LockingRepository(Class<T> aggregateType, LockFactory lockFactory)
LockFactory.aggregateType - The type of aggregate stored in this repositorylockFactory - the lock factory to useprotected LockingRepository(AggregateModel<T> aggregateModel, LockFactory lockFactory)
LockFactory and aggregateModelaggregateModel - The model describing the structure of the aggregatelockFactory - the lock factory to useprotected LockingRepository(Class<T> aggregateType, LockFactory lockFactory, ParameterResolverFactory parameterResolverFactory)
LockFactory and ParameterResolverFactory.aggregateType - The type of aggregate stored in this repositorylockFactory - The lock factory to useparameterResolverFactory - The parameter resolver factory used to resolve parameters of annotated handlersprotected LockAwareAggregate<T,A> doCreateNew(Callable<T> factoryMethod) throws Exception
AbstractRepositoryfactoryMethod. Implementations should assume that this
 method is only called if a UnitOfWork is currently active.doCreateNew in class AbstractRepository<T,LockAwareAggregate<T,A extends Aggregate<T>>>factoryMethod - The method to create the aggregate's root instanceException - when the factoryMethod throws an exceptionprotected abstract A doCreateNewForLock(Callable<T> factoryMethod) throws Exception
factoryMethod. Implementations should assume that this
 method is only called if a UnitOfWork is currently active.factoryMethod - The method to create the aggregate's root instanceException - when the factoryMethod throws an exceptionprotected LockAwareAggregate<T,A> doLoad(String aggregateIdentifier, Long expectedVersion)
doLoad in class AbstractRepository<T,LockAwareAggregate<T,A extends Aggregate<T>>>aggregateIdentifier - the identifier of the aggregate to loadexpectedVersion - The expected version of the aggregateAggregateNotFoundException - if aggregate with given id cannot be foundprotected void prepareForCommit(LockAwareAggregate<T,A> aggregate)
AbstractRepositoryaggregate when
 the Unit of Work is committed.prepareForCommit in class AbstractRepository<T,LockAwareAggregate<T,A extends Aggregate<T>>>aggregate - The Aggregate to save or delete when the Unit of Work is committedprotected void doSave(LockAwareAggregate<T,A> aggregate)
doSaveWithLock(Aggregate) to perform actual storage.doSave in class AbstractRepository<T,LockAwareAggregate<T,A extends Aggregate<T>>>aggregate - the aggregate to storeprotected final void doDelete(LockAwareAggregate<T,A> aggregate)
doDeleteWithLock(Aggregate) to perform actual deleting.doDelete in class AbstractRepository<T,LockAwareAggregate<T,A extends Aggregate<T>>>aggregate - the aggregate to deleteprotected abstract void doSaveWithLock(A aggregate)
aggregate - the aggregate to storeprotected abstract void doDeleteWithLock(A aggregate)
aggregate - the aggregate to deleteprotected abstract A doLoadWithLock(String aggregateIdentifier, Long expectedVersion)
aggregateIdentifier - the identifier of the aggregate to loadexpectedVersion - The expected version of the aggregate to loadAggregateNotFoundException - if the aggregate with given identifier does not existCopyright © 2010–2018. All rights reserved.