Command pattern and SFSBs
I am using the command pattern to interface with the business tier. The commands are generated by the presentation tier and then sent across to a CommandHandlerEJB (sateless) on the business tier, who invokes execute() method on the command. The command in turn calls other EJBs in order to fulfill its logic.
So everything went well as long as the commands were calling the stateless beans...
Now my commands need to call SFSBs, and therefore I need to remember somewhere the references/handlers to the SFSBs for a particular client. The only way I could see to solve this problem was to make the CommandHandlerEJB stateful too, who will create and keep a reference to a ServiceLocator, who in turn memorises stateful beans used by the client. That ServiceLocator instance is passed to the execute() method as parameter by the CommandHandleEJB for reuse. However, I don't find this solution very elegant, since it requires a command handler and a ServiceLocator instances per client.
Am I complicating things due to a flaw in my understanding of how things work? I would be grateful if you could share your solution/opinions...
Many thanks,
Dino

