This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Thoughts about client/server startup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Thoughts about client/server startup" Watch "Thoughts about client/server startup" New topic
Author

Thoughts about client/server startup

b weiss
Greenhorn

Joined: Apr 14, 2009
Posts: 7
Hey!

I wanted to get some opinions about the client/server start up.

I have the B&S project and wanted to know if others who have completed (and passed) or are in the process had it so that when the application is started and the grader puts in their location/port if a server is not presents just lets it error out...or if they presented the application window and gave an option to start the server later and connect to it. This option of allowing a user to connect to the db after the window has opened isn't in the UI/functional requirements but as far as just a consideration wondered if anyone has considered this compared to having the grader have to start the server before starting the client. Any thoughts would be greatly appreciated!!!
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2265
    
    3

Howdy, B!

Well, in my case, if the server that the client indicated cannot be reached, the application displays an error message via JOptionPane, saying that the server could not be reached.

or if they presented the application window and gave an option to start the server later and connect to it.


Hum... if the window is displayed with the application not being connected to the server, what is the data that you will display? How are you going to fill your JTable? If a client tries to update a record (and where will this record come from?), what should happen in this case? This will have implications on several aspects of your application, including the locking mechanism, so in my opinion, I think it's better to only display the main window when the server is available and can be reached.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Jarek Losice
Greenhorn

Joined: Nov 07, 2008
Posts: 25
Hello Everybody,

I'm about to finish (I hope) my B&S assignment and I also have some questions to ask about starting the application:

I split my applications like that:
* in "alone" mode GUI starts with no DB opened, user is asked to point and open DB file first before operating.
* in network GUI mode GUI starts with no server connected to it. User is asked to point the server (host and port) he/she wants to connect to.

My question is about the "server" mode:
I think that it would we quite nice for a user starting the network server to point:
* the TCP/IP port number for server to run on
* database file to be used by server.
And since specification clearly states, that program must not require use of command line arguments (other than the mentioned flag) I assume, that I need to create some kind of simple GUI for "server" mode. Am I right? That GUI will be responsible for pointing the server port number, file to use and would allow user to start and stop network server by pressing buttons.

What do you think about it?
Thank ya'll ranchers,

Jarek.


Sun Certified Java Programmer for Java 6
Sun Certified Java Developer
Anne Crace
Ranch Hand

Joined: Aug 29, 2005
Posts: 223
I just spent a couple days debugging this particular issue. I ended up adding a method to my controller to test the remote connection before displaying the window with the table. They get an error dialog if the connection can't be made. I haven't tried it on 2 computers yet but it finally works on 1! I did all my validation on the click of the "Connect" button because I tried keeping the buttons disabled until it passed validation, but the Backspace key became an issue. (Passed validation, then they changed it). My dialog doesn't go away until it can connect to a valid location, and I wrote a custom dialog class to display errors and other informative messages.
To Jarek: I think you've got the right idea!


SCJP, SCJD
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5231
    
  12

Hi Anne,

How can backspace key be an issue?

In my solution: when the field is exited, the entered value is validated and the observers are notified something was changed, so if the value was valid, connect button is enabled, otherwise disabled. When the user decides to change the value he entered (with backspace or another key), he will have to exit the field again and the "whole validating and notifying observers" thing starts over again.

Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5231
    
  12

Hi Jarek,

You are correct. I created a small Server GUI where user can enter all necessary information and then he can start the server. If the server is started all input fields are disabled and the only thing that still can be done, is stop the server.

Kind regards,
Roel
Anne Crace
Ranch Hand

Joined: Aug 29, 2005
Posts: 223
Roel:

I ended up going with an approach like K.Tsang used. He mentioned it in my thread about the remote exception. I don't think either one is more right or wrong, if they both work. I did a lot of searching on this issue, and found a thread suggesting validating on clicking the "Connect" button, and I tend to agree. While I think I probably have an issue with my observers and listeners, (I tried doing it the way you mentioned), I got it working with validation via the Connect button. This thing really needs to go "Bye Bye" very soon, so working is working, whatever way that may be!
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2383
    
    7

Anne Crace wrote:Roel:

I ended up going with an approach like K.Tsang used. He mentioned it in my thread about the remote exception. I don't think either one is more right or wrong, if they both work. I did a lot of searching on this issue, and found a thread suggesting validating on clicking the "Connect" button, and I tend to agree. While I think I probably have an issue with my observers and listeners, (I tried doing it the way you mentioned), I got it working with validation via the Connect button. This thing really needs to go "Bye Bye" very soon, so working is working, whatever way that may be!


Hi Anne, I think you were refering to this thread.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Jarek Losice
Greenhorn

Joined: Nov 07, 2008
Posts: 25
Anne, Roel,

thanks for your prompt reply. So it seems I've got a little more work to do
Best regards,

Jarek.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5231
    
  12

Anne Crace wrote:I don't think either one is more right or wrong, if they both work. This thing really needs to go "Bye Bye" very soon, so working is working, whatever way that may be!


That's both true and also very realistic in a real job, certainly when deadline is approaching very fast

Good luck with getting it "bye bye". I guess that will be an emotional moment for you
Kind regards,
Roel

Anne Crace
Ranch Hand

Joined: Aug 29, 2005
Posts: 223
K.Tsang: Yes, that was the thread And, Roel the more I thought about, the bug (a duplicate line of code) that was causing me to have that problem in the first place, may have been what caused the backspace problem. I'm not done testing yet, and one of the things I want to look at is if the properties file is only populated with valid data if something gets changed. I'm pretty sure the listeners and observers are working now, however. Yes, it is time for me to upload the project.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thoughts about client/server startup