• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

NX:(contractor) database location?

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please let me know what u think of the bold text...
thanks ^_^ and good day ...
=================================================
Your choice of RMI or serialized objects will not affect your grade, but no other approach is acceptable. In either case, 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, in which case, the networking must be bypassed entirely. No authentication is required for database access.
================================================
i have used the System.getProperties("user.dir");
is depend to the user, wherether which working dir they are in. SO am i in the right track??
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
must is must. Not much for interpretation there.
Mark
 
Zhi Gang
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
must is must. Not much for interpretation there.
hi ,
1 .when the assignment mentions database(pls ref. the bold text above), does it mean the location of the db-2x2.db?
2.i am using System.getProperties("user.dir") to determine the working directory so that Data.java will read it from the working directory.
3. if user start the application in workingDirectory(db-2x2.db is in here) with

java -jar app.jar ---> then it will work
but it user start the application
java -jar ../app.jar
or
java -jar /whateverpath/app.jar
then it will fail.. please let me know how should i fix it...
 
Zhi Gang
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi mark
please ignore the above reply
i just read on the reply that u post to Rag Srinivasan ... i guess i need to add some extra functional in GUI to allow user to choose the file part.
Just to confirm, is the file path need to be include in suncertify.properties ?
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are having a GUI screen that allows the user to enter things like mode, db.db file location, host and port, then it would be nice to save all that information in the properties file, so that when the user runs it again it remembers their last input values.
I think in the new assignment they are specifically looking for this functionality.
Mark
 
Zhi Gang
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi thanks for reply , please let me know if i am in the right track
=================================================
db.db file location, host and port, then it would be nice to save all that information in the properties file
=================================================
1. java -jar runme.jar alone --> local mode
Using JFileChooser to select the db.db location
and save into suncertify.properties
2. java -jar runme.jar server --> server
get the port,host,db.db location save into suncertify.properties
(is there any API, that i can use for getting a list of port and host?
where is suncertify.properties sit, in the jar or user need to select the file from JFileChooser)
3. java -jar runme.jar -->network client and gui
retrive from suncertify.properties
(do i need to start the server in here/or just assume is started by No.2?)
thanks alot .... much much Appreciated !!!
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Zhi

1. java -jar runme.jar alone --> local mode
Using JFileChooser to select the db.db location
and save into suncertify.properties


Looks good.
I went a step further and checked if db.db was in the working directory, and if so, offerred it as a default.


2. java -jar runme.jar server --> server
get the port,host,db.db location save into suncertify.properties
(is there any API, that i can use for getting a list of port and host?


I do not think that there is any way to get a list of available ports / hosts programattically. To try and find a currently running registry would require some sort of port scanning. To try and find "any available port to start my own registry" would be very easy, but would cause havoc for the users "gee, what port is the server on today ). And trying to find all the local hosts on the local subnet might not be possible, especially if the system administrator has deliberately turned off all services that would indicate what the server is / where it is (I have worked in companies where that happens: if you dont know the hostname and port you need to use, you wont even know the computer exists).
A better (IMHO) option is to just go with the defaults (hostname = localhost, port number is the "well known" port number for RMI), then allow the user to override them if they want to.

where is suncertify.properties sit, in the jar or user need to select the file from JFileChooser)


My properties file did not exist until after the user attempted to run the application, after which it was created in the current working directory. On subsequent runs, if there was a properties file in the current working directory then my app used it.
You could store it in the jar file, but I think this is going to be far too much hard work for no real benefit.

3. java -jar runme.jar -->network client and gui
retrive from suncertify.properties
(do i need to start the server in here/or just assume is started by No.2?)


Your choice, but document the choice
Personally, I think that starting the server from the client is wrong - what happens if someone decides to shutdown the client, not realising that it has also started the server and there are other clients attached? Sure, you can put up dialog boxes warning the user that this could cause problems, but to me, the client and server should be distinct applications.
Regards, Andrew
 
Space pants. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic