• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ConnectionManager

 
Pallav Grigo
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone..I'm a little confused with this ConnectionManager concept..when the clients call a method with this signature..
public DataInterface getConnection()
what exactly am i supposed to return?
this is what i have right now..
return new Data("db.db");
Is this right or have i messed up somewhere??
Data implements DataInterface which has all the public methods..
thank you.
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are two ways to do it. I recommend creating a unique remote object which implements the DataInterface for every client. I am not refering to Data class. Data class belongs to the DB layer and this remote object resides on the server. During getConnection() you need to return this remote object and not the Data instance.
Remote object will then use Data object to manipulate the records.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will want to create another Object that implements you interface, it will extend UnicastObject and Remote, which means that the interface will probably extend Remote, then the implementation class will extend UnicastObject. This is the object that you will return
Example.
DataInterface extends Remote
RemoteData extends UnicastObject implements DataInterface
public DataInterface getConnection(){
return RemoteData data = new RemoteData();
}
That the quick and dirty part of it. You will find some other posts on Unreferenced that you will want to search on.
Mark
 
Pallav Grigo
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello...thank you for your replies..they were very helpful..i think i have my design now..will start on the code..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic