private EntityContainer createEntityContainer(BeanMetaData bean, DeploymentUnit unit) throws Exception
{
// get the container configuration for this bean
// a default configuration is now always provided
ConfigurationMetaData conf = bean.getContainerConfiguration();
// Create container
EntityContainer container = new EntityContainer();
int transType = CMT;
initializeContainer(container, conf, bean, transType, unit);
if (bean.getHome() != null)
{
createProxyFactories(bean, container);
}
ClassLoader cl = unit.getClassLoader();
container.setInstanceCache(createInstanceCache(conf, cl));
container.setInstancePool(createInstancePool(conf, cl));
// Set the bean Lock Manager
boolean reentrant = ((EntityMetaData) bean).isReentrant();
BeanLockManager lockMgr = createBeanLockManager(container, reentrant, conf.getLockClass(), cl);
container.setLockManager(lockMgr);
// Set persistence manager
if (((EntityMetaData) bean).isBMP())
{
Class pmClass = cl.loadClass(conf.getPersistenceManager());
EntityPersistenceManager pm = (EntityPersistenceManager) pmClass.newInstance();
container.setPersistenceManager(pm);
}
else
{
// CMP takes a manager and a store
org.jboss.ejb.plugins.CMPPersistenceManager persistenceManager = new org.jboss.ejb.plugins.CMPPersistenceManager();
// Load the store from configuration
Class pmClass = cl.loadClass(conf.getPersistenceManager());
EntityPersistenceStore pm = (EntityPersistenceStore) pmClass.newInstance();
persistenceManager.setPersistenceStore(pm);
// Set the manager on the container
container.setPersistenceManager(persistenceManager);
}