Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

standalone v server mode

 
Lucy Sommerman
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RE:
"When you submit your assignment, each part (client and server) must be executable using a command of this exact form:

java -jar <path_and_filename> [<mode>]
Your programs must not require use of command line arguments other than the single mode flag, which must be supported. Your programs must not require use of command line property specifications. All configuration must be done via a GUI, and must be persistent between runs of the program. Such configuration information must be stored in a file called suncertify.properties which must be located in the current working directory."

Q1. Does this mean that I read in the argument supplied to [<mode>], save it in suncertify.properties, then read it from the GUI?

Also:
"The mode flag must be either "server", indicating the server program must run, "alone", indicating standalone mode, or left out entirely, in which case the network client and gui must run."

Q2: at the moment, I have a GUI and (local) db, so this is standalone mode. I understand that if I run my program as a server, it can be accesses remotely, etc. However, unsure on the implications of "in which case the network client and gui must run".

Thanks

Laura
 
Ken Krebs
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Laura/Lucy/whatever,

It is helpful to think of your program as actually being 3 programs in 1:
  • A standalone version with a local database and a full gui.
  • A server version which will have a local database and may have just a simple gui to configure its properties.
  • A remote client version NO database and a full gui and that can access another instance of the program running in server mode.

  • Each of these 3 programs will have its own properties file. The standalone program will probably store the location of the database file. The server version will probably store the location of the database file and the port it is exposing its service on. The remote client version will probably store the URL or the host/port of the server it last accessed.

    It would be pointless to store the mode in the properties file since if no mode flag is specified on the command line it must run in remote client mode.

    I hope that clarifies things.
     
    Conor O'Mahony
    Greenhorn
    Posts: 7
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Ok, I'm still a bit confused about quite how this works.

    I guess my first question is what you see when you start with each flag ?
    You say:

    alone - allows setting of db location
    server - allows setting of db location and port
    remote - URL or host/port.

    Do you envision a seperate dialog for each eventuality or one dialog that has all the above information but is enabled differently depending on mode ?

    Also in Max's book we start with a choice between local and remote on first dialog. I had been doing this too.
    But do I take it now that this dialog doesn't make sense given that the flag you pass has already decided this for you ?

    Thanks in advance.
     
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander
    Pie
    Posts: 11854
    185
    C++ Firefox Browser IntelliJ IDE Java Mac Oracle
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Conor
    Do you envision a seperate dialog for each eventuality or one dialog that has all the above information but is enabled differently depending on mode ?
    Personally I think there is enough overlap that you can put them in a common panel, and just enable them dependant on what mode you are in.

    Also in Max's book we start with a choice between local and remote on first dialog. I had been doing this too.
    But do I take it now that this dialog doesn't make sense given that the flag you pass has already decided this for you ?
    This post gives a preview of how we do it in The Sun Certified Java Developer Exam with J2SE 5, Second Edition.

    Regards, Andrew
     
    Ian Houston
    Greenhorn
    Posts: 6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    In the jar file you got for this assignment, I remember there is a example java file, it shows you how to use this properties file. Its name should be "sample.txt".
     
    Lucy Sommerman
    Ranch Hand
    Posts: 61
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Ok that gives me some ideas, though alas, i see that the monkhouse book is not released yet on amazon - when is it out?

    thanks

    L
     
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander
    Pie
    Posts: 11854
    185
    C++ Firefox Browser IntelliJ IDE Java Mac Oracle
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Lucy
    i see that the monkhouse book is not released yet on amazon - when is it out?


    Max's book is known as Max's book, Kathy & Bert's books are known as Kathy and Bert's books (or K&B books), and yet mine is known as "the monkhouse book"

    Seriously, we have just had to reschedule, and our current ship date (as of information I received last night) is set for 7th October.

    Regards, Andrew
     
    Lucy Sommerman
    Ranch Hand
    Posts: 61
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    well...shakespeare widely known by his last name, so consider it a compliment.

    L
     
    Lucy Sommerman
    Ranch Hand
    Posts: 61
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    So - I have made an initial GUI that runs before the main GUI - ie. initial GUI allows config of db location and/or port

    but re: "All configuration must be done via a GUI, and must be persistent between runs of the program. Such configuration information must be stored in a file called suncertify.properties which must be located in the current working directory."

    -- still confused - what is this file for? Does it not exist until somebody has run the program for the first time, then it is written to? I don't understand its purpose. Why not just have user enter db location/port each time they run the program?

    thanks

    L
     
    Lucy Sommerman
    Ranch Hand
    Posts: 61
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    so, does the initial GUI write the config info to suncertify.properties, then this is used by second GUI (that allows booking) or by the actual program when it is running?
     
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander
    Pie
    Posts: 11854
    185
    C++ Firefox Browser IntelliJ IDE Java Mac Oracle
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Lucy,
    re: "All configuration must be done via a GUI, and must be persistent between runs of the program. Such configuration information must be stored in a file called suncertify.properties which must be located in the current working directory."

    -- still confused - what is this file for? Does it not exist until somebody has run the program for the first time, then it is written to? I don't understand its purpose. Why not just have user enter db location/port each time they run the program?
    You are correct - this file will not exist until somebody has run the program for the first time.

    However having run your GUI once, the next time the user tries to run your GUI, you can read the properties file and offer all the original choices as default values. So instead of the user needing to re-enter the IP address / database location, it will already be there, and they will only have to click on the "Connect" or "OK" button.

    You should note though, that this file is stored in the current working directory - that is, the directory the user is in when they start the application. So, if I had my database in F:\DATA, and I had my runme.jar file in P:\SCJD and I started the program via:The properties file would be stored in C:\Documents and settings\Andrew

    Regards, Andrew
     
    Lucy Sommerman
    Ranch Hand
    Posts: 61
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Ok i got it, thanks a lot.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic