geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Blewitt <Alex.Blew...@ioshq.com>
Subject Re: [XML][Deployment]POJO design?
Date Tue, 09 Sep 2003 12:06:40 GMT
On Tuesday, Sep 9, 2003, at 10:56 Europe/London, James Strachan wrote:

> What is the use case for having 'standard' beans separate from 
> geronimo beans - on't we just need Geronimo beans? i.e. it seems very 
> complex to have 2 separate trees of standard J2EE descriptors and 
> another tree of geronimo-extended J2EE descriptor beans. This leads to 
> a messy dual-inheritence hierarchy that Greg's brought up.

I don't think you need to worry about having two separate trees -- it's 
called the Bridge pattern. It's what the GUI AWT toolkit uses to 
present different flavours of widgets depending on OS.

You could set the bridge up so that Geronimo doesn't even have to care 
about what the types are (and/or generate delegation methods to their 
normal counterparts). Plus, it could then be extended to deal with 
other flavours, such as the WebSphere or Weblogic deployment 
descriptors at the same time.

You can also use interfaces to merge the two types where appropriate.

public class SpecEJB implements EJB {
}

public class EJBPeer implements EJB {
   private SpecEJB spec;
   protected EJBPeer(SpecEJB spec) {
     this.spec = spec;
   }
   public SpecEJB getSpec() {
     return spec;
   }
   public String getName() {
     return spec.getName();
   }
}
public class GeronimoEJB extends EJBPeer {
   public GeronimoEJB(SpecEJB spec) {
     super(spec);
   }
   public String getGeronimoSpecificBit() {
   }
}
public class WebSphereEJB extends EJBPeer {
   public WebSphereEJB(SpecEJB spec) {
     super(spec);
   }
   public String getWebSphereSpecificBit() {
   }
}

Code (deployment descriptors) can then use the interface type EJB or 
method calls on the specific part to return the generic bits, and the 
Geronimo stuff separately. You'd probably also use a Visitor to be able 
to generate the appropriate configuration files over a bridge.

> But this is the Geronimo project - so do we need to support both of 
> these things? i.e. can't we just have a simple POJO hierarchy which 
> merges the standard + geronimo POJOs together for simplicity? It'll be 
> much easier, take less code & require much less testing of the 
> marshalling code.

Probably don't need to, no, but a good design will allow for future 
uses (e.g. the deployment code could be used to generate both Geronimo, 
WebSphere and Weblogic descriptors at the same time in much the way 
that XDoclet can) outside of Geronimo.

Alex.


Mime
View raw message