Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Business Delagate - Session or Java class  RSS feed

 
aakash bhatt
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should the business delegate class be a normal java class or a session bean.
If normal java class how will the remote client invoke the Business Delagate
Regards,
aakash
 
Vinod John
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by aakash bhatt:
Should the business delegate class be a normal java class or a session bean.
If normal java class how will the remote client invoke the Business Delagate
Regards,
aakash

The main purpose of Business delegate is to decouple the presentation tier from the business tier, So I think it is always better to have it as a pure java class. Actually business delegate intracts with the presentation tier components like servlets or rmi server implementation, so they don't directly receive the client request.
http://java.sun.com/blueprints/corej2eepatterns/Patterns/BusinessDelegate.html
 
Roger Graff
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I answered the same question here:
http://www.coderanch.com/t/311948/EJB-JEE/java/ejb-servlets
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by aakash bhatt:
Should the business delegate class be a normal java class or a session bean.
If normal java class how will the remote client invoke the Business Delagate
Regards,
aakash

Definitively a normal java class.
The goals of the business delegates are :
1 - Delegate method calls to EJB (that why the pattern has this name, clever, no )
2 - Hide EJB complexity (remote exception and EJB specific stuff)
3 - Decouple the client layer from the business layer
You cannot achieve these goals with an EJB. So you're business delegate must ba a plain java object.
The usual architecture is :
Client --> Business Delegate --> EJB Session Facade --> EJBs (Session or entity)
 
aakash bhatt
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If my backend layer can be called from a presentation layer
1) JSP/Servlet Then i can use Business delegate as Java object
WHat if my backend layer can also be called by webservice then do i need to pass it from Business delegate
or some other design pattern can be used
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by aakash bhatt:
[QB]
WHat if my backend layer can also be called by webservice then do i need to pass it from Business delegate
QB]

Answer 1 :
If you deploy a webservice through the servlet-based runtime model (JAX-RPC using AXIS or whatever), I supposed the object you expose is a plain old java object (POJO). Then this object is responsible for calling the backend. If this backend is EJB oriented, IMHO, it is better to use a Business Delegate here too, between the POJO exposed as a web service and the EJB session facades of your EJB backend
Answer 2 :
Sun JSR-109 allows a service to be implemented by a stateless session bean. Right now, there is no App.server I'm aware of implementing JSR-109 in a production release. But If you use a Technology Preview (like JSR109 Reference Implementation), then it is technically possible. Is that specific case, as I have never experienced it, I can't advice a specific design patten. I would have to take the time to figure out the JSR-109 deployment model before being able to answer.
[ July 17, 2003: Message edited by: Jean-Louis Marechaux ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!