net.sourceforge.domian.repository
Class NotImplementedRepository<T extends Entity>

java.lang.Object
  extended by net.sourceforge.domian.repository.AbstractRepository<T>
      extended by net.sourceforge.domian.repository.AbstractDomianCoreRepository<T>
          extended by net.sourceforge.domian.repository.NotImplementedRepository<T>
All Implemented Interfaces:
FakeRepository<T>, Repository<T>

public class NotImplementedRepository<T extends Entity>
extends AbstractDomianCoreRepository<T>
implements FakeRepository<T>

Repository to be used if a Repository implementation is expected, but not yet in place.

This repository is also suitable as a dummy object. (A dummy object is a test double. For instance, when a non-null Repository object is necessary in some test method, and that object is never invoked; then a dummy object is appropriate.)

Since:
0.4
Author:
Eirik Torske

Field Summary
 
Fields inherited from class net.sourceforge.domian.repository.AbstractDomianCoreRepository
DEFAULT_DOMIAN_ROOT_DIR_NAME, DEFAULT_DOMIAN_ROOT_PATH, log, synchronizer
 
Fields inherited from class net.sourceforge.domian.repository.AbstractRepository
supportsRecursiveIndexing, usesNativePartitioningSupport
 
Constructor Summary
NotImplementedRepository()
           
 
Method Summary
<V extends T>
java.util.Collection<V>
findAllEntitiesSpecifiedBy(Specification<V> specification)
          Finds and returns all entities approved by the given specification.
<V extends T>
java.util.Iterator<V>
iterateAllEntitiesSpecifiedBy(Specification<V> specification)
          Finds and returns all entities approved by the given specification.
<V extends T>
void
put(V entity)
          Puts the given entity into this repository.
<V extends T>
java.lang.Boolean
remove(V entity)
          Removes the given entity from this repository.
<V extends T>
java.lang.Long
removeAllEntitiesSpecifiedBy(Specification<V> specification)
          Removes all entities approved by the given specification.
<V extends T>
void
update(V entity)
          Updates an entity.
 
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, findSingleEntitySpecifiedBy, isIndexingEntitiesRecursively, isPartitioningNatively, 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, findSingleEntitySpecifiedBy, isIndexingEntitiesRecursively, isPartitioningNatively, iterate, iterateAll, makePartition, putAll, remove, removeAll, update
 

Constructor Detail

NotImplementedRepository

public NotImplementedRepository()
Method Detail

iterateAllEntitiesSpecifiedBy

public <V extends T> java.util.Iterator<V> iterateAllEntitiesSpecifiedBy(Specification<V> specification)
Description copied from interface: Repository
Finds and returns all entities approved by the given specification. An iterator is returned for lazy retrieval of the entities.

Specified by:
iterateAllEntitiesSpecifiedBy in interface Repository<T extends Entity>
Parameters:
specification - the entity specification
Returns:
an iterator with all entities approved by the specification argument

findAllEntitiesSpecifiedBy

public <V extends T> java.util.Collection<V> findAllEntitiesSpecifiedBy(Specification<V> specification)
Description copied from interface: Repository
Finds and returns all entities approved by the given specification.

Specified by:
findAllEntitiesSpecifiedBy in interface Repository<T extends Entity>
Parameters:
specification - the entity specification
Returns:
a collection of all entities approved by the specification argument, or an empty set if no entities are found and approved

put

public <V extends T> void put(V entity)
Description copied from interface: Repository
Puts the given entity into this repository.

Specified by:
put in interface Repository<T extends Entity>
Parameters:
entity - the entity to be stored

update

public <V extends T> void update(V entity)
Description copied from interface: Repository
Updates an entity. When an entity is (re)-retrieved, all state changes will be visible, no matter what kinds of repository implementations being involved. Do notice that for all memory-based repositories (and possibly some delegated ones), entity updates are of course immediately visible.

(Only applicable for persistent repositories doing explicit data writes, like 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.

Specified by:
update in interface Repository<T extends Entity>

removeAllEntitiesSpecifiedBy

public <V extends T> java.lang.Long removeAllEntitiesSpecifiedBy(Specification<V> specification)
Description copied from interface: Repository
Removes all entities approved by the given specification.

Specified by:
removeAllEntitiesSpecifiedBy in interface Repository<T extends Entity>
Parameters:
specification - the entity specification
Returns:
the number of removed entities

remove

public <V extends T> java.lang.Boolean remove(V entity)
Description copied from interface: Repository
Removes the given entity from this repository.

Specified by:
remove in interface Repository<T extends Entity>
Parameters:
entity - the entity to be removed
Returns:
true if the entity is found and removed, otherwise false


Copyright © 2006-2010. All Rights Reserved.