|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.domian.repository.AbstractRepository<T> net.sourceforge.domian.repository.AbstractDomianCoreRepository<T> net.sourceforge.domian.repository.PartitionRepositoryInvocationHandler<T>
public class PartitionRepositoryInvocationHandler<T extends Entity>
InvocationHandler
implementation for partition repositories.
All repositories either consisting of, or belonging to a PartitionRepository
may use this repository wrapper.
Field Summary | |
---|---|
protected boolean |
executeOperationsExclusivelyOnly
|
protected net.sourceforge.domian.repository.PartitionRepositoryInvocationHandler.IteratorRegistry |
iteratorRegistry
A internal registry keeping track of all active iterators. |
protected Specification<T> |
partitionSpecification
|
protected Repository<T> |
repositoryDelegate
|
protected boolean |
repositoryDelegateIsAlreadyPartitioned
|
protected java.util.Map<Specification<? extends T>,PartitionRepository> |
subPartitions
All sub-partition repositories, indexed by a unique specification. |
protected PartitionRepository<? super T> |
superPartitionRepository
|
protected Specification<? super T> |
superPartitionSpecification
|
protected Synchronizer |
synchronizer
A synchronizer used to control concurrent and exclusive access to repository methods. |
Fields inherited from class net.sourceforge.domian.repository.AbstractDomianCoreRepository |
---|
DEFAULT_DOMIAN_ROOT_DIR_NAME, DEFAULT_DOMIAN_ROOT_PATH, log |
Fields inherited from class net.sourceforge.domian.repository.AbstractRepository |
---|
supportsRecursiveIndexing, usesNativePartitioningSupport |
Method Summary | ||
---|---|---|
protected
|
addPartition(Specification<V> partitionSpecification,
PartitionRepository<? extends V> partitionRepository)
|
|
|
addPartitionFor(Specification<V> partitionSpecification)
Adds a new partition to this repository. |
|
|
addPartitionFor(Specification<V> partitionSpecification,
Repository<? super V> partitionRepository)
Adds a new partition to this repository. |
|
|
addPartitionFor(Specification<V> partitionSpecification,
java.lang.String repositoryId)
Adds a new partition to this repository. |
|
void |
close()
Closes the repository and releases all resources. |
|
void |
collectAllPartitions(java.util.Map<Specification<? extends T>,PartitionRepository> partitionMap)
Populates the given map with a flattened and recursive view of all partitions in this repository. |
|
|
collectAllPartitionsWithRepositorySatisfying(Specification<R> specification,
java.util.Map<Specification<? extends T>,PartitionRepository> partitionMap)
Populates the given map with a flattened and recursive view of all partitions in this repository, satisfying the given specification. |
|
protected
|
conditionalSynchronizedExecutionOf(java.util.concurrent.Callable<V> operation)
|
|
protected
|
countAllEntitiesWithoutSpecificationSharpening(Specification<V> specification)
Special count method without sharpening original specifications to fit partition specifications. |
|
protected java.lang.Boolean |
entityExists_PossiblyInWrongPartition(T entity)
|
|
|
findAllEntitiesSpecifiedBy(Specification<V> specification)
Finds and returns all entities approved by the given specification. |
|
protected
|
findAllEntitiesSpecifiedBy(Specification<V> specification,
java.lang.Boolean sharpenOriginalSpecificationsToFitPartitionSpecification)
|
|
|
findPartitionFor(Specification<V> partitionSpecification)
|
|
|
findSingleEntitySpecifiedBy(Specification<V> specification)
Finds and returns one single entity approved by the given specification. |
|
java.util.Map<Specification<? extends T>,PartitionRepository> |
getAllPartitions()
Optional: mainly added for testing purposes, may throw UnsupportedOperationException |
|
protected PartitionRepository |
getCorrectPartitionRepository(PartitionRepository originalPartitionRepository,
PartitionRepository toBeReusedPartitionRepository)
|
|
java.lang.String |
getFormat()
This method applies to this partition only! |
|
EntityPersistenceMetaData |
getMetaDataFor(T entity)
|
|
java.util.Set<T> |
getPartitionOnlyEntities()
This method applies to this partition only! |
|
java.util.Map<Specification<? extends T>,PartitionRepository> |
getPartitions()
Optional: mainly added for testing purposes, may throw UnsupportedOperationException
This method applies to this partition only! |
|
Specification<T> |
getPartitionSpecification()
This method applies to this partition only! |
|
PersistenceDefinition |
getPersistenceDefinition()
This method applies to this partition only! |
|
java.io.File |
getRepositoryDirectory()
This method applies to this partition only! |
|
java.lang.String |
getRepositoryId()
This method applies to this partition only! |
|
PartitionRepository<? super T> |
getRootRepository()
|
|
PartitionRepository<? super T> |
getSuperPartitionRepository()
This method applies to this partition only! |
|
Specification<? super T> |
getSuperPartitionSpecification()
|
|
Repository<T> |
getTargetRepository()
This method applies to this partition only! |
|
java.lang.Class<T> |
getType()
|
|
protected void |
handlePartitionRepositoryException(java.lang.Exception e,
java.lang.String errorMessage)
|
|
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
|
|
java.lang.Boolean |
isIndexingEntitiesRecursively()
|
|
java.lang.Boolean |
isLeafPartition()
This method applies to this partition only! |
|
java.lang.Boolean |
isPartitioningNatively()
When true , the repository utilizes some sort of native partitioning mechanism, e.g. |
|
java.lang.Boolean |
isRootPartition()
This method applies to this partition only! |
|
|
iterateAllEntitiesSpecifiedBy(Specification<V> specification)
Finds and returns all entities approved by the given specification. |
|
void |
load()
The semantics of this operation depends on the Repository 's PersistenceDefinition . |
|
void |
persist()
The semantics of this operation depends on the Repository 's PersistenceDefinition . |
|
|
put(V entity)
Puts the given entity into this repository. |
|
|
remove(V entity)
Removes the given entity from this repository. |
|
|
removeAllEntitiesSpecifiedBy(Specification<V> specification)
Removes all entities approved by the given specification. |
|
protected
|
removePartitionOnlyEntity(V entity)
|
|
void |
repartition()
Repartitions the entire repository. |
|
|
repartition(V entity)
When an entity is altered, this method must be explicitely invoked to reassure proper placement in the repository partition hierarchy. |
|
protected boolean |
repositoryExemptFromSyncronization()
|
|
protected boolean |
repositoryOperationsNeedToBeExecutedExclusively()
|
|
void |
setPartitionSpecification(Specification<T> partitionSpecification)
This method applies to this partition only! |
|
void |
setSuperPartitionRepository(PartitionRepository<? super T> partitionRepository)
This method applies to this partition only! |
|
void |
setSuperPartitionSpecification(Specification<? super T> specification)
This method applies to this partition only! |
|
|
update(V entity)
Updates an entity. |
|
protected PartitionRepository |
wireUpPartition(Specification superPartitionSpecification,
PartitionRepository superPartitionRepository,
Specification partitionSpecification,
PartitionRepository partitionRepository)
|
Methods inherited from class net.sourceforge.domian.repository.AbstractDomianCoreRepository |
---|
createUniqueSpecificationFor, getSynchronizer, makePartition, onMakePartition, setSynchronizer |
Methods inherited from class net.sourceforge.domian.repository.AbstractRepository |
---|
contains, count, countAll, countAllEntitiesSpecifiedBy, find, findAll, findSingle, iterate, iterateAll, putAll, remove, removeAll, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sourceforge.domian.repository.Repository |
---|
count, countAll, countAllEntitiesSpecifiedBy, find, findAll, findSingle, iterate, iterateAll, makePartition, putAll, remove, removeAll, update |
Field Detail |
---|
protected final Synchronizer synchronizer
protected final net.sourceforge.domian.repository.PartitionRepositoryInvocationHandler.IteratorRegistry iteratorRegistry
protected boolean executeOperationsExclusivelyOnly
protected boolean repositoryDelegateIsAlreadyPartitioned
protected Specification<? super T extends Entity> superPartitionSpecification
protected PartitionRepository<? super T extends Entity> superPartitionRepository
protected Specification<T extends Entity> partitionSpecification
protected Repository<T extends Entity> repositoryDelegate
protected final java.util.Map<Specification<? extends T extends Entity>,PartitionRepository> subPartitions
Method Detail |
---|
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
invoke
in interface java.lang.reflect.InvocationHandler
java.lang.Throwable
public java.lang.Class<T> getType()
getType
in interface PartitionRepository<T extends Entity>
public PartitionRepository<? super T> getRootRepository()
getRootRepository
in interface PartitionRepository<T extends Entity>
public Specification<? super T> getSuperPartitionSpecification()
public void setSuperPartitionSpecification(Specification<? super T> specification)
PartitionRepository
setSuperPartitionSpecification
in interface PartitionRepository<T extends Entity>
public PartitionRepository<? super T> getSuperPartitionRepository()
PartitionRepository
getSuperPartitionRepository
in interface PartitionRepository<T extends Entity>
public void setSuperPartitionRepository(PartitionRepository<? super T> partitionRepository)
PartitionRepository
setSuperPartitionRepository
in interface PartitionRepository<T extends Entity>
public Specification<T> getPartitionSpecification()
PartitionRepository
getPartitionSpecification
in interface PartitionRepository<T extends Entity>
public void setPartitionSpecification(Specification<T> partitionSpecification)
PartitionRepository
setPartitionSpecification
in interface PartitionRepository<T extends Entity>
public Repository<T> getTargetRepository()
PartitionRepository
Repository
instance.
Not only the Repository
instance in action must be modified, but all super partitions leading up to the root repository as well.
Is it possible anyway...?
getTargetRepository
in interface PartitionRepository<T extends Entity>
null
public java.lang.Boolean isRootPartition()
PartitionRepository
isRootPartition
in interface PartitionRepository<T extends Entity>
true
if this repository partition is the root partition (does not have a super partitions)public java.lang.Boolean isLeafPartition()
PartitionRepository
isLeafPartition
in interface PartitionRepository<T extends Entity>
true
if this repository partition is a leaf partition (does not have any sub partitions)protected boolean repositoryOperationsNeedToBeExecutedExclusively()
protected boolean repositoryExemptFromSyncronization()
protected PartitionRepository wireUpPartition(Specification superPartitionSpecification, PartitionRepository superPartitionRepository, Specification partitionSpecification, PartitionRepository partitionRepository)
protected <V> V conditionalSynchronizedExecutionOf(java.util.concurrent.Callable<V> operation) throws java.lang.Exception
java.lang.Exception
protected void handlePartitionRepositoryException(java.lang.Exception e, java.lang.String errorMessage)
public <V extends T> java.util.Iterator<V> iterateAllEntitiesSpecifiedBy(Specification<V> specification)
Repository
iterateAllEntitiesSpecifiedBy
in interface Repository<T extends Entity>
specification
- the entity specification
protected <V extends T> java.lang.Long countAllEntitiesWithoutSpecificationSharpening(Specification<V> specification)
public <V extends T> V findSingleEntitySpecifiedBy(Specification<V> specification)
Repository
findSingleEntitySpecifiedBy
in interface Repository<T extends Entity>
findSingleEntitySpecifiedBy
in class AbstractRepository<T extends Entity>
specification
- the entity specification
null
if no entity is foundpublic <V extends T> java.util.Collection<V> findAllEntitiesSpecifiedBy(Specification<V> specification)
Repository
findAllEntitiesSpecifiedBy
in interface Repository<T extends Entity>
specification
- the entity specification
protected <V extends T> java.util.Collection<V> findAllEntitiesSpecifiedBy(Specification<V> specification, java.lang.Boolean sharpenOriginalSpecificationsToFitPartitionSpecification)
public <V extends T> void put(V entity)
Repository
put
in interface Repository<T extends Entity>
entity
- the entity to be storedpublic <V extends T> void update(V entity)
Repository
PersistenceDefinition.FILE
, and possibly PersistenceDefinition.DELEGATED
...
For all other persistence definitions, this method is redundant/not applicable.
Anyway, by applying this method in a consistent manner, an eventual repository migration will not need any code changes.
update
in interface Repository<T extends Entity>
public <V extends T> java.lang.Long removeAllEntitiesSpecifiedBy(Specification<V> specification)
Repository
removeAllEntitiesSpecifiedBy
in interface Repository<T extends Entity>
specification
- the entity specification
public <V extends T> java.lang.Boolean remove(V entity)
Repository
remove
in interface Repository<T extends Entity>
entity
- the entity to be removed
true
if the entity is found and removed, otherwise false
public java.lang.Boolean isPartitioningNatively()
Repository
true
, the repository utilizes some sort of native partitioning mechanism, e.g. RDBMS indices.
If true
, partition repositories may be reusing the same repository instance.
isPartitioningNatively
in interface Repository<T extends Entity>
isPartitioningNatively
in class AbstractRepository<T extends Entity>
true
if repository utilizes some sort of native partitioning mechanism, e.g. RDBMS indices.public java.lang.Boolean isIndexingEntitiesRecursively()
isIndexingEntitiesRecursively
in interface Repository<T extends Entity>
isIndexingEntitiesRecursively
in class AbstractRepository<T extends Entity>
true
if member entities are stored recursively, and made searchable -
false
if only aggregate root is stored.public java.io.File getRepositoryDirectory()
getRepositoryDirectory
in interface PersistentRepository<T extends Entity>
public java.lang.String getRepositoryId()
getRepositoryId
in interface PersistentRepository<T extends Entity>
public PersistenceDefinition getPersistenceDefinition()
getPersistenceDefinition
in interface PersistentRepository<T extends Entity>
public java.lang.String getFormat()
getFormat
in interface PersistentRepository<T extends Entity>
public void load()
PersistentRepository
Repository
's PersistenceDefinition
.
load
in interface PersistentRepository<T extends Entity>
public void persist()
PersistentRepository
Repository
's PersistenceDefinition
.
persist
in interface PersistentRepository<T extends Entity>
public EntityPersistenceMetaData getMetaDataFor(T entity)
getMetaDataFor
in interface PersistentRepository<T extends Entity>
public void close()
PersistentRepository
close
in interface PersistentRepository<T extends Entity>
protected PartitionRepository getCorrectPartitionRepository(PartitionRepository originalPartitionRepository, PartitionRepository toBeReusedPartitionRepository)
protected <V extends T> PartitionRepository<V> addPartition(Specification<V> partitionSpecification, PartitionRepository<? extends V> partitionRepository)
public <V extends T> PartitionRepository<V> addPartitionFor(Specification<V> partitionSpecification)
PartitionRepository
Specification
.
The new partition repository will be of the same type as this repository.
addPartitionFor
in interface PartitionRepository<T extends Entity>
partitionSpecification
- the specification specifying the partition
public <V extends T> PartitionRepository<V> addPartitionFor(Specification<V> partitionSpecification, java.lang.String repositoryId)
PartitionRepository
Specification
.
The new partition repository will be of the same type as this repository.
addPartitionFor
in interface PartitionRepository<T extends Entity>
partitionSpecification
- the specification specifying the partitionrepositoryId
- the repository id; a non-blank value is mandatory for all persistent repositories
public <V extends T> PartitionRepository<V> addPartitionFor(Specification<V> partitionSpecification, Repository<? super V> partitionRepository)
PartitionRepository
Specification
.
addPartitionFor
in interface PartitionRepository<T extends Entity>
partitionSpecification
- the specification specifying the partitionpartitionRepository
- the partition repository
public <V extends T> java.lang.Boolean repartition(V entity)
PartitionRepository
repartition
in interface PartitionRepository<T extends Entity>
entity
- the entity to be repartitioned
true
if entity was repartitionedpublic void repartition()
PartitionRepository
repartition
in interface PartitionRepository<T extends Entity>
protected java.lang.Boolean entityExists_PossiblyInWrongPartition(T entity)
public java.util.Map<Specification<? extends T>,PartitionRepository> getPartitions()
PartitionRepository
UnsupportedOperationException
This method applies to this partition only!
getPartitions
in interface PartitionRepository<T extends Entity>
PartitionRepository
onlypublic java.util.Map<Specification<? extends T>,PartitionRepository> getAllPartitions()
PartitionRepository
UnsupportedOperationException
getAllPartitions
in interface PartitionRepository<T extends Entity>
PartitionRepository
and belowpublic void collectAllPartitions(java.util.Map<Specification<? extends T>,PartitionRepository> partitionMap)
PartitionRepository
UnsupportedOperationException
collectAllPartitions
in interface PartitionRepository<T extends Entity>
partitionMap
- the index->partition mappublic <R extends Repository> void collectAllPartitionsWithRepositorySatisfying(Specification<R> specification, java.util.Map<Specification<? extends T>,PartitionRepository> partitionMap)
PartitionRepository
UnsupportedOperationException
collectAllPartitionsWithRepositorySatisfying
in interface PartitionRepository<T extends Entity>
specification
- the specification to satisfy to be included in result mappartitionMap
- the index->partition mappublic <V extends T> PartitionRepository findPartitionFor(Specification<V> partitionSpecification)
findPartitionFor
in interface PartitionRepository<T extends Entity>
partitionSpecification
- sub-partition specification
public java.util.Set<T> getPartitionOnlyEntities()
PartitionRepository
getPartitionOnlyEntities
in interface PartitionRepository<T extends Entity>
protected <V extends T> void removePartitionOnlyEntity(V entity)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |