permaculture playing cards*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes How many modes are there for the program? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "How many modes are there for the program?" Watch "How many modes are there for the program?" New topic
Author

How many modes are there for the program?

Clivant Yeo
Ranch Hand

Joined: May 22, 2004
Posts: 124
Hi ranchers,

There is this sentence in my specification:

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.


I am not sure if I had understood it correctly, but I understood it as there are three modes:

1. When "server" flag is entered, the program listens for network connections, show a GUI. The GUI is for the local client to access the database. This mode allows both the local client and the remote client to access and manipulates the database.

2. When "alone" flag is entered, the program do not listen for network connections, but only show a GUI. The GUI is to let the local client access the database. This mode is only dedicated to the local client to access the database.

3. When no flag is entered, the program will establish a network connection to a program that is in mode 1. The program will not listen to network connections, but rather establish a network connection. There will be a GUI shown for the client to access the remote database via the program in mode 1.

What makes me confused is the following that was in the eariler portion of the specification:

Non-Networked Mode
The program must be able to work in a non-networked mode. In this mode, the database and GUI must run in the same VM and must perform no networking, must not use loopback networking, and must not involve the serialization of any objects when communicating between the GUI and database elements.

The operating mode is selected using the single command line argument that is permitted. Architecturally, this mode must use the database and GUI from the networked form, but must not use the network server code at all.
Network Communication Approach
You have a choice regarding the network connection protocol. You must use either serialized objects over a simple socket connection, or RMI. Both options are equally acceptable. Keep in mind that networking must be entirely bypassed in the non-networked mode.


Correct me if my earlier justification is wrong.

Thanks in advance.


Clivant Yeo
My Personal Website
Robert Konigsberg
Ranch Hand

Joined: Jun 23, 2004
Posts: 172
I took the spec to mean:

1. "alone": GUI connects directly to the database. No networking can be used. If you're running Windows 2000, this probably can be tested by disabling your network card altogether.
2. no command line parameter: The GUI runs in network mode. It does not connect to the database, but connects to the network server that was started with the "server" parameter.
3. "server": Network server runs. No GUI runs. Network server waits for connections by GUIs that were started v. option 2, above.

Between the two of us, one, or both, is wrong. Could someone possibly clarify?

Thanks, Rob


SCJP 1.4 (91%)<br />SCJD 1.4 (376/400, 94%)
Clivant Yeo
Ranch Hand

Joined: May 22, 2004
Posts: 124
Hi Rob,

If you say that the server mode do not have the GUI client running, then how is the user who started the program as server mode choose the database file for the database to run?

I don't know if it is necessary for the user to choose the database file to start the database server but there is a paragraph in the specs saying:


Network Approaches
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 don't know if the specs means that the user specify the location of a remote database (the same program runnning in server mode) but looking at the part "and it must also accept an indication that a local database is to be used", the "local database" can mean the database file residing on the same machine as the program that is running, be it in server mode or the flag being entirely left out.

If the location of the database file to use is not choosen by the user but instead hardcoded in the program (eg. the database file beside the running program, then Robert's view on the program running in server mode will be more reasonable.

I would appreciate more people to give your opinions on this issue, thanks in advance.
Jan Rotthaus
Ranch Hand

Joined: Jun 23, 2004
Posts: 56
Hi Rob! Hi Clivant!

I just downloaded my assignment, and I have not yet figured out, how to solve the point you mention. Here are my two cents:

- I think there are three modes, where "server" starts the database without any GUI.

- Your program must be able to specify the location of the database. How can you achieve this? I think there are three options:

1. Command line arguments - NOT allowed in my assignment.
2. Configuration file - possible, but how can you make sure server and client share the same file? Apart from that changes take only effect after a restart of the server...
3. A simple dialog where the user can specify the database location before the server gets started - looks fine, but do you really want to have an input dialog on your server software?

In real life, you would clearly choose option 1. (at least for the server part), but for the assigment I think I will tend to option 3 :/

Jan


SCJP 1.4, SCJD, SCBCD 1.3, SCMAD 1.0
SCPBDA7, SCPBDP7, SCAPC8
OCUP Fundamental
Clivant Yeo
Ranch Hand

Joined: May 22, 2004
Posts: 124
So going by Robert's and Jan's conclusions, does it mean that the whole assigment have three distinct parts. The user interface, the server program and the database program.

1. When the 'alone' flag is entered, the User interface would have a reference to the database program but the server program is not being started.

2. When the 'server' flag is entered, the server program have an instance to the database program, the user interface is not started(Only a filechooser to prompt the location of the database file).

3. When left out entirely, the user interface is started, with a network connection to another program in server mode; the server program and the database program are not started.

Anyone can advice me on whether I had visualized this whole issue correctly.

Thanks to Robert and Jan for your valuable options.
Robert Konigsberg
Ranch Hand

Joined: Jun 23, 2004
Posts: 172
Just my opinion.

You might find that just writing a database program will be too cumbersome. You definitely do not need a separate database program. IMHO you just need an architecture that allows you to easily connect to the database either from the network, or the GUI, and that also allows you to easily connect from the GUI either to the network or the database.

Rob
Clivant Yeo
Ranch Hand

Joined: May 22, 2004
Posts: 124
Hi all, I found a contradicting point to whether the server allows a GUI for the local client to perform record booking and searching when in the server mode.

Look at this portion in the specs:

Non-Networked Mode
The program must be able to work in a non-networked mode. In this mode, the database and GUI must run in the same VM and must perform no networking, must not use loopback networking, and must not involve the serialization of any objects when communicating between the GUI and database elements.

The operating mode is selected using the single command line argument that is permitted. Architecturally, this mode must use the database and GUI from the networked form, but must not use the network server code at all.


The last sentence: Architecturally, this mode must use the database and GUI from the networked form, but must not use the network server code at all.

I sees it as the alone mode must use the user interface and the database codes that is activated in the server mode. That would mean that the program running in server mode will have a ServerSocket connection to listen to client connection and at the same time there is a user interface servicing the Customer Service Representitive at the server machine.

I am really confused by this whole thing, anyone can clear my doubts again?
Steven Hoodless
Ranch Hand

Joined: Mar 23, 2004
Posts: 64
Clivant,

This subject comes up a lot on this forum. You could do a search on connection modes.

You have the local connection which is, in its basic form, you on your home PC using the GUI to access the database. No need for RMI networking etc..

There is the server mode which again in its simplest form is a server app that starts up, connects to the database and sits and waits for connections.

Finally there is the network mode where your GUI creates a network connection to the server and accesses the database through the network/server combo.

Have a think about it, read some other threads on this forum about connections and your doubts should clear.

Steven


SCJP, SCJD, SCWCD.
he qinfeng
Greenhorn

Joined: Sep 13, 2003
Posts: 23
"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>]"
it means that all classes of the client and server must have the mode flag,in the code if the mode flag does't equal to the specified mode flag,it will throw a exception?


SCJP<br />SCJD(in progress)
Clivant Yeo
Ranch Hand

Joined: May 22, 2004
Posts: 124
I guess there is no need to throw an exception, just print the usage out to the terminal when the kind of mode does not match.
Eben Hewitt
Author
Ranch Hand

Joined: Apr 16, 2004
Posts: 36
That's exactly what I do. It's good enough for the java command...
[ July 02, 2004: Message edited by: Eben Hewitt ]

Eben Hewitt. SCJP, SCWCD, SCJD, SCJWSD for JEE 5, TOGAF 8 Certified Architect, author of Java SOA Cookbook (O'Reilly, 2009) and contributor to 97 Things Every Software Architect Should Know
 
wood burning stoves
 
subject: How many modes are there for the program?
 
Similar Threads
Running server/client separately in runme.jar
commandline argument
Startup modes
Layers in SCJD assignment
NX: Spec Confusion