Hi
I using a Model 2 architecture wherein the controller class (
servlet) dynamically instantiates ActionClasses. These action classes perform 1 single function on the system (RegisterUser, VerifyLogin, DeleteInvoice etc). Each action class MAY have to get information from the
EJB (Business) layer via remote Interfaces.
My questions..
1- Do I put the logic to get the remote interfaces into each action class so that each class acts as/or has a mini facade to the EJB sub system?
2- Should I look into decoupling it even more and designing a big EJBFacade object that knows everything about the EJB layer and each ActionClass has an instance of this EJBFacade object?
I see each having pros and cons.
In the first example the ActionClass has it's and only it's interface. This way is small, but if something changes on the EJB layer side I 'may' have to edit all my action classes to incorporate the changes.
The EJBFacade way makes it easy to maintain the system if soemthing changes, but, it is a bulky heavyweight object that may instantiate/get interfaces that a specific action class never uses.
Part II:
As another monkey wrench to all this. What about an EJBFacade object using Eager Instantiation, where it only gets the remote interface when it's asked to get it?
Sorry for putting so many "if's" into this mail, but I am having a hard time grasping the right way to do this.
------------------
SOURCE CODE should be
SURROUNDED by "code" tags.
Click here for an example