• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Request for feedback on design

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ranchers,
I'd like to get some feedback regarding the design I'm thinking of proceeding with. This is a general view. Is anything missing or completely wack?
Client
-----------------------------------------------
UI talks to Facade
Facade has business methods, i.e. getFlights(), etc
- Facade gets a DataSource connection when asked to work in remote mode
- Facade gets a vanilla DataSource when asked to work local
- business methods only know how to talk to a DataSource

Server
-----------------------------------------------
DataSourceFactory bound to RMI
- creates DataSource connections with a Data and a LockManager
- returns DataSource connections to Facade
LockManager tracks DataSource connections and calls Data lock methods

DB
-----------------------------------------------
DataSource has all public methods of Data
- throws RemoteExceptions and DatabaseExceptions
- implemented by Data
RemoteDataSource extends DataSource and Remote
- implemented by DataSource connection
DataSource connection delegates to Data

Thanks in advance for your feedback
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you make Data implements DataSource and have lock implementation in Data, that means, you will have lock/unlock logic even in local mode?
another question is what I have asked here couple of days ago, if doing so, then, you didn't have data client that has all public methods of Data in your client package. I am not sure if it is ok.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply.
Actually, I do have locking in Data -- a subclass of Data to be exact. Omitted that (and a couple other details from original post) for brevity.
When local, the simple locking in Data is the only locking that's used. There is no client tracking. When remote, the Lock Manager tracks clients and then calls into same locking methods used when local.
I *think* that by having the DataAccess Connection object be a Remote, its stub takes care of the requirement for having all public Data methods on the client.
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Can you explain how to achieve above with sample code. I could not understand that..
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I *think* that by having the DataAccess Connection object be a Remote, its stub takes care of the requirement for having all public Data methods on the client


That way your local data access object can not implement the same interface as your remote data access object. Thus it seems to me that your client has more difficulties dealing with local/remote operating modes.
What if sometime in the future you want to change your implementation to use sockets instead of RMI? I know that's unlikely to happen, but it shows your design might not be flexible enough.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suresh - the Lock Manager has methods un/lock(Object, int). Object is the caller. It gets stored in a HashMap with the int record number. Lock Manager then calls lock(int) in Data.
Eduard - the same interface (DataSource) is used whether the client is going remote or local. There is still some complexity, but the facade covers over all that. Facade either gets a local data source, or gets a remote data source from the server.
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Erick
What is there in your Lock method at Data or its subclass ???
Amit
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Amit,
The lockable subclass of Data has the basic lock(int) and unlock(int) methods. Modify and delete ops in the subclass check for a lock on the specified record number, and then use the functionality in super (the plain Data implementation).
reply
    Bookmark Topic Watch Topic
  • New Topic