Alok_Band wrote:
>Hi Maciek,
>
>Thank for reply. I am an early bird in J2EE patterns. Please clarify my
>doubts.
>
> So what is business delegate about?
> - tt hides from a client all complexity connected with network
>calls,
> i.e. a client invokes some method on a delegate which is a normal
>java
> object, and delegate uses lookup services to find a target session
>facade
>
>Look up services are best addressed by "Service Locator" pattern. Service
>Locator will contain code look up any services(like JNDI lookup and creation
>of remote for session facade) so should one still use Business Delegate if
>"Service Locator" is used?
>
> - it can catch "network" exceptions and show a client "business"
> exceptions so that a client e.g. does not have to know anything
>about
> the service distribution
>
>Consider MVC application, should not Servlet convert network exception in
>user understandable message instead of adding one more layer. Even if
>Business Delegate throws any "business (Application)" exception servlet
>would still have to catch it and display it to user.
>
>Thanks and Regards,
>Alok
>
>
>
Hi Alok
As I understand it, a business delegate uses lookup services to locate a
service. Any client(e.g. a servlet) uses a business delegate as an
additional layer to "connect" to services layer. A client doesn't know
what lookup services a business delegate uses, actually it does not
know anything about lookup services.
>>Even if Business Delegate throws any "business (Application)"
exception servlet would still have to catch it and display it to user.
Yes, but in this case servlet does have to catch
"SeriousNetworkException" but only "BusinessServiceUnavailable"
exception generated by a business delegate.
When business delegates catches a network exception it can try to
connect once again to session facade. It can use a lookup service once
again on its own, while a servlet does not what is happening in the
background. Obviously there must be some critical point when a business
delegate throws a kind of "service unavailable" exception to a servlet.
I can imagine that a business delegate and service loacator
functionality is in the same class. But I think that each kind of client
should have its own kind of delegate and maybe all those delegates
should use the same service locator. So there may be a reason why a
business delegate and a service locator functionality should not be in
the same class (i.e. possible duplication of code).
That's how I understand the problem.
Someone else, please, comment on the problem?
Regards
Maciek Zywno
====================================================================
Companion Site: http://www.corej2eepatterns.com
J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)