• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Help Me !!!

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic