• 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

Local or Network based connection

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can somebody explain the following paragraph from the FBN assignment!
"The user interface should connect to the database using either a local or a network based connection according to user choice."
I am using RMI for network communication.
Sanjeev
 
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 this refers to you determining where the client is located - if in the same JVM, do not use RMI, but if remote, use it. That's the way I'm going to approach it, anyway...
 
Sanjeev Kumar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Paul,
But, why double work. Even if you are working with single VM the RMI network will support that.
Sanjeev
 
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
In my instructions under "Overall Architecture" it says:
"Additionally, the program must be able to work in a non-networked mode. In this mode, the database and user interface run in the same VM and no networking is performed. The user must be able to select the operating mode, although it is acceptable that the program stay in one mode once it has started up."
So - my instructions at least - say that you have to code it both ways, with one passing the networking (sockets or RMI) altogether. This makes sense in the real world also, as someone local shouldn't have to go through the overhead of networking for a local client.
Sounds like a good place for overloaded methods...


[This message has been edited by Paul Smiley (edited December 29, 2000).]
 
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...or the Adapter pattern
 
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
Not familiar with that Jerry. Do you have a link or a reference to info about it?
 
Jerry Pulley
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul,
Yes, go to http://c2.com/cgi/wiki?PatternIndex for tons of useful pattern info. In fact, be sure and bookmark http://www.cetus-links.de, it's a gold mine.
I used Adapter here because I had both Database and RemoteDatabase interfaces - they were almost identical but RemoteDatabase had a RemoteException on every method (of course). By writing an adapter class I'm able to program the client UI solely in terms of Database. In local mode, I use a subclass of Data which implements Database. In RMI mode, I get a RemoteDatabase from the server and plug it into the adapter, which handles all the RemoteExceptions.
Jerry
[This message has been edited by Jerry Pulley (edited December 29, 2000).]
 
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
Thanks Jerry! That's a LOT of information!
Paul
 
Sanjeev Kumar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jerry and Paul!
Using Adapter class is a great idea. I will follow that.
Sanjeev
 
reply
    Bookmark Topic Watch Topic
  • New Topic