I am trying to understand and implement the petstore WAF
,I have a few doubts about the architecture
1. What is the basic purpose of the Web Controller and the
EJB Controller and when do we need such kind of abstraction?
I understand the Event model of the application and its use but could not understand the need for classes PetstoreComponentManager.java and ShoppingWebController.java which in turn calls the methods of DefaultWebController.java
2. Why is the handleEvent() method of
ShoppingWebController.java 'synchronized' ? Anyway there will be
different threads of MainServlet.java which will handle the requests so
why to use 'synchronized' ?
3. ShoppingWebController's handleEvent() method simply delegates the call
to a stateful session bean ShoppingControllerEJB's handleEvent()
method. Why is ShoppingControllerEJB a stateful session bean ? Is it
just to cache the references to other beans in the
ShoppingClientFacadeLocalEJB.java ?? What if ShoppingControllerEJB were
a stateless session bean? Even then we could have cached the bean
references in a simple
java class depending on the userId.
4. What is the role of StateMachine class ? We could have directly called
the EJBAction class's methods from the EJBControllerLocalEJB's
handleEvent() method. What is the use of this layer?
5. We could have had the references to other beans in
ShoppingControllerEJB.java itself . What is the need for
ShoppingClientFacadeLocalEJB.java ?? What is the use of this layer??
6. StateMachine.java is having a reference to EJBControllerLocalEJB and
EJBControllerLocalEJB.java is also having a reference to StateMachine
object. Why is this so and when do we need the bean's reference from
StateMachine object??
Any help on the above set of questions would be appreciated.
Thanks,
Dhiren