JBoss Community

Re: EJBTHREE-2198 EJB resource providers for switchboard and the dependency issues

created by jaikiran pai in EJB3 Development - View the full discussion

Ales Justin wrote:

 


How do I get a hold of this EJBContainer?

Afais, this is a MC bean under the JBossEnterpriseBeanMetaData::getContainerName?

That's correct.

 

 

Ales Justin wrote:

 

2) for @Singleton container it in done in SingletonBeanJNDIBinderDeployer in jboss-ejb3-singleton project
3) for no-interface views it's done in EJB3NoInterfaceViewDeployer in jboss-ejb3-nointerface project

OK, this two are obviously MC beans. :-)

 

For all 3 "jndi" binders:

a) Which is the code that does the custom JBoss jndi binding?

 

 

 

For no-interface jndi binding, it's the org.jboss.ejb3.nointerface.impl.jndi.NoInterfaceViewJNDIBinderFacade (MC bean) which does this binding.

 

For singletons it's the org.jboss.ejb3.singleton.deployer.JNDIBinderImpl

 

Ales Justin wrote:

 


b) Can it be already used from external bean/resource or does it need to be extracted / refactored?

 

I can determine (b) myself, once I can identify the jndi binding code. ;-)

It's not exposed yet and is internal impl details right now. Extracting/refactoring probably would require more work. I guess the easy way would be to use some specific MC bean name syntax for those binders and let the resource provider assume that syntax. For example:

 

LegacyMCBeanNameSupplier (or whatever we call that):

 

Set<String> getBinderDepencies(DeploymentUnit unit, JBossEnterpriseBeanMetaData metadata)
{
    Set<String> dependencies = new HashSet<String>();
    
    // for singleton
    if (metadata.isSession() && metadata.issingleton())
    {
        // add the binder, responsible for singleton view bindings, to the dependencies
        // The MC bean name is assumed to be of the following syntax:
        // jboss-ejb3-singleton-jndi-binder:appName=blah,module=blah,bean=beanName
        dependencies.add("jboss-ejb3-singleton-jndi-binder:appName=myapp,module=myapp,bean=blahblah");
    }    
 
    // for nointerface view
    if (metadata.exposesNoInterfaceView)
    {
        // add the binder, responsible for no-interface view bindings, to the dependencies
        // The MC bean name is assumed to be of the following syntax:
        // jboss-ejb3-nointerface-jndi-binder:appName=blah,module=blah,bean=beanName
        dependencies.add("jboss-ejb3-nointerface-jndi-binder:appName=myapp,module=myapp,bean=blahblah");
    }
    
    // for SLSB and SFSB
    if (metadata.isslsb || metadata.isSfsb)
    {
        // add legacy container MC bean as dependency
        dependencies.add(metadata.getJBossMetadata().getContainerName());
    }
    
    return dependencies;
}

Reply to this message by going to Community

Start a new discussion in EJB3 Development at Community