2 Replies Latest reply on Nov 23, 2008 11:06 PM by Andrew Rubinger

    Accessing EJB metadata for Web Beans

    Pete Muir Master

      http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4189390#4189390

      Web Beans requires the container to provide information about the EJBs inside an application. My proposed SPI for discovering this info from from WB is

      /**
       * @return A Map of EJB descriptors, keyed by the EJB name
       */
       public Map<String, EjbDescriptor<?>> discoverEjbs();


      ublic interface EjbDescriptor<T>
      {
       /**
       * @return The EJB Bean class
       */
       public Class<T> getType();
      
       /**
       * @return The JNDI name under which the EJB is registered
       */
       public String getJndiName();
      
       /**
       * @return The local interfaces of the EJB
       */
       public Iterator<Class<?>> getLocalInterfaces();
      
       /**
       * @return The remove methods of the EJB
       */
       public Iterator<Method> getRemoveMethods();
      
      }


      I'm quite happy to alter the SPI to make implementation easier, but you can at least see the intent of the SPI :-)

      How do we go about implementing such an SPI for JBoss 5? Inside the webbeans-ri-int project in the jbossas source tree we have access to the full range of MC connectors.

        • 1. Re: Accessing EJB metadata for Web Beans
          Andrew Rubinger Master

           

          "pete.muir@jboss.org" wrote:
          How do we go about implementing such an SPI for JBoss 5? Inside the webbeans-ri-int project in the jbossas source tree we have access to the full range of MC connectors.


          So long as EJB3 can bring in webbeans-ri-int without introducing a cyclic dependency, the SPI can go there and be implemented by us.

          Currently this type of logic lives in an internal registry within AS's "server" module, MappedReferenceMetadataResolverDeployer. Probably on Container start() we can pass the metadata along to an MC Bean which in turn can track the registrations.

          Related to this is the issue of making a pluggable resolver for @EJB, which I believe Carlo had either started or has thought about. It's the same mechanism I want to use for MC Integration (@EJB injection into MC Beans).

          S,
          ALR

          • 2. Re: Accessing EJB metadata for Web Beans
            Andrew Rubinger Master

            We'll go into the details as we implement, but wanted to note that we'll need:

            public String getJndiName(String businessInterfaceName);


            ...as JNDI names are specific to a target business interface to be able to support SessionContext.getInvokedBusinessInterface();

            S,
            ALR