Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

ConnectionManager

 
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.
 
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.
 
ranger
Posts: 17346
11
Mac IntelliJ IDE 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..
 
"To do good, you actually have to do something." -- Yvon Chouinard
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic