net.sourceforge.domian.repository
Class XStreamXmlFilePerEntityRepository<T extends Entity>
java.lang.Object
net.sourceforge.domian.repository.AbstractRepository<T>
net.sourceforge.domian.repository.AbstractDomianCoreRepository<T>
net.sourceforge.domian.repository.AbstractXStreamXmlFileRepository<T>
net.sourceforge.domian.repository.AbstractXStreamXmlFilePerEntityRepository<T>
net.sourceforge.domian.repository.XStreamXmlFilePerEntityRepository<T>
- All Implemented Interfaces:
- HumanReadableFormatRepository<T>, PersistentRepository<T>, Repository<T>, TextualFormatRepository<T>
public class XStreamXmlFilePerEntityRepository<T extends Entity>
- extends AbstractXStreamXmlFilePerEntityRepository<T>
A persistent repository backed by XStream functionality.
The only persistence definition supported by this repository is PersistenceDefinition.FILE
.
All repository operations are executed in an exclusive fashion, applying pessimistic locking.
Translated into ACID terms, this corresponds to isolation level SERIALIZABLE
.
All entities in this repository are persisted into individual XML files.
The typical disc footprint is 1KB per entity.
The persistence format is human readable XStream XML.
The file encoding is UTF-8.
File-based stores counts as persistent storage media,
although the nature of the synchronous writings to disc obviously depends on the file system implementations involved.
NB! When used as a partition repository, this repository implementation does not reflect altered state between partitions.
When changing state in entities residing in more han one partition,
for which at least one of them is a XStreamXmlFilePerEntityRepository
,
explicit updates for all partitions involved are needed.
- Since:
- 0.4
- Author:
- Eirik Torske
- See Also:
- XStream,
PersistenceDefinition.FILE
Methods inherited from class net.sourceforge.domian.repository.AbstractXStreamXmlFileRepository |
call, callConcurrently, callConcurrentlyInNewThread, callConcurrentlyWithRetry, callExclusively, callExclusivelyInNewThread, callExclusivelyWithRetry, getEncoding, getMaxNumberOfRetries, getRepositoryDirectory, getRepositoryId, getRepositoryPath, getRepositoryPathString, getRepositoryRootPath, getRetryTimeoutInMilliseconds, run, runAsynchronously, runConcurrently, setMaxNumberOfRetries, setRetryTimeoutInMilliseconds |
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 |
DEFAULT_REPOSITORY_ROOT_DIR_NAME
protected static final java.lang.String DEFAULT_REPOSITORY_ROOT_DIR_NAME
- See Also:
- Constant Field Values
DEFAULT_REPOSITORY_ROOT_PATH
protected static final java.lang.String DEFAULT_REPOSITORY_ROOT_PATH
XStreamXmlFilePerEntityRepository
public XStreamXmlFilePerEntityRepository(java.lang.String repositoryId)
XStreamXmlFilePerEntityRepository
public XStreamXmlFilePerEntityRepository(java.lang.String repositoryId,
Synchronizer synchronizer)
XStreamXmlFilePerEntityRepository
public XStreamXmlFilePerEntityRepository(java.lang.String repositoryRootPath,
java.lang.String repositoryId)
XStreamXmlFilePerEntityRepository
public XStreamXmlFilePerEntityRepository(java.lang.String repositoryRootPath,
java.lang.String repositoryId,
Synchronizer synchronizer)
countAllEntities
public java.lang.Long countAllEntities()
- Returns:
- the total number of entities residing in this particular repository (partition)
iterateAllEntitiesSpecifiedBy
public <V extends T> java.util.Iterator<V> iterateAllEntitiesSpecifiedBy(Specification<V> specification)
findAllEntitiesSpecifiedBy
public <V extends T> java.util.Collection<V> findAllEntitiesSpecifiedBy(Specification<V> specification)
put
public <V extends T> void put(V entity)
removeAllEntitiesSpecifiedBy
public <V extends T> java.lang.Long removeAllEntitiesSpecifiedBy(Specification<V> specification)
remove
public <V extends T> java.lang.Boolean remove(V entity)
getPersistenceDefinition
public PersistenceDefinition getPersistenceDefinition()
getFormat
public java.lang.String getFormat()
load
public void load()
persist
public void persist()
update
public <V extends T> void update(V entity)
getMetaDataFor
public EntityMetaData getMetaDataFor(T entity)
close
public void close()
Copyright © 2008-2010. All Rights Reserved.