net.sourceforge.domian.repository
Interface PersistentRepository<T extends Entity>

All Superinterfaces:
Repository<T>
All Known Subinterfaces:
BinaryFormatRepository<T>, HumanReadableFormatRepository<T>, TextualFormatRepository<T>
All Known Implementing Classes:
HibernateRepository, InMemoryAndXStreamXmlFileRepository, PartitionRepositoryInvocationHandler, PartitionRepositoryReuseInvocationHandler, XStreamXmlFilePerEntityRepository

public interface PersistentRepository<T extends Entity>
extends Repository<T>

Repository with the capabibility of writing (persist) its entities to some sort of non-volatile storage. Next, the repository can (re-)read (load) the persisted entities (back) into memory.

Each of the PersistentRepository implementations have a PersistenceDefinition attached, defining semantics around (persist)/(load), and the level of coupling between the entities and the persistent store.

Since:
0.4
Author:
Eirik Torske

Method Summary
 void close()
          Closes the repository and releases all resources.
 java.lang.String getFormat()
           
 EntityMetaData getMetaDataFor(T entity)
           
 PersistenceDefinition getPersistenceDefinition()
           
 java.io.File getRepositoryDirectory()
          The unique file directory in which the repository data files resides.
 java.lang.String getRepositoryId()
          The repository-ID the name of the repository.
 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.
 
Methods inherited from interface net.sourceforge.domian.repository.Repository
count, countAll, countAllEntitiesSpecifiedBy, find, findAll, findAllEntitiesSpecifiedBy, findSingle, findSingleEntitySpecifiedBy, isIndexingEntitiesRecursively, isPartitioningNatively, iterate, iterateAll, iterateAllEntitiesSpecifiedBy, makePartition, put, putAll, remove, remove, removeAll, removeAllEntitiesSpecifiedBy, update, update
 

Method Detail

getRepositoryDirectory

java.io.File getRepositoryDirectory()
The unique file directory in which the repository data files resides.

Returns:
the repository directory, if applicable
Throws:
java.lang.UnsupportedOperationException - if not applicable

getRepositoryId

java.lang.String getRepositoryId()
The repository-ID the name of the repository. It should be unique within a running system.

For file-based repositories, the repository-ID should constitute the last directory element of the repository directory.

Returns:
the repository id

getPersistenceDefinition

PersistenceDefinition getPersistenceDefinition()

getFormat

java.lang.String getFormat()

load

void load()
The semantics of this operation depends on the Repository's PersistenceDefinition.


persist

void persist()
The semantics of this operation depends on the Repository's PersistenceDefinition.


getMetaDataFor

EntityMetaData getMetaDataFor(T entity)
Returns:
persistence meta data for given entity

close

void close()
Closes the repository and releases all resources.

This method is redundant for certain repository implementations, but by using this method in a consistent manner, an eventual repository migration will not need any code changes.



Copyright © 2006-2010. All Rights Reserved.