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 ]