SRJRCFrames
v0.1.296

de.schwarzrot.data.access
Interface EntityManager

All Known Implementing Classes:
AbstractEntityManager, JDBCEntityManager, NullEntityManager, PreferencesEntityManager

public interface EntityManager

is a manger to handle retrieval, saving and removal of entities to/from persistence.

The EntityManager is not intended for direct application usage. Use ApplicationTransactions, which will use internal Repository.

An EntityManager get's injected into repository by application-context.

Each EntityManager is related to a Class it works on. The EntityManager should also be able to handle all subclasses of that Class.

Author:
Reinhard Mantey
See Also:
Repository

Method Summary
 void commit(TransactionResource<?> resource)
          used to persist all changes made during transaction.
 TransactionResource<?> createTransactionResource(Transaction t)
          create an abstract handle to storage.
 void dumpTypeCache()
          for debugging purpose only.
 void execute(TransactionalOperation<?> tao)
          execute a single step of ApplicationTransaction
 String getApplicationName()
          returns the name of the application
 EntityDescriptor getEntityDescriptor(Class<?> entityType, TransactionResource<?> res)
          accessor to description instances of entities.
 String getSchemaName(Class<?> entityType, TransactionResource<?> resource)
          returns the schema name, used by entities of given type and given storage
 void releaseTransactionResource(TransactionResource<?> resource)
          free given storage handle
 void rollback(TransactionResource<?> handle)
          discards changes of given storage handle and marks Transaction as failed.
 void setEntityCache(EntityHolder eh)
          sets the cache for entity instances
 void setEntityIntrospector(EntityIntrospector entityIntrospector)
          sets the entity introspector used to fill an EntityDescriptor with informations about entities.
 void setSchemaName(Class<?> entityType, String schema, TransactionResource<?> resource)
          sets the schema name to use by instances of given entity and resource
 void setUserNameProvider(UserNameProvider unp)
          sets the username provider used by this EntityManager
 

Method Detail

commit

void commit(TransactionResource<?> resource)
            throws Exception
used to persist all changes made during transaction.

Parameters:
resource - - an abstract handle to storage
Throws:
Exception - - depends on implementation

createTransactionResource

TransactionResource<?> createTransactionResource(Transaction t)
                                                 throws Exception
create an abstract handle to storage. TransactionResource is a wrapper to handle jdbc and preferences the same way.

Parameters:
t - - the transaction
Returns:
- a wrapped storage handle
Throws:
Exception - - depends on implementation

dumpTypeCache

void dumpTypeCache()
for debugging purpose only. Dumps out all known entities of that EntityManager.


execute

void execute(TransactionalOperation<?> tao)
             throws Exception
execute a single step of ApplicationTransaction

Parameters:
tao - - the transactional operation to execute
Throws:
Exception - - depends on implementation

getApplicationName

String getApplicationName()
returns the name of the application

Returns:
- the name of the application

getEntityDescriptor

EntityDescriptor getEntityDescriptor(Class<?> entityType,
                                     TransactionResource<?> res)
accessor to description instances of entities. An EntityDescriptor holds all information needed by an EntityManager to handle instances of that entity. The EntityDescriptor may vary between different EntityManager s.

Parameters:
entityType - - the class of that entity
res - - the wrapped storage handle
Returns:
- the descriptor for that entity

getSchemaName

String getSchemaName(Class<?> entityType,
                     TransactionResource<?> resource)
returns the schema name, used by entities of given type and given storage

Parameters:
entityType - - the class of entity
resource - - the wrapped storage handle
Returns:
- the schema name to use

releaseTransactionResource

void releaseTransactionResource(TransactionResource<?> resource)
free given storage handle

Parameters:
resource - - a wrapped storage handle

rollback

void rollback(TransactionResource<?> handle)
discards changes of given storage handle and marks Transaction as failed.

Parameters:
handle - - a wrapped storage handle

setEntityCache

void setEntityCache(EntityHolder eh)
sets the cache for entity instances

Parameters:
eh - - the cache handler

setEntityIntrospector

void setEntityIntrospector(EntityIntrospector entityIntrospector)
sets the entity introspector used to fill an EntityDescriptor with informations about entities.

Parameters:
entityIntrospector - - the introspector to use

setSchemaName

void setSchemaName(Class<?> entityType,
                   String schema,
                   TransactionResource<?> resource)
sets the schema name to use by instances of given entity and resource

Parameters:
entityType - - class of entity
schema - - the schema name
resource - - a wrapped storage handle

setUserNameProvider

void setUserNameProvider(UserNameProvider unp)
sets the username provider used by this EntityManager

Parameters:
unp - - the username provider to use

SRJRCFrames
v0.1.296

hosted at
Find SRJRCFrames at SourceForge.net. Fast, secure and free:
           Open Source Software download
Submit a bug or request a feature

SRJRCFrames is published according to the GNU General Public License
Copyright 2005-2012 Reinhard Mantey - some rights reserved.