• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

remote exception

 
Beny Na
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 data.java implements DBMain and DBMain does not throws RemoteException), i would appreciate if there is a solution to my problem.



thanks
 
Beny Na
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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


thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic