Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

release the critics, here comes a design

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a rough and dirty FBN services working, so now its time to start fine tuning things. Here is what I have:

package suncertify.db
IData- contains public methods of Data (interface)
IRData - extends IData, Remote (interface)
Data- implements IData (Data Class Sun provided but modified)
DataServer - extends UnicastRemoteObject implements IRData
LockManager- used to keep track of locks.

package suncertify.client
FBNGui- GUI components
DataClient- business logic, based on selection entered by user constructs IData, or IRData object reference
FBNTableModel- extends AbstractTableModel
CriteriaParser- used to parse the criteraString used in search
FBNMsgBundle- extends ListResourceBundle, allows for ease of label, col header changing.


Uncertainty 1.)
In DataServer an instance of Data (dataOR) is created in its constructor, and for DataServer's public methods in the
DataServer class, it calls dataOR.methodName().
example: public FieldInfo [] getFieldInfo() {return dataOR.getFieldInfo();}

This works fine, and seems fine to me, but that doesn't mean that I am not missing something.

Uncertainty 2.)
On the client side, my DataClient must try/catch on RemoteException. which is not needed for a local instance. But even though it is not needed for a local instance, does that merit the need that there should be both a local and remote DataClient that reside on the client side, since they will both make the same calls, only different try / catch blocks?

any comments?
Thanks
 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) I think it's right.
2) On the client side, don't create two DataClient. Use the Proxy design pattern, which handles all the difference in local and network modes.
-- Laudney
 
Bryan Clauser
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Laudney,
Thanks for the responce.
I am pretty sure that I am using the proxy design pattern, in the DataClients constructor there is
if(isLocal)
IData = new IData()
else
IData = Naming.lookup(...)// getting an IRData

since IRData extends IData there is no problem returning either the local or remote interface to the use as its Data object refrence. Is that what you are talking about?
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the method in IData throw RemoteException, DatabaseException?
 
Bryan Clauser
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IData throws both DatabaseExceptions and RemoteExceptions
 
Switching from electric heat to a rocket mass heater reduces your carbon footprint as much as parking 7 cars. Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic