• 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

location of database  RSS feed

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While reviewing the instructions, I want to make sure I understand this requirement:


the program must allow the user to specify the location of the database, and it must also accept an indication that a local database is to be used


I interpret this as meaning the user can specify the DIRECTORY in which the dtabase file lives. So I made the directory in which the database file lives a property that can be administered by the user. The name of the database file is hard-coded to the name of the database file given with the initial instructions. Am I correct in interpreting "location of the database" as "directory where the database file is"?
For the second part of the requirement, I'm assuming this "indication that a local database is to be used" is satisfied by the much-discussed "mode" flag. If the "mode" flag is set to "alone" then a local database is used (taken from the directory specified in the properties file), otherwise requests are sent to the remote server over RMI or a socket.
Does this sound correct?
- Rolf.
 
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Rolf, the same question was posted a couple of days ago as "Database location ".
If you are still having doubts, you can ask them.
Hope this helps.
 
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rolf,

Originally posted by Rolf Johansson:

I interpret this as meaning the user can specify the DIRECTORY in which the dtabase file lives. So I made the directory in which the database file lives a property that can be administered by the user. The name of the database file is hard-coded to the name of the database file given with the initial instructions. Am I correct in interpreting "location of the database" as "directory where the database file is"?

It seems unusual (and a bit more complicated) to me for the name of the database file to be hard-coded, but for the directory path to that file to be configurable. Do you really want to prohibit the user from ever changing the name of the database file? It seems more natural for me to interpret "location of the database" to mean the path and name of the database file. Also, I recommend the use of a JFileChooser to allow the
user to select the database file. I suppose the JFileChooser could be configured somehow to only allow the user to pick the directory path, but I think that is awkward and goes against the user's expectations for the JFileChooser.

For the second part of the requirement, I'm assuming this "indication that a local database is to be used" is satisfied by the much-discussed "mode" flag. If the "mode" flag is set to "alone" then a local database is used (taken from the directory specified in the properties file), otherwise requests are sent to the remote server over RMI or a socket.
Does this sound correct?

I agree with this, as far as it goes. There are three operating modes: standalone, network client, and server. I think the database file must also be configurable when the executing the command:

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!