@Override
protected void registerEJBContainer(Container container) throws Exception
{
// Add the jndi supplies
MCDependencyPolicy dependsPolicy = (MCDependencyPolicy) container.getDependencyPolicy();
EJBContainer ejbContainer = (EJBContainer) container;
JBossEnterpriseBeanMetaData beanMD = ejbContainer.getXml();
ContainerDependencyMetaData cdmd = null;
if(endpoints != null)
{
String ejbKey = "ejb/" + jbossUnit.getRelativePath() + "#" + container.getEjbName();
cdmd = endpoints.get(ejbKey);
}
else
{
log.warn(jbossUnit+" has no ContainerDependencyMetaData attachment");
}
if(cdmd != null)
{
for(String jndiName : cdmd.getJndiNames())
{
String supplyName = JNDIKernelRegistryPlugin.JNDI_DEPENDENCY_PREFIX + jndiName;
AbstractSupplyMetaData supply = new AbstractSupplyMetaData(supplyName);
dependsPolicy.getSupplies().add(supply);
}
}
// EJBTHREE-1335: container name in meta data
generateContainerName(container, beanMD);
// setup switchboard
Barrier switchBoard = this.getSwitchBoardBarrier(container);
// the container cannot function without an SwitchBoard Barrier
if (switchBoard == null)
{
throw new RuntimeException("No SwitchBoard Barrier found for bean: " + container.getEjbName() + " in unit: "
+ this.jbossUnit + " (or its component deployment unit)");
}
// add dependency on START (and not INSTALLED) state of Switchboard, since the container only requires a fully populated ENC context,
// but doesn't require a invokable context. An invokable context is only needed by Injector.
dependsPolicy.addDependency(this.createSwitchBoardDependency(ejbContainer, switchBoard));
log.debug("Added dependency on Switchboard " + switchBoard.getId() + " for EJB container " + ejbContainer.getName());
// create and setup Injector(s) for InjectionManager
InjectionManager injectionManager = this.getInjectionManager(container);