On Tuesday, Sep 9, 2003, at 13:38 Europe/London, Aaron Mulder wrote:

On Tue, 9 Sep 2003, Alex Blewitt wrote:
...
I don't see the rationale for not having an abstract supertype for the
Session/Entity/Message beans. [It may be necessary to also have a
separate supertype for Session/Entity as well, since there are such
issues with the way in which the various Contexts work.]

You can't have it both ways:

j2ee.ejb.Session extends j2ee.ejb.EJB
geronimo.ejb.EJB extends j2ee.ejb.EJB
geronimo.ejb.Session extends (j2ee.ejb.Session and geronimo.ejb.EJB???)

I think perhaps I should have been clearer in the message; I had suggested that we use an EJB super-interface to mean both the geronimo-specific and j2ee neutral. That way, you can have two separate hierarchies be used to represent implementation, whilst still maintaining the type hierarchy on the top.


The rationale for not having geronimo.ejb.EJB (the abstract
supertype for Session/Entity/Message beans) is that geronimo.ejb.Session
can't extend it!

Why should session not be able to extend it? I don't understand:

public interface EJB
public interface EntityBean extends EJB
public interface SessionBean extends EJB
public interface MessageDrivenBean extends EJB

public class J2EEEJB implements EJB
public class J2EEEntityBean extends J2EEEJB implements EntityBean
public class J2EESessionBean extends J2EEEJB implements SessionBean
public class J2EEMessagDrivenBean extends J2EEEJB implements MessageDrivenBean


public class GeronimoEJB implements EJB
public class GeronimoEntityBean extends GeronimoEJB implements EntityBean
public class GeronimoSessionBean extends GeronimoEJB implements SessionBean
public class GeronimoMessageDrivenBean extends GeronimoEJB implements MessageDrivenBean


and the GeronimoEJB has a 'to one' relationship with J2EEEJB.

So, it's possible to insert another interface/set of types 'EntityAndSessionBean' above; one more interface and two more classes:

public interface EntityAndSession
public class J2EEEntityAndSession extends J2EEEJB
public class GeronimoEntityAndSession extends GeronimoEJB

and change the 'extends GeronimoEJB' to 'extends GeronimoEntityAndSession' for session/entities (and similarly for J2EE).


That's why Greg is proposing that everything in J2EE land should
turn into interfaces, but I continue to object to having all the
implementation in the Geronimo objects only, especially since you STILL
can't avoid duplicating code.

I agree that there should be interfaces (hence above).

I also agree that the code shouldn't be in one place; it should be split across the two hierarchies. The J2EE stuff should have the vendor-neutral representation, the rest should go into the Geronimo representation. And you can still achieve the transparent connection by providing delegate methods from the Geronimo stuff to the J2EE stuff.

If the above types don't gel, I can knock up a skeletal code example for how to represent it, but my thoughts are that the representation should be in a pair of POJOs, not just a single one.

Alex.



Reply via email to