jQuery in Action, 2nd edition*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Multiple clients support Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Multiple clients support" Watch "Multiple clients support" New topic
Author

Multiple clients support

Annick BOEL
Greenhorn

Joined: Feb 09, 2004
Posts: 10
Hi,
I have decided to support both a browser client for customers and a Java Swing application for travel agent and to put the business logic in the EJB tier.
Can anyone tell me how it is possible to support the 2 kind of clients. The browser client will obviously connect to the web tier but should the Java client be a web client too or should it connect to the EJB tier directly.

I have heard of designing one FrontController per client type. But in which layer is the FrontController supposed to be (web tier or EJB tier).
What is the relationship betwenn FrontController and BusinessDelegate?

Regards,
Annick
Annick
Chintan Rajyaguru
Ranch Hand

Joined: Aug 19, 2001
Posts: 341
Can anyone tell me how it is possible to support the 2 kind of clients.

It's certainly possible. If you look at the J2EE specifications, it allows multiple client types within an EAR file. An EAR file can contain
ejb-jar file - contains business logic
war file - contains web client application (servlet etc.)
application client jar file - contains stand alone client (swing batch etc.)
rar files - contains resource adapters to connect to for example EAI systems
and more...

Look at Chapter 9 of the J2EE 1.4 specifications (or whatever chapter number in version 1.3), which explains how you could write a swing client and make it a part of the ear file. To specifically answer your question, no, the java client will not be a web client (it can't be called java client then), it will be a standalone application (e.g. swing) that will be packaged in a jar file. How this application accesses the business logic (ejb etc.) is defined in the application.xml file. I haven't looked at the assignment yet but I would design delegates, EJBs and DTO (or VOs) in the business tier, populate DTOs in the web tier or application client tier and pass them on to the delegates, which shield EJBs from both the types of clients.

I have heard of designing one FrontController per client type. But in which layer is the FrontController supposed to be (web tier or EJB tier).

Front controller is always in the web tier. Look at This design pattern to understand how it works. In a nut shell, front controller is THE FIRST component (typically a servlet) to intercept ALL incoming requests from the browser. It then delegates requests to other servlets (or commands or actions) based on the URL for further processing. These actions/commands will invoke delegates. While theoretically you can use front controller for swing client as well, common practice is to use event listeners, which will be invoked when (say) you click a button. These event listeners could invoke delegates for business processing.

What is the relationship between FrontController and BusinessDelegate?

Front controller: The FIRST component to intercept ALL the incoming requests (single point of entry in a web application)
Business delegates: Doorway for the client tier into the business tier. Delegates shield the complexity of the business tier components (EJB look ups etc.) from the client.

Let me know if you have more questions

Edit: typo etc.
[ August 24, 2005: Message edited by: Chintan Rajyaguru ]

ChintanRajyaguru.com
SOADevelopment.com - Coming soon!
Annick BOEL
Greenhorn

Joined: Feb 09, 2004
Posts: 10
Chintan,
Thank you very much for your answer.

When I spoke of java client as a web client, I was thinking of a java client connecting the web tier and not the EJB tier. Does it make sense?

I try to understand all the information you gave me and will come later.
Regards,
Annick
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple clients support
 
Similar Threads
Passed part II + III with 98%
Should I design a front controller for swing component?
MVC to support web clients and GUI clients?
servlet vs stateful session bean
Boundary + control + entity + lifecycle objects