File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes release the critics, here comes a design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "release the critics, here comes a design" Watch "release the critics, here comes a design" New topic
Author

release the critics, here comes a design

Bryan Clauser
Greenhorn

Joined: Mar 05, 2002
Posts: 29
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


Bryan<p>SCJP, SCJD, SCWCD</p>
Laudney Ren
Ranch Hand

Joined: Jan 06, 2002
Posts: 111
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


" Veni, vidi, vici "<br />" I came, I saw, I conquered "
Bryan Clauser
Greenhorn

Joined: Mar 05, 2002
Posts: 29
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?
Forrest Xu
Greenhorn

Joined: Jan 30, 2002
Posts: 26
Does the method in IData throw RemoteException, DatabaseException?
Bryan Clauser
Greenhorn

Joined: Mar 05, 2002
Posts: 29
IData throws both DatabaseExceptions and RemoteExceptions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: release the critics, here comes a design