gotcha, now I understand.  I generally try to avoid putting the EJB
interface in my Action, so I create a Business Delegate (much like what Ted
calls a Facade I believe).  This  business delegate knows about the ejb's
interface, and exposes its own interface.  It then delegates calls to the
underlying service, trapping implementation specific exceptions and wrapping
them in more business related exceptions.   This way I can later decide to
switch from an EJB implementation to some other service (web service, JNI
call, CORBA, etc.), without having to modify the Action class, only the
delegate class gets modified.

> -----Original Message-----
> From: Marco Tedone [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, February 16, 2003 2:12 PM
> To: Struts-user-list
> Subject: RE: Controller - Model design question?
>
>
> Sorry John, I wasn't talking about the implementation details, as
> I will let
> the EJB container to manage the EJBs pool for me; we could
> discuss about the
> way to implement an 'EJB's locator service'; I'm using a Factory and you a
> Singleton. Both work and are independent from the web application. As your
> Action(part of the Controller) will have to deal with the business
> components(just to use it!) my question was:
>
> Is it correct the Action to know about the EJB's interface?
>
> Hope I'll expained myself better than before.
>
> Thank you
>
> -----Original Message-----
> From: John Espey [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, February 16, 2003 4:19 AM
> To: Struts Users Mailing List
> Subject: RE: Controller - Model design question?
>
>
> I'm not sure about your particular requirements, but I personally use a
> singleton ServiceLocator to do EJB home lookups.  Because it is a
> Singleton,
> it is easier to find than the way you've shown, and it can be
> reused outside
> of the web container.
>
> > -----Original Message-----
> > From: Marco Tedone [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, February 15, 2003 4:38 PM
> > To: Struts-user-list
> > Subject: Controller - Model design question?
> >
> >
> > Hi, to implement the business logic of my application I decided to use
> > EJBs. I'm designing a factory which could return an instance of the
> > EJBs interface
> > and I'm thinking to call that factory(implemented as a PlugIn and
> > there set
> > as a ServletContext attribute) from my Actions. This would lead
> the Action
> > to know about the EJBs interface name as part of the notation
> > would be like
> > the following:
> >
> > Factory factory =
> > servlet.getServletContext().getAttribute(org.foo.framework.AppCons
> > tants.EJB_
> > FACTORY_CLASS);
> > EjbInterface bean = factory.getEjbInterface();
> >
> > The question is:
> >
> > Is it correct the Action to know about the Model interfaces?
> >
> > Regards,
> >
> > Marco
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to