[jboss-dev-forums] [Design of POJO Server] - Binding the CDI BeanManager into JNDI

pete.muir@jboss.org do-not-reply at jboss.com
Thu Aug 20 18:40:36 EDT 2009


The CDI spec requires us to make the BeanManager available in JNDI at java:comp/BeanManager.

I understand java:comp/ has special meaning, so I'm wondering how best to bind the BeanManager there?

Furthermore, the BeanManager instance to return depends on which module of the application the call is made from. Currently we provide an ObjectFactory in Web Beans, which can locate the application in use, but not the module in use. One way to locate the module, would be for the object factory to request the container, via an SPI, identify which module (or BeanDeploymentArchive in Web Beans parlance) is currently being accessed. For example

interface JndiServices {
  | 
  |    BeanDeploymentArchive getBeanDeploymentArchive(HashTable environment);
  | 
  | }

An alternative approach would be to pass the responsibility for attaching the correct BeanManager to JNDI depending on module. In that case, we would need to add an API like:

interface DeploymentServices {
  | 
  |    BeanManager getBeanManager(BeanDeploymentArchive bda);
  | }

which the container could query. We would require that, for each BeanDeploymentArchive, java:comp/BeanManager is made available, with the return value specified by DeploymentServices. 

I also believe an API like this would be useful in general.

I favor the latter approach (I'll code this up tomorrow), but what do our JNDI experts think?

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4250766#4250766

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4250766



More information about the jboss-dev-forums mailing list