• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Packaging questions

 
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm sort in a jam here.
I'm trying to test the RMI on two machines.
I tried to fingure out what files are needed on the client side.
I basically have DataServer (the interafce that my Data class implement), DataClient, DataInfo, FieldInfo, DatabaseException, Data_stub files.
My question is, if I don't put the DataServer class on the client side, my subsequent DataClient won't compile because my DataClient implements the public methods of Data class by simply calling the method in Data class.
Any ideas?
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe that the interface needs to be present on both the client and server sides - is that your question? I arranged my packages with a suncertify.common and then a client and server package as well, and deploy the common (containing the interface) on both.
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Paul!
That's what I think too, I just can't confirm it.
One of the problem I have is combining local and RMI DataClient in one class file.
My concern is that, no matter which mode user choice, I'll use the same interface (DataServer: my RMI remote interface) as the access point for my Data class.
When user selects RMI mode, one constructor in my DataClient will instantiate the DataServer ds from RMI server, (Naming.lookup).
When user elects local mode, the other constructor will take a string (db.db location), and instantiate the Data class (new Data()).
The one thing that concerns me is that the DataServer is a interface that extends Remote. Of course, when in local mode, it does do anything special, it's just an ordinary interface.
Is my design ok?
 
Paul Smiley
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds about right to me...
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Andrian,
Are you saying that you are making suncertify.db.Data
class to implement the Remote interface(DataServer) directly?
that means
1) Are you making the Data Class to extend UnicastRemoteObject?
2)Are you modifying the signature of the Data class as throwing RemoteException.
???
with respect
joey
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, in my constructors in Data class, I export the object.
I was going to extend Data class, then make it implement the remote interface, however, it doesn't make sense, since the two class will do essentially the same thing.
 
joey phillip
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Andrian,
I am planning to extend my Data class. but i am kind of confused how to extend both UnicastRemoteObject and my Data Class.
with respect
joey
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Joey:
if you are extending the Data class.
You should use UnicastRemoteObject.exportObject(this); this is design for your type of problems.
IMHO, if you are extending the Data class, you can add the above code in your subclass's constructor.
However, can you please explain why you want to extend the Data class? I'm still confuse as to why people extedning the Data class.
 
joey phillip
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Andrian,
I am thinking if i don't extend Data class i have to change all the public method signature to throw RemoteException. Why should we deal with this RemoteException in local mode?
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's what I thought in the first place. But it really doesn't matter, since your client code will be use in local and network mode, anyway (you are not writing two data client).
 
Get me the mayor's office! I need to tell her about this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic