• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Business Delegate/Session Facade Question

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to do part two and am confused on the correct implementation of Business Delegate and Session Facade.

1) My main issue is that business delegate objects are not remote so do not support talking to the thick client. So where should the fat client connect to the server?

One idea would be for a stateful session bean before business delegate layer that acts as a controller. Seems strange looking with SessionBean(controller) to Biz Delegate to SessionBean(facade) to Data Access Layer.

Another idea was to scrap biz delegate and have the fat client talk to the session facade directly.

2) Should the Session Facade objects be stateless when using business delegate. I don't see in the J2ee pattterns examples any state management. If they are stateless then why use session facade with biz delegate? What is the advantage.

Thx,

Mark
 
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mark,
Business Delegates can be remote and are used to link tiers. For example, a web tier can use a Business Delegate to link to a Session Facade on the the EJB tier. There is normally a one-to-one relationship between them.

Ray
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ramon,

IMO the swing client can directly use business delegate to interact with EJB Tier. However I have seen some posts where people are suggesting that Swing client should use XML/SOAP to connect to Front controller of web layer.

Could you/others please share your opinion/preference.

Thanks,
AJ
[ October 20, 2004: Message edited by: A J Kumar ]
 
Ramon Gill
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
AJ,
Yes, I've also seen these. There is more than one way of solving the Swing Client problem. I've also seen suggestions using web services.

Personally, I'd have to discount Web Services as I don't know enough about them yet. Out of the other two (both are ok solutions) I'd go for the link to a separate Front Controller on the Web Tier, as I consider it a simpler solution for the client.

Ray
 
Ranch Hand
Posts: 463
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Going by the Petstore implementation ,
U can simply make a URL connection from your client and call the business delegate which -->SLSB--> DAO (In this case the FFMS).

As Ramon mentioned there are many implmentations and u can choose any and I dont think u will be penalised for any implmentation as long as the requirement is met and explainations given.

HTH
Dhiren
 
A J Kumar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ramon - I am not sure if I understood when you say that you would go for the link to a separate front controller on the web tier. Could you please eloberate on that.

Dhiren - To be honest, I haven't focussed on the Swing client part of the Pet store so far. How about we just deploy the business delegate and service locator in the client tier. The swing client can invoke the business delegate and BD can use Service locator + JNDI to interact with EJB tier. I am not sure where would we use the URLConnection. Am I going in the right direction.

Any suggestions welcome...
[ October 20, 2004: Message edited by: A J Kumar ]
 
Mark Hanfland
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the thoughts. Sounds like this is acceptable

Swing Client->Biz Delegate (Stateful Session Bean)->Session Facade(Stateless Session Bean)->DAO

My web UI would be Controller(Servlet)->Command->ViewHelper->Biz Delegate->etc..
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From what I understand, there are atleast 2 choices to connect from the Swing client to the business tier:

1. Swing client connecting to the web tier by making a HTTPRequest (hence the use of URLConnection) to a different controller (possibly SwingController) on the web tier, thereby, using a common web tier.

or

2. The Swing client acts as a EJB CLient and has a BusinessDelegate (a POJO) which uses a ServiceLocator to connect to the business tier using RMI-IIOP, thereby, bypassing the web tier.

In both the instances the BusinessDelegate either lives on the ejb client tier (for swing) or the web tier (for webapp) and communicates via a SL with the business tier (which could have EJBActions, EJBController, SessionFacades etc etc).

Parag
 
Dhiren Joshi
Ranch Hand
Posts: 463
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks for the thoughts. Sounds like this is acceptable

Swing Client->Biz Delegate (Stateful Session Bean)->Session Facade(Stateless Session Bean)->DAO



Mark how would u control client authentication if there is no controller between the Biz delegate and client .?

Even if u had method level authentication how would u pass your principal?
Please give your suggestions.

Thanks
Dhiren
 
A J Kumar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Dhiren Joshi:


Mark how would u control client authentication if there is no controller between the Biz delegate and client .?

Even if u had method level authentication how would u pass your principal?
Please give your suggestions.

Thanks
Dhiren



Dhiren,

As far as I understand, since the BD and SL are on the client tier, SL will communicate with EJB tier using RMI-IIOP that allows you to pass the user credentials.

HTH
AJ
 
A J Kumar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Parag Doshi:
From what I understand, there are atleast 2 choices to connect from the Swing client to the business tier:

1. Swing client connecting to the web tier by making a HTTPRequest (hence the use of URLConnection) to a different controller (possibly SwingController) on the web tier, thereby, using a common web tier.

or

2. The Swing client acts as a EJB CLient and has a BusinessDelegate (a POJO) which uses a ServiceLocator to connect to the business tier using RMI-IIOP, thereby, bypassing the web tier.

In both the instances the BusinessDelegate either lives on the ejb client tier (for swing) or the web tier (for webapp) and communicates via a SL with the business tier (which could have EJBActions, EJBController, SessionFacades etc etc).

Parag




Parag,

That's very interesting. I have never thought about using URLConnection to connect to web tier from client tier. Could you please point me some documentation/link that describes this approach in detail.
 
Mark Hanfland
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Updated Swing approach (many thanks to Parag)

Swing Client-->Biz Delegate (POJO Client Side)-->Front Controller(Stateful Session Server Side)--> SessionFacade(Stateless Session Server Side)-->DAO
 
Dhiren Joshi
Ranch Hand
Posts: 463
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

That's very interesting. I have never thought about using URLConnection to connect to web tier from client tier. Could you please point me some documentation/link that describes this approach in detail.



AJ,
Take a look at admin client in petstore.

The java files AdminRequestBD,ApplRequestProcessor,HttpPostPetStoreProxy

HTH
Dhiren
 
A J Kumar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Dhiren. The information you provided was very helpful. And this brings up an interesting issue - Should there be a servlet filter between Swing based rich client and web-tier. The filter can be responsible for logging and security.

Any thought...
[ October 21, 2004: Message edited by: A J Kumar ]
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you everyone for your contribution.

I would like to address this issue little differently. Have you looked at MVC architecture. The web tier can be best represented with a View Layer, Controller Layer and Model Layer. You can use a Controller Servlet not just for authentication and autorization, but also redirect the request to different JSPs, based on whatever screen the customer needs to see. The Contoller Servlet can use a Business Deligate to a Session Bean using a Service Locator.

You can follow the same MVC model for Swing client tier. There can be a Controller class, multiple swing view classes and and a model object. The Swing Controller class can use the Business Delegate to call Session Bean using a Service Locator. I don't see any need to make HTTP/HTTPs call to the Controller Servelt. That would probably add unnecessary overhead of another web tier. The compromise here is some redundant code.

The use of Business Deligate here is probably caching.Both Servlet and Swing Controller can use the same Business Delegate class to call the Session Bean. All business methods are handled by the Session Bean and all authentication, authorization, redirect is handled by the Controller class(Servlet and Swing).

Let me know if you see any issues with this design.
 
A J Kumar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is what I am going with:

Swing/AWT client -> SwingRequestProcess -> SwingBD -> SL -> SF
 
Sudhansu Pati
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi AJ

=======================
This is what I am going with:

Swing/AWT client -> SwingRequestProcess -> SwingBD -> SL -> SF
=======================

This means that you are not going to use BD for web tier because you have specifically named the BD as SwingBD. In my original thought, I talked about using the same Business Delegate from both Web Tier and Swing Tier.

JSPs <-> ServletController <-> BD <-> Session Bean
Swing Client <-> SwingController <-> BD <-> Session Bean
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you,
According to this discussion, I think that the following is the best solution :

(1). JSP --> ServletController ---> (A)
(2). Swing ---> Swing Controller ---> (A)

(A): BD ----------> Stateless SB (fa�ade) ---> DAO or CMP
|
|
SL

in (1) we use HTTPS and (2) is RMI/IIOP. the session is maintained by HTTPS and RMI/IIOP because they are statefull.

But I have questions about this solution:

1. Can I use RMI/IIOP even SSL is required?
2. How cas I access to a System like Perl, CGI,... with DAO? Can I use JNI or What?
 
Sudhansu Pati
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

1. Can I use RMI/IIOP even SSL is required?
2. How cas I access to a System like Perl, CGI,... with DAO? Can I use JNI or What?


SSL is required for HTTP communications because the customer are going to use an untrusted network to comnunicate with the FBN system. When your Web later is communicating with the Business layer, that commnunication is RMI-IIOP and there is no need of SSL.

Also the Travel Agents don't need SSL to communicate with the FBN system because they will be using RMI-IIOP diretly from the client layer to commnicate with the Business layer.

You can use HTTPS with perl and CGI. No need for any JNIs.

Again, all these concepts are my opinions based on my experience and systems that I architected in the past. You can of course make your own choice and document those.
 
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For application client, why dont you use 'Java Web Start' and pass the request/response in XML format.

JavaWebStart (Client Tier) --> SwingClientFilter (Servlet-Web Tier) --> SwingClientController (Servlet-Web Tier) --> SwingClientRequestProcessor (POJO-Web Tier) --> BusinessDelegate (common for web/swing)


And Service Locator sits in EJB Tier. This approach is given in WAF(Web Application Framework).

Here SwingClientFilter can handle security, logging and also forces user to login before accessing protected pages.

Any comments?
 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think Anil's suggestion is good. The Java client is located outside of the company's firewall, so the RMI/IIOP(or plus SSL enabled) will get it in.
 
machines help you to do more, but experience less. Experience this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic