Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: DBMain and RMI

 
David Gibson
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I have just registered to do the developer exam and this seems to be my biggest stumbling block. I have got the URLyBird assignment and this states that I *must* implement the supplied interface for my Data class. The question is how set up my design so that I can call data.find() in the client whether the client is networked or not. As you probably know the DBMain interface defines methods like find and delete most of which throw some sort of RecordException but none of which throws RemoteException. Can this be done with one interface? I have looked into extending the DBMain interface as well as the Remote interface and got this to compile, but rmic throws a wobbler if I try to use it, the error states that the find method doesn't throw RemoteException.
Can anyone recommend a design pattern that would help me with this
Regards
Dave
P.S. this is my first question and most probably not my last!!!
 
Javini Javono
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
There are two parts to my response. Please remember that I am a greenhorn.
Part I
The adaptor pattern. I personally am not a patterns expert; but, I've seen the
term thrown around concerning this topic in the last 40 days. Click on the
"Search" link a search on adaptor or adapter and see what you turn up, and
look for posts within the last 45 days (or earleir, I guess).
Part II
I'm almost certain that this topic has come up in the last 30 days or so on this newsgroup,
and that it was discussed at length; hopefully you can either search for it or simply
go through a reasonably short number of posts in a brute force fashion.
Okay: I found the link:
http://www.coderanch.com/t/184769/java-developer-SCJD/certification/NX-Adding-given-interface
Another option is to go to the group where people post that they have passed the test:
http://www.coderanch.com/forums/f-44/sr
I believe that in a few of these developer postings that they speak on this item to some
degree. And, here are a few examples of specific postings:
http://www.coderanch.com/t/137953/sr/certification/Passed-SCJD
http://www.coderanch.com/t/137963/sr/certification/Passed-SCJD
http://www.coderanch.com/t/137959/sr/certification/Passed-SCJD
http://www.coderanch.com/t/138021/sr/certification/Passed-SCJD

I think other tricks that I have read about, and thought about (but not specifically
with respect to RMI exceptions), has to do with how they set up their class
hierarchy:
Here is an example, simply to show the concept:
DBMain
DBMainRmiExtended extends DBMain
Data implement DBMain
DataRmiReady extends Data Implements DBMainRmiExtended
So, they play around with this stuff so that when they say:
Data = new DataRmiReady()
and now DataRmiReady() can throw the RMI exceptions because
DBMainRmiExtended defined the method with the ability to throw
that exception, and maybe the method was even renamed (that would
make more sense?); but, the point is, you still have a descendent of
Data that you are using, and it gets the ability to through remote
exceptions because it also implements an additional interface (with
additional methods that do this?).
[aside, one might consider the renaming of methods slightly "legalistic",
but refer to the actual posts yourself; but, perhaps this is where the
adaptor pattern comes in?.]
Keep in mind, I'm not offering a real solution, because I have not gotten
to the RMI part of the assignment yet, but I am suggesting some of the interesting
"fooling around" I've seen when people try to use the Java language
to comply with the Sun requirements and also end up with a product
that actually works. That is, I'm trying to impart the concept; but, look for the
recent postings on this, and someone might have actually written up
a working solution.
Thanks,
Javini Javono
[ January 08, 2004: Message edited by: Javini Javono ]
[ January 08, 2004: Message edited by: Javini Javono ]
[ January 08, 2004: Message edited by: Javini Javono ]
[ January 08, 2004: Message edited by: Javini Javono ]
 
David Gibson
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Javini for your very informative reply, I will look at all those links now to get a better idea on how to tackle this part of the assignment.
Regards
Dave Gibson
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic