Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Remote Client Code

 
Matt DeLacey
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My project says:
"The remote client code that you write must provide all the public methods of the suncertify.db.Data class."
What exactly does this mean? Does it mean that regardless of whether you use RMI or sockets you must have the code for the public interface of Data on both the Client and the Server? I'm probably trying to read too much into this, but what exactly does it mean by provide. They must exist there explicitly or just have ACCESS?
Thanks.
With Respect,
Matt DeLacey
 
Jerry Pulley
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matt,
As I read the requirement, it meant that there should be 3 discrete pieces of software - a database server, a database client (which must expose all of the public methods of suncertify.db.Data), and a GUI. The last two are then used together to make a single client program. The advantage of this architecture is that only the GUI is specific to the flight reservation schema - you could use the client and server for any flat file database, replacing only the user interface part.
So, yes, the database client should explicitly provide all the public methods of suncertify.db.Data.
Jerry
P.S. Note that they don't say what class or interface has to provide these methods in the client and server, or that the two sides have to use the same class or interface. I took advantage of this...
[This message has been edited by Jerry Pulley (edited January 30, 2001).]
 
Swapan Golla
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the dataclient has all the public methods of suncertify.db.Data, then is it not necessary to have the definitions of the other classes on which Data class depends heavily in its definitions. Does that mean, they too need to be in the client part or do we need to get those in RMI Calls ? My understanding goes fuzzy from here...
 
Matt DeLacey
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I believe you only need the public methods to be available to the client, then once you call that method, on the remote end it can call it's own private methods if it chooses. Otherwise you would violate the prupose of declaring something private, I believe. Hope that helps.
With Respect,
Matt
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hold on a minute.
I thought when we provide all the public methods of the Data class, all we need to do is to provide the methods, not the signatures, and not the exact implementation.
For example (RMI implementation) in my design:
I have a remote interface that has all public methods of Data.class, my Data.class will implement this.
My DataServer.class simply starts the server.
My client (no the GUI one), has two constructors, one takes the Data.class object for local access, one takes an object of my remote interface.
All the public methods will be provided, but not the exact signatures of the Data.class, and the implementations are simply calls the same methods in the Data class object, or the remote interface.
Any suggestions?
 
Swapan Golla
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is exactly what I did. But now Adrian, coming to myClient(not GUI class) class, if the remote interface has all the data class public methods, the client should have knowledge of all the exceptions that the data class methods throw. Does that mean the definitions for these exceptions (databaseexception) can be provided both on the server and client at the same time. Is there any way to get rid of these redundant files ?
Swapan.
 
Matt DeLacey
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adrian,
Yes, that is exactly the way I did it too. Not sure what I said that was contrary. Sorry for the confusion.
With Regard to DatabaseException.class residing on both the client and the server, I don't really see a way around it.
With Respect,
Matt
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matt and Swapan, sorry for the confusion.
I agree with you guys on the DatabaseException class. I don't think that having DataInfo and FieldInfo classes are neccessary on the client side. I'm pretty sure you guys are doing the samething.
 
joey phillip
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adrian,
If you don't use DataInfo and FieldInfo class in the client side, how are you identifying the Recordno for the selected record and update db.data.

with respect
joey
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ooops .
So, the only class is not on the client side is the Data class? I think that kinda silly. I'll try to work on some ideas to solve this.
Is it possible to just a client (not the GUI), make it download all neccessary classes at runtime?
 
Matt DeLacey
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I may be thinking kooky, ut right now, the way I have it, the only class on the SERVER is the Data class (and then the RMI support stuff). Everything else is on the client. It seems to be working for me.
With Respect,
Matt DeLacey
P.S. I think you're going to HAVE to have everything on the client because when you run in local mode, it will need to be there, but when you run in network mode, the server doesn't have to have everything per se (because it's already on the client).
Just my $0.02
 
Swapan Golla
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well then Matt,
Lets imagine a common scenario. The app is running on networked mode. The client wants to have a particular record and it routes the call to the server through RMI and the server calls its data class and then, the data class should have the knowledge of DataInfo class as it return this type for any record. So, the helper classes should reside both in the server and the client. Am i seeing something absolutely wrong ?
With Respect,
Swapan.
 
Matt DeLacey
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may be right, that is exactly what I was thinkig initially, but I believe my experience says otherwise. When you do an RMI call you actually get an Object. Well, so then you have your remote object ON THE CLIENT. Certainly it will need DataInfo.class and FieldInfo.class and all, but now I'm thinking that RMI hands the client the object and then all the support classes are available on the client. But I'm not sure. This is contrary to what I had thought RMI worked. I have to do more tests, but won't be able to until some time this wekend. I'm confused now...not sure which way it is. I understand very well what you are saying but I really feel like I successfully ran it without the supporting classes on the server...But I may be wrong.
With Respect,
Matt
 
Swapan Golla
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also confused now. I put both the set of classes on the client as well as the server. The app seems to throw an exception saying that there are two UID of the same class i.e. may be the compiler is confused which class it has to use or something like that. Now, I am thinking I have to remove the helper classes from the client so that it doesnt get confused but what if the app runs on a non-networked mode. May be change classpaths from one mode to another. (Actually, I am testing with two machines ( a linux and NT box). Let me know if you figure out anything.
With Respect ,
Swapan.
 
joey phillip
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assume that i am creating a DataClient class which extends Data class.Now the DataClient object can access the public methods of Data class. So Do i need to reimplement all the public methods in Data Class in DataClient class ?
joey
Originally posted by Adrian Yan:
Hold on a minute.
I thought when we provide all the public methods of the Data class, all we need to do is to provide the methods, not the signatures, and not the exact implementation.
For example (RMI implementation) in my design:
I have a remote interface that has all public methods of Data.class, my Data.class will implement this.
My DataServer.class simply starts the server.
My client (no the GUI one), has two constructors, one takes the Data.class object for local access, one takes an object of my remote interface.
All the public methods will be provided, but not the exact signatures of the Data.class, and the implementations are simply calls the same methods in the Data class object, or the remote interface.
Any suggestions?

 
Swapan Golla
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joey,
If your DataClient extends Data class, then that mean the dataclient has the knowledge of data class even if this runs on networked mode which in my understanding is not what we want. Actually, the main requirement is that the DataClient should get Data class locally if it is running on non-networked mode and should get Data class remotely if it running non-networked mode. If it extends Data class itself, I dont know how you will tackle issues when the application is running on networked mode.
 
Matt DeLacey
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Guys--
Just to share my experience. I must apologize, I didn't mean to mislead anyone, but I was mistaken. I have to have all the support classes on both the client and the server (namely, DataInfo.class, FieldInfo.class, DatabaseException.class, and of course Data.class). I was confused before, but I just ran my project on 2 separate computers (in different parts of the city--one at work one at home), and that is, in fact, the case. The more I think of it the more sense it makes, and the more I firmly believe that it is necessary unless you want to go to extraordinary measures. WARNING: I became confused because when I ran it before, it SEEMED to work, but now I know that I was running on the same machine and, although I didn't physically have the .class files on the server side, they were in my CLASSPATH. I think this could potentially trick many people. Be careful about this. Sorry if I have mislead or confused anyone.

With Respect,
Matt DeLacey
 
joey phillip
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adrian,
synchronized methods are not allowed in interfaces.How do you declare synchronized methods of te methods(add,delete etc) of Data class in your remote interface as synchronized methods.

-- joey

Originally posted by Adrian Yan:
Hold on a minute.
I thought when we provide all the public methods of the Data class, all we need to do is to provide the methods, not the signatures, and not the exact implementation.
For example (RMI implementation) in my design:
I have a remote interface that has all public methods of Data.class, my Data.class will implement this.
My DataServer.class simply starts the server.
My client (no the GUI one), has two constructors, one takes the Data.class object for local access, one takes an object of my remote interface.
All the public methods will be provided, but not the exact signatures of the Data.class, and the implementations are simply calls the same methods in the Data class object, or the remote interface.
Any suggestions?

[This message has been edited by joey phillip (edited February 21, 2001).]
[This message has been edited by joey phillip (edited February 21, 2001).]
[This message has been edited by joey phillip (edited February 22, 2001).]
[This message has been edited by joey phillip (edited February 22, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic