File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX: Specifying directory of database via server mode - totally lost Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NX: Specifying directory of database via server mode - totally lost" Watch "NX: Specifying directory of database via server mode - totally lost" New topic
Author

NX: Specifying directory of database via server mode - totally lost

Bill Robertson
Ranch Hand

Joined: Mar 21, 2003
Posts: 234
When you run the network gui you must specify the host name of the server.
But do you also have to prompt for the directory of the database on the
server. For stand alone mode I understand you prompt the user for the
directory. But how do you specify a directory on the server. Or is the
hostname enough information?
Does it work like the following:
1. Stand alone mode prompt for directory of the database
2. For network mode you only need to prompt for the server location and not
directory
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
Bill I dont have any prompts but the idea is the same, basically you need the port# and host for GUI connection, the server should have started on the given host using the configured database location and port#.
standalone mode will only use the configured database location
ulvi ugur
Ranch Hand

Joined: Aug 05, 2003
Posts: 46
I would say, all parameters about non-networked and networked solutions have to be kept in the file suncertify.properties and these parameters must be changed using the gui as well. That sound logical to me, no ?
Bill Robertson
Ranch Hand

Joined: Mar 21, 2003
Posts: 234
thanks for the replies.
However I do not think they will work because my assignment states:
"program must allow the user to specify the location of the database"
ulvi ugur
Ranch Hand

Joined: Aug 05, 2003
Posts: 46
Originally posted by Bill Robertson:
thanks for the replies.
However I do not think they will work because my assignment states:
"program must allow the user to specify the location of the database"

Exactly ! So, I imagine a File/Open item in the menu to locate the DB file for the user to choose, when the application starts with "alone" switch. When the user chooses a valid db file 2 things should happen.
1) Write the file selected by the user to the properties file.
2) Open the database file using the Data class and perform operations on it.
Sounds straight forward to me, or I don't understand you.
Bill Robertson
Ranch Hand

Joined: Mar 21, 2003
Posts: 234
ulvi, thanks for the help. But, this still does not address
specifying the database directory location in server mode. From
what I am gathering we can offer them a text box but cannot
use JFileChooser because we will be on the gui client machine
Thom Pischke
Greenhorn

Joined: Aug 22, 2003
Posts: 3
Hi Bill,
I'm struggling with the same questions right now (Contractor assignment). I'm wrapping up my implementation and I've left these configuration questions for last. Here's what I've nailed down so far:
Server must have a way to configure RMI port.
Server must have a way to configure DB Location.
Client must have a way to specify a host URL.
Standalone mode is a bit fat wrench in the whole thing.
Just to give you a starting point here (Assuming you know a few Design Patterns) --
In my design, a DBServer is defined that can provide a Connection interface in two fashions - it can return one from a method, or it can bind one in the rmiregistry. This Connection interface is a Facade for the DBAccess class and is suitable for Remote use. The Connection is also an Abstract Factory, subclassed into a concrete LocalConnection and a RemoteConnection interface. The RemoteConnection is a Remote interface implemented server-side by RemoteConnectionImpl. Phew.
To my mind, client logic should have no need to know anything about the database implementation, and certainly not about the database location. Its function is strictly to provide the GUI interface. In networked mode it will use the URL to obtain a RemoteConnection. In standalone mode, it will call a method in the DBServer to obtain a LocalConnection. In either case, it only knows it has a Connection.
This leaves the chore of configuring database location to the server (ie non-client) side logic. In network mode, things are straightforward. The Server has a GUI, where port and db location can be specified, and some stop and start buttons. defaults can be saved in properties.
Client is similarly straightforward. Client has a screen where url can be specified, and perhaps a connect button. again, save the defaults.
What to do in standalone mode? At a minimum, we still need to specify database location. Should we attempt to use the server gui for this? The server GUI has too much superfluous information with the port field and start/stop buttons... It would be confusing to the user.
Best would be simply to prompt for DB location in standalone mode. This could be done with a simple JDialog, or by adding conditional code to the server gui to adapt it between the two modes. I think it would be simpler just to have a separate input dialog for the special standalone case.
Well, that's as far as I've come on the issue. Would like to hear your current thinking and that of anyone else reading this thread because I've been struggling to come up with a satisfying solution to this for two days now.
Hope that helps, and thanks in advance for any further advice.
Thom


Never express yourself more clearly than you think. - Niels Bohr
Bill Robertson
Ranch Hand

Joined: Mar 21, 2003
Posts: 234
This is what I finally came up with:
1. If you start the server you are prompted for the port # and the
database location. The database location will be stored in a field
from the remote class.
2. If you start the gui in network mode you are prompted for the server/host
name or ip address. Remember at this point we already have the database
location because we are assuming they first chose step 1.
3. If you start in standalone mode you are prompted just for the location
of the database.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NX: Specifying directory of database via server mode - totally lost
 
Similar Threads
How to process the networking with a local database?
Please help me to understand these requirements
Database location
Indication that a local database is to be used ?
NX:Contractors database location