Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Need help on design!!  RSS feed

 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
My Name is Muhammad Asif and working on an java solution. I want to discuss the design that i have developed for the Managerial portion of my module.
Basically, on the Manager side i am giving a Java Swing Interface.
Now with every interface i have attached a Mediator/Helper that does some helping work for it and also
communicates with the application handler.
For every screen i have a screen identity.
Then For each action i have an event.
When a certain event occurs, the mediator calls the ApplicationHandler on the client side.
The Application Handler with the help of service locator locates the Controller EJB.
All the data that i am sending to the server side is in hash map.
I have key value pairs.
(This is the first thing that i want to ask. Is this ok ?? because I will also need to store videos in the server side database. Will it be possible to send Videos encapsulated in a HashMap).

The controller EJB has one method that will handle all request from all modules.
The signature is
public DataPacket handleEvent(Event event,Identity identity,DataPacket dataPacket)
Where dataPacket is actually extending HashMap.
Now against this event and identity i make a call to teh database and look for the Action that needs to be generated. Action will basically be a class. For each event their is a corresponding Action Class.
The action class is instantiated and the perform() method is called for the appropriate action class.
in the perform method i am passing DataPacket and the result is also a DataPacket.

Then from the Action Class i call the DAOFactory to give me the Set of DAOs. If i need to use
Oracle Database i'll instantiate OracleDAOFactory else some other for the appropraiate database/
If some one who knows good enough about design tell me weather this design is correct. Or should i make any changes to it.
I am in particular interested in the fact that I am sending a complete DataPacket to the server side.
Which means for Videos i'll need to generate a byte array and send them on to the server side.

Asif
( I am not currently Using EJBs extensively and I donot want to use them either {at the moment that is} )
[ October 28, 2002: Message edited by: Muhammad Asif ]
 
Muhammad Asif
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ne Body Home !!!
 
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, yes, everything you send to the server must be serializable... Is that your question? Or is it more a question of layering? Personally, I abhor putting UI controller logic on the EJB side like you've done. It's OK to put domain-style commands on the EJB side, but you've tightly coupled your UI events to your domain commands, which limits the utility of your controller EJB.
Instead, why don't you investigate the Session Facade pattern from the Core J2EE patterns book and see if you couldn't apply that...
Kyle
 
Muhammad Asif
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well yes the question was about coupling and the distribution of layers.
As regards coupling i think that the controller will be usable in other applications 2 where the same kind of design is applied.
The reason is that the controller has
merely 7-8 lines of code. All it does it that extracts the actions to perform from the database,
Which afterwards can be transferred to XML documents.
Regarding Session Facade, yes that will be some what useful. I thought of implementing it in the first place but then I thought what will be the function of controller. It will recieve the events and identities from the session bean and just perform the appropriate action. This is very very small responsiblity and i will have to make one extra call (Although it might be within the same container/server) but still one additional call for every action the user is performing ???
Hope u get my point ?
And yes thanx for responding

Still waiting for positive critisim
Regards
Asif
[ October 28, 2002: Message edited by: Muhammad Asif ]
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!