8 Replies Latest reply on Oct 10, 2007 3:27 PM by alrubinger

    The default local interface (vs. EJBTHREE-785)

    wolfc

      With the implementation of EJBTHREE-785 we consider all interfaces implemented by the bean and it's super classes to be a candidate for remote or local business interface. This leads to problems in establishing the default local business interface.

      "EJB 3 4.6.6" wrote:
      * If bean class implements a single interface, that interface is assumed to be the business interface of the bean. This business interface will be a local interface unless the interface is designated as a remote business interface by use of the Remote annotation on the bean class or interface or by means of the deployment descriptor.
      * A bean class is permitted to have more than one interface. If a bean class has more than one interface excluding the interfaces listed below any business interface of the bean class must be explicitly designated as a business interface of the bean by means of the Local or Remote annotation on the bean class or interface or in the deployment descriptor.

      The second line allows for the inheritance of interfaces from a super (sort of). But the first specifies that if the bean itself implements one interface it must be the business interface (either remote or local). So any inherited interfaces become invalid at that point.
      If there are no objections, we'll implement it by the letter.

      http://jira.jboss.com/jira/browse/EJBTHREE-785

        • 1. Re: The default local interface (vs. EJBTHREE-785)
          bill.burke

          The letter of the law is, if the bean's implementation does not match the default pattern (implements one interface that isn't declared remote or local), then you must be explicit on what the Remote and/or local interface is. Its pretty simple and clear to me.

          • 2. Re: The default local interface (vs. EJBTHREE-785)
            wolfc

            The failing scenario is:

            @Stateless class MyBean extends SuperBean implements SomeInterface {}
            
            interface SomeInterface {}
            
            class SuperBean implements RemoteInterface {}
            
            @Remote interface RemoteInterface {}

            If I follow the letter than SomeInterface will become the only business interface (local).
            If I follow EJBTHREE-785 than RemoteInterface will become the only business interface (remote).

            I think we can get away with the following:
            * If the bean class has no interface (including interfaces from superclasses) explicitly declared as a business interface and the bean class implements a single interface, than that interface is assumed to be the local business interface of the bean.

            • 3. Re: The default local interface (vs. EJBTHREE-785)
              wolfc

              Or even better:
              * If bean class implements a single interface, that interface is assumed to be a business interface of the bean. This business interface will be a local interface unless the interface is designated as a remote business interface by use of the Remote annotation on the bean class or interface or by means of the deployment descriptor.

              • 4. Re: The default local interface (vs. EJBTHREE-785)
                wolfc
                • 5. Re: The default local interface (vs. EJBTHREE-785)
                  bill.burke

                   

                  "wolfc" wrote:
                  The failing scenario is:
                  @Stateless class MyBean extends SuperBean implements SomeInterface {}
                  
                  interface SomeInterface {}
                  
                  class SuperBean implements RemoteInterface {}
                  
                  @Remote interface RemoteInterface {}

                  If I follow the letter than SomeInterface will become the only business interface (local).


                  The spec says nothing about inheritance of interfaces.


                  If I follow EJBTHREE-785 than RemoteInterface will become the only business interface (remote).


                  Nope, just read EJBTHREE_785. What Gavin wants is this:

                  public class MyBean implements MyRemote {}
                  
                  @Stateless
                  public class SubBean extends MyBean {}
                  


                  Business interface of SubBean has a remote interface of MyRemote.



                  • 6. Re: The default local interface (vs. EJBTHREE-785)
                    bill.burke

                     

                    "wolfc" wrote:
                    Another failing scenario: http://jira.jboss.com/jira/browse/EJBTHREE-1062


                    Which is still different than the example you gave.

                    • 7. Re: The default local interface (vs. EJBTHREE-785)
                      wolfc

                       

                      "bill.burke@jboss.com" wrote:

                      The spec says nothing about inheritance of interfaces.

                      "EJB 3 4.6.2" wrote:
                      The session bean class may have superclasses and/or superinterfaces. If the session bean has superclasses, the business methods, lifecycle callback interceptor methods, the timeout callback method, the methods of the optional SessionSynchronization interface, the Init or ejbCreate<METHOD> methods, the Remove methods, and the methods of the SessionBean interface, may be de?ned in the session bean class, or in any of its superclasses. A session bean class must not have a superclass that is itself a session bean class.

                      Combined with 4.6.6 doesn't really allow for business interfaces to be defined by a superclass, but the water gets real murky. So I let EJBTHREE-785 pass.
                      "bill.burke@jboss.com" wrote:

                      Nope, just read EJBTHREE_785. What Gavin wants is this:

                      public class MyBean implements MyRemote {}
                      
                      @Stateless
                      public class SubBean extends MyBean {}
                      

                      Business interface of SubBean has a remote interface of MyRemote.

                      That's exactly what is working. It's EJBTHREE-1062 that has stopped working and the first scenario I sketched is an expectancy problem.
                      So we need to choice either option A or B.
                      I like A in the sense that it's closer to the spec and thus easier on the TCK. I like B because it is more closely aligned with EJBTHREE-785. It all depends on what you would expect to happen in the 'outside the box' scenarios. I need a definitive statement to bring it into the box.

                      • 8. Re: The default local interface (vs. EJBTHREE-785)
                        alrubinger

                         

                        "wolfc" wrote:
                        Or even better:
                        * If bean class implements a single interface, that interface is assumed to be a business interface of the bean. This business interface will be a local interface unless the interface is designated as a remote business interface by use of the Remote annotation on the bean class or interface or by means of the deployment descriptor.


                        I think this is the correct case.

                        "wolfc" wrote:

                        The failing scenario is:
                        @Stateless class MyBean extends SuperBean implements SomeInterface {}
                        
                        interface SomeInterface {}
                        
                        class SuperBean implements RemoteInterface {}
                        
                        @Remote interface RemoteInterface {}
                        

                        If I follow the letter than SomeInterface will become the only business interface (local).


                        Disagree with the last statement; unclear here whether the spec dictates that "SomeInterface" must be the *only* local business interface:

                        "EJB3 4.6.6" wrote:

                        If bean class implements a single interface, that interface is assumed to be the (local) business interface of the bean.


                        So the question becomes: can we intrepret "the" as "a"?

                        If so, in the case above I'd have "SomeInterface" be exposed as local business, as well as "RemoteInterface" as remote business.

                        S,
                        ALR