Two Laptop Bag
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes remote exception 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 "remote exception" Watch "remote exception" New topic

remote exception

Beny Na
Ranch Hand

Joined: May 26, 2004
Posts: 159
hi ,
my assg is about urlxxx

my DBMain interface from Sun does not declare RemoteException,
how to design the class diagram that could be easy for use in client code?
how polymorph can be use within this assignment?

i created remote adapter for network(only one data class), but still can't find the solution for local(since implements DBMain and DBMain does not throws RemoteException), i would appreciate if there is a solution to my problem.

Beny Na
Ranch Hand

Joined: May 26, 2004
Posts: 159
i just try this solution, but not sure if it will work correctly.
<< XXX >> --> interface

1.Data implements <<DBMain>>

2.RemoteAdapter implements <<DBMain>>,<<DBMainRemote>> , where DBMainRemote contain all methods in DBMain interface that throws RemoteException
Code in RemoteAdapter :
public class RemoteAdapter implements DBMainRemote {
DBMain adaptee;
public RemoteAdapter(DBMain adaptee){
this.adaptee = adaptee;

// all methods in DBMain called XXX
return adapte.XXX;

and in client code , roughly like :

DBMain db;

if local then
db = new Data();
else // network
db = new RemoteAdapter();

please coreect me, not very sure this will work and i think it still messy, but i can't found any other solution

I agree. Here's the link:
subject: remote exception
It's not a secret anymore!