In memory POJO based primary and secondary indices
Java
Switch branches/tags
Nothing to show
Latest commit 6294d14 Feb 13, 2012 kalle 0.2.3
removed use of java.io.Externalizable
fixed versions in pom
Permalink
Failed to load latest commit information.
annotations
core
exampledomain
extra
README
pom.xml

README

POJO entity store, intended for use with Prevayler.

POJOs does not have to aware of their own identity.

POJOs are added to the primary index of all super classes and super interfaces,
making it possible to iterate and access all instances of a certain type.

There is abstract support for secondary indices
implemented using a Map<SecondaryKey, Set<Entity>>,
but could be anything from a iterator to a Lucene index if you want to save RAM.

Annotation at field level using UML class diagram semantics is used
to de/couple associations etc when POJOs are updated in the entity store.


The most abstract version of this API looks something like this:

class EntityStore {
  PrimaryIndex<IdentityType, EntityType> getPrimaryIndex(Class<IdentityType> identityType, Class<EntityType> entityType);
}

class PrimaryIndex<IdentityType, EntityType> implements Iterable<EntityType> {
  SecondaryIndex getSecondaryIndex(String name);
  EntityType put(IdentityType identity, EntityType entity);
  EntityType get(IdentityType identity);
  EntityType remove(IdentityType identity);
}

class SecondaryIndex<ResultType, IdentityType, EntityType> {
  ResultType get(Object... parameters);
  Set<ResultType> list(Object... parameters);
}


Caveat emptor:
* Identities must be unique within the application, eg a UUID. (Comes with DeterministicUIDHandler)
* Secondary indices will not be updated unless you re-put the entity in the store or rebuild the secondary index.
* Identities must be set before putting an entity to the store.



There is virtually no documentation but a bit of unit tests:

http://github.com/karlwettin/kodapan-entity-store/blob/master/src/test/java/se/kodapan/index/TestEntityStore.java

The test domain model can be viewed as UML class diagram here:

http://github.com/karlwettin/kodapan-entity-store/raw/master/src/test/java/se/kodapan/index/domain/doc-files/classdiagram.pdf




This depends on maven project kodapan-common <http://github.com/karlwettin/kodapan-common> for annotations, reflection and collections. mvn install.


karl.wettin@gmail.com