0 Replies Latest reply on Feb 12, 2004 1:32 PM by adrianc

    Mixing concrete classes and EJB interfaces

    adrianc Newbie

      This is a generic EJB question - not JBoss specific. I've posted this question in Sun's forums, but I haven't received any replies.

      I'm trying to define a non-ejb interface that I would like to 'overlay' or override with methods from an ejb interface. The non-ejb interface has a superset of the ejb's methods, and both interfaces share (or duplicate) some methods.

      What I'm trying to accomplish: I'd like to write a concrete class that implements the non-ejb interface, then be able to subclass that concrete class and implement the ejb interface. The reason I'm trying to do this is because I'm developing a standalone remote client whose base classes can optionally offload some tasks to an app server.


      public interface foo
      public void Method_A();
      public void Method_B();
      public void Method_C();
      public void Method_D();

      public interface ejb_foo extends EJBObject
      public void Method_B() throws RemoteException;
      public void Method_C() throws RemoteException;

      public class foo_bar implements foo
      public void Method_A(){...};
      public void Method_B(){...};
      public void Method_C(){...};
      public void Method_D(){...};

      public class ejb_foo_bar extends foo_bar implements ejb_foo

      My goal with ejb_foo_bar is to have Method_A and Method_D call the concrete super class, and have Method_B and Method_C call the ejb.

      Is there a way I can make something like this work? I'm aware that I can just make an instance of the ejb within ejb_foo_bar then override the duplicate methods to call the ejb's methods. I'm just wondering if there is a 'cleaner' way to do it.

      Thanks in advance for your help!