• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help Me !!!

 
Anurag Mishra
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Used Adapter Pattern and Factory Pattern in my Design.According to
you all this design is good enough or any more changes are required
if there is better idea, or any changes required plz let me know.
Something like this:-
My Database Interface:-
public interface Database extends Remote{
public DataInfo getRecord(int recNum)throws RemoteException,DatabaseException;
So on..
}
In Remote Mode:-
(The Stub class is stored on the client side which help in communication)
public class DataAdapter extends UnicastRemoteObject implements Database{
Data data;
public DataAdapter(Data data)throws Exception{
this.data=data;
}
public DataInfo getRecord(int recNum)throws DatabaseException{
return data.getRecord(recNum);
}
//And so on...
}
In Local Mode:-
A LocalDataAdapter class implements Database{
Data data;
public LocalAdapter(Data data)throws Exception{
this.data=new Data("db.db");
}
public DataInfo getRecord(int recNum)throws DatabaseException{
return data.getRecord(recNum);
}
//And so on...
}
On My Client:-
Database intf;
if Remote Mode
intf=(RemoteIntf)Naming.lookup("rmi://localhost/FlightServices");
if Local Mode
intf=(RemoteIntf)new LocalAdapter(data);
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic