Hi Jian,
Originally posted by jian zheng:
It means user can specify db file's location when start server,right?But not any platform has x-server,so I allow user to input file location when they start server(not GUI),is it ok?
Yes, I think when you start the server that you need to provide the user a way to specify the db file's location. You also need to provide the user a way to specify the db file's location when you start the application in standalone mode. To do this, I think you will need to use a GUI that allows the user to enter the location of the db file (a JFileChooser is a nice Swing component to help you do this). I guess, it's true that not every platform has an x-server, but then I think the assignment instructions prohibit your server from running on such a platform because they require the db file location to be configurable, yet they prohibit the use of any command-line parameters beyond those specifically allowed by the assignment instructions.
I think you will find that your assignment instructions contain a statement similar to the following:
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.
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.
And I don't know what's the meaning of "in which case, the networking must be bypassed entirely" mentioned upon.For example,my machine's ip address is 192.168.0.7,and this is my db server,and I must allow use to locate a local db file but forbid user to locate an db file on 192.168.0.8.Does it mean?
I think you will find it necessary to develop an interface (similar, but perhaps not identical, to the one provided by Sun) that declares the database operations that can be performed by the database. This interface can be used to support all the database operations that can be performed by the client (regardless of whether the client is local, or whether the client is remote). This interface can be implemented by two classes. One of these classes could support the database operations for a local database file (that is, networking will be bypassed entirely), the other of these classes could support the database operations for a remote database file. Your application will need to determine in which mode it is operating (perhaps by examining the approved command-line argument), and then instantiate the appropriate implementation of your interface depending on whether the operating mode requires a local or remote database file.
I'm not sure I understand your example, but I can say generally that you will not have to forbid a user to locate a db file on a particular machine.
Hope this helps,
George
[ February 04, 2004: Message edited by: George Marinkovich ]