• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About Pet store components

 
Tomi Tuomainen
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's the picture...

Pet store components
(scroll to fig 11.9)

And here's the question:
Are there actually two routes to the Session Facade? Why Command Handler doesn't seem to use Business Delegate to locate EJB Tier? Why View Helper isn't using Command Handler but accessing Business Delegate directly? (Is this just a bad picture or am I totally lost here? )

Any explanations very much appreciated...

Tomi
 
Parag Doshi
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tomi Tuomainen:
Here's the picture...

Pet store components
(scroll to fig 11.9)

And here's the question:
Are there actually two routes to the Session Facade? Why Command Handler doesn't seem to use Business Delegate to locate EJB Tier? Why View Helper isn't using Command Handler but accessing Business Delegate directly? (Is this just a bad picture or am I totally lost here? )

Any explanations very much appreciated...

Tomi



Tomi,
From what I could understand from the diagram, the first split happens at the FrontController servlet level. If you notice, depending on the action (either view or an "event"), it triggers off either the ScreenFlowManager or the Event Factory. The screen flow manager takes the BusinessDelegate route to reach the SessionFacade and the event factory takes the Command Handler route. Why the view request is not an event, I am not sure, but they have differentiate the view portion from the other events (possibly place order etc). Possibly, becuase they consider that the view portion just needs the data to be shown on the screen (no transactional stuff needed?) while the other events are more EJB events, hence the entire EJB Tier Controller etc. Again, I am guessing here.


Parag
 
Tomi Tuomainen
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Parag, different "routes" have probably something to do with the nature of the access (transactional or query). So submit of the form would always use Command Handler route, but when the view is created any data access is executed by the helper class directly.

Still I don't understand why the Service Locator is not used in Command Handler route? This architecture is a distributed setting.
 
Ramon Gill
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomi,
Is it because the Command Handler uses 'local' calls to Session Facades, therefore not needing a Service Locator?

Ray
 
Tomi Tuomainen
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ray,

I thought of that... but shouldn't then Front Controller use Service Locator to locate EJB Tier Controller? Some lines missing from the picture?
 
Ramon Gill
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomi,
Maybe the Front Controller isn't using a Service Locator because it only has to find one session bean (the EJB Controller). Therefore the role of the Service Locator is rolled into the Front Controller.

The Business Delegate potentially needs to look up several Session Facades, therefore needing a Service Locator.

Ray
 
Tomi Tuomainen
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ray, reasonable explanation. I think I somehow understand the whole picture. The next question of course is that is this a good example to follow... These two routes with some calls using Business Delegate and Service Locator, some calls not but Command Handler in addition... Sounds a little bit cluttered and not consistent solution (or then I'm just stupid ).

I guess these assigments would be too easy if Sun would document things properly.

Edit: Stupid is the word . I just remembered using this kind of architecture a year ago when I was developing with a framework like Struts. When looking at the code now, everything seems pretty clear. Business methods can be accessed via commands or from a view handler depending on the situation. Thanks guys for refreshing my memory.
[ July 21, 2004: Message edited by: Tomi Tuomainen ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic