Yes that is one strategy to implement the Application Service.
Though I am not sure if it makes sense to have two command implementations, one at the web tier and another at business tier.
The way I am doing it is moving business logic (co-ordination logic, process specific validation) from Session Facade (SLSB) to POJO classes called Application Service. One use case would typically map to one Application Service.
Session Facade provides location transparency and invokes the corresponding application service.
This way one Facade with multiple Application Services will provide the business services.
But in case you want to implement Application Service using Command pattern then you will need to pass some kind of Event (or Action) notification from business delegate to Session Facade to App controller.
Business Delegate needs to pass some event/action information to the Session Fa�ade.
Session Fa�ade will require an Application Controller, and Command Mapper/Factory class to instantiate and invoke the command
Using the Command pattern introduces the challenge in passing the data related to command being executed. For example: Search service would require one kind of transfer object, create profile will require another kind of transfer object, and Login would require some other transfer object.
Also one application service can call another application service. With command pattern into play this would go thru the controller all the time.
To support two kinds of clients you can have two different application controllers (in web tier) being used by the Front Controller. The application controller can then invoke command, which will invoke the delegates etc.
Cannot control transaction boundaries as the transaction is decided by the Session Facade EJB's transaction attribute. You may have to add addn Session Facade EJBs for different transaction behavior
- Painful for for large projects where one ends up with lots and lots of events. Same logic gets copies over again and again as the Command's do not call each other or else Command chaining is used
pie. tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|