Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The Data Client / Connection Proxy

 
dean tomlinson
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been following the ConnectionFactory topic, but have a question.
The clients connection object (as detailed by that mark and peter) implements the Data interface, but essentially lives on the server. does the connection objects stub count as the clients data client, with respect to the following requirement...
"To connect with your server, you should create a client program. This implementation should include a class that implements the same public methods".
Or do you think I need something like a RemoteDataClient that also implements the Data interface and wraps the stub to the server side Connection?
Your opinions are greatly appreciated. Thanks Dean
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have implemented a client side factory to create local Data object or get remote Data object and then assign this Data object to a proxy object. In my design Client always communicate with the Data proxy object and not the xxx_stub. The Data proxy object uses the xxx_stub object for remote operation.
 
dean tomlinson
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sai, Thanks for your reply.
Am I right to summarise what you are saying as...
You have an object called say RemoteDataProxy (not an rmi.remote object) that implements the data interface (as per the requirements). Held within the RemoteDataProxy object is the stub to the clients individual Connection object.
Most of the database calls are delegated through to the Connection object on the server, which will handle locking and unlocking etc ?
Is that right ?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does the connection objects stub count as the clients data client, with respect to the following requirement...

Yes, but Sai is also more right, in that he wraps it in another class or Proxy. that way the client is only dealing with the Proxy, and knows absolutely nothing about what's behind it, local or remote.
In my design that class was a Facade, but really still the same thing.
Mark
 
dean tomlinson
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi mark,
Yes, but Sai is also more right, in that he wraps it in another class or Proxy. that way the client is only dealing with the Proxy, and knows absolutely nothing about what's behind it, local or remote.

what i was intending was to call a DataAccessFactroy that returns an implementation of the DataAccess interface. My facade controller oject only talks to the DataAccess interface.
Depending on the parameter value sent to the factroy, the implementation of the DataAccess interface returned will be either a Data object for local mode, or either the stub to the Remote Connection object (which is a remote proxy), or a Class that wraps the stub, and delegates to the stub ?
With a bit more background to my question. Does the stub to the Connection which implements the DataAccess interface, count as ...
"To connect with your server, you should create a client program. This implmentation should include a class that implements the same public methods as the Data class"
thanks a lot - I understand generally what i'm going to do but am wary about violating any of the requirments.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dean - Yes it would count as that.
Mark
 
dean tomlinson
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks again mark ! have a good weekend
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic