|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.elca.el4j.services.persistence.generic.dao.impl.DefaultDaoRegistry
public class DefaultDaoRegistry
A DaoRegistry where DAOs can be registered either explicitly
(via its map configuration) or implicitly
(by collecting all beans that have the GenericDao interface).
This can be used together with
| Field Summary | |
|---|---|
protected ApplicationContext |
m_applicationContext
The application context. |
protected boolean |
m_applicationContextIsReady
Is Spring context completely initialized? |
protected Map<Class<?>,GenericDao<?>> |
m_beanClassDaos
The map containing the registered DAOs with the bean class as key. |
protected boolean |
m_collectDaos
Whether to collect DAOs automatically. |
protected long |
m_creatorThreadId
The thread ID of the thread that set the application context (in general the thread that created this object). |
protected Map<Class<?>,GenericDao<?>> |
m_daoClassDaos
The map containing the registered DAOs with the dao class as key. |
protected String |
m_daoNamePattern
The dao matching pattern. |
protected boolean |
m_initialized
Was initDaosFromSpringBeans already called? |
| Constructor Summary | |
|---|---|
DefaultDaoRegistry()
|
|
| Method Summary | ||
|---|---|---|
|
getDao(Class<T> doaType)
Returns the DAO of a given type. |
|
Map<Class<?>,? extends GenericDao<?>> |
getDaos()
|
|
|
getFor(Class<T> entityType)
Returns the generic DAO for entities of type entityType. |
|
protected void |
initDao(GenericDao<?> dao)
This method can be overridden by child classes to initialize all DAOs even further. |
|
protected void |
initDaosFromSpringBeans()
Load all GenericDaos from this spring bean's bean factory. |
|
boolean |
isCollectDaos()
See setCollectDaos. |
|
void |
onContextRefreshed()
Executed when ModuleApplicationContext is completely refreshed. |
|
void |
setApplicationContext(ApplicationContext applicationContext)
|
|
void |
setCollectDaos(boolean collectDaos)
By default we automatically collect here all generic DAOs from the spring application context (all DAOs that implement the GenericDao interface). |
|
void |
setDaos(Map<Class<?>,GenericDao<?>> daos)
|
|
void |
setNamePattern(String namePattern)
Set a new DAO name pattern. |
|
void |
waitUntilApplicationContextIsReady()
Check if Spring context is completely initialized and wait if we are in multi-threaded environment. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean m_collectDaos
protected Map<Class<?>,GenericDao<?>> m_beanClassDaos
protected Map<Class<?>,GenericDao<?>> m_daoClassDaos
protected ApplicationContext m_applicationContext
protected String m_daoNamePattern
protected boolean m_initialized
initDaosFromSpringBeans already called?
protected long m_creatorThreadId
protected volatile boolean m_applicationContextIsReady
| Constructor Detail |
|---|
public DefaultDaoRegistry()
| Method Detail |
|---|
public void onContextRefreshed()
ModuleApplicationContext is completely refreshed.
onContextRefreshed in interface ModuleApplicationListenerpublic void waitUntilApplicationContextIsReady()
public <T> GenericDao<T> getFor(Class<T> entityType)
entityType.
getFor in interface DaoRegistryT - The domain class type.entityType - The domain class for which a generic DAO should be returned.
The class does some basic handling to tolerate (i.e. unwrap)
Spring proxies.
public <T> T getDao(Class<T> doaType)
getDao in interface DaoRegistryT - The DOA class type.doaType - The DAO class type for which the DAO should be returned.
public void setNamePattern(String namePattern)
"*" which matches all DAOs.
namePattern - The name pattern to set.protected void initDaosFromSpringBeans()
protected void initDao(GenericDao<?> dao)
dao - The dao to initialize.public Map<Class<?>,? extends GenericDao<?>> getDaos()
getDaos in interface DaoRegistrypublic void setDaos(Map<Class<?>,GenericDao<?>> daos)
daos - Registers the DAOs.public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext in interface ApplicationContextAwareBeansExceptionpublic boolean isCollectDaos()
setCollectDaos.
public void setCollectDaos(boolean collectDaos)
collectDaos - The new value for collecting daos.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||