Thom Pischke

Greenhorn
+ Follow
since Aug 22, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Thom Pischke

Okay, I lied. The code sample in the original post actually does work as desired (provided of course one uses a real constructor). My code now appears as follows, and seems to do the job well:
Hi, I'm finishing up my project and working on some configuration details. Based on posts here and my own biases, I've decided on the following scheme for configuration:
A Server GUI ControlPanel will operate in networked-mode and will prompt for port and db file location and offer start and stop buttons.
The Client GUI will be responsible for maintaining the machine/url/ip address information needed to establish an RMI connection in networked mode.
In Standalone, neither of the above will be needed, and instead a simple dialog will pop up, prompting for a database location. This will be one simple window.
Now my question. When I display this window, it runs in a new thread. The original thread keeps chugging, although it is dependent on user input from the input window. How can I suspend the main thread elegantly until the user has performed the input and closed the dialog?
I've tried using a modal JDialog, but that only works when the other threads are GUI threads, not when instantiating from main() for instance with no parent frame. I'd like something that roughly models the following scheme:
DBDialog extends JDialog and just contains instructions to build itself and a getDBFile() method to retrieve whatever the user entered.

The problem is that the second line executes before the Dialog has been dismissed, even though the Dialog is modal. Is there a way to make this work, or am I going about this user input completely the wrong way?
HELP!
Thom
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