James McGee

Greenhorn
+ Follow
since Aug 13, 2001
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 James McGee

My take on it is that it should be a checked exception based on the way it is being used in other places in the database. If you look at the add() or find() methods, you'll see that it is being used as an extension of IOException. The other way it is being used is when the user supplies an invalid parameter (as you pointed out in getRecord(). This could be prevented by reading the comments in the API and implementing the appropriate checks, but it's a stretch to make sure the programmer deals with it.
The comment that seals it for me comes from Effective Java as well...
[On making exceptions checked]
"The burden is justified if the exceptional condition cannot be prevented by proper use of the API and the programmer can take some useful action once confronted with the exception."
In this case the term "proper" carries all the weight. Based only on the signature of the method, passing an int with the value of 0 to the getRecord() method is perfectly fine. The definition of API that Joshua uses also doesn't mention the comments as being part of the API. So I'd say that passing 0 is "proper" use of the API.
As for the second part, being able to do something useful when confronted with the exception, as a programmer I could possibly display a dialog saying they had chosen an invalid record and continue, as opposed to doing nothing which could be very confusing to a user who is trying to display record 0 and sees no response.
That's my opinion. Hope it helps.
- James
I'm still a bit new with event handling, but I am curious if the following is accepted practice, or if it is a newbie programmer testing the limits of what is practical...
I have two classes. One is an application, the other is an extension of JFrame. I want the application class to handle the event listening for the JFrame. I can implement ActionListener in the application, and pass an application object to the JFrame, where I can attach it as an action listener for a button in the frame.
I also want the application class to handle the window events for the JFrame, so I could make the application class extend the WindowAdapter class and pass an object of the application to the JFrame where I can register it as the Window Listener.
Basically my code looks like this...
In the application class...
MainFrame mf = new MainFrame(App);
In the MainFrame class constructor...
public MainFrame(EventListener evtList) {
...
button.addActionListener((ActionListener)evtList);
this.addWindowListener((WindowListener)evtList);
...
I am concerned that the parameter for the MainFrame constructor is too generic and doesn't really convey what needs to be passed to make things work.
Would it make more sense to have two parameters (WindowListener wList, ActionListener actList) and just pass the same application object for both?
Thanks in advance for the feedback.
- James
22 years ago
When you say that the RemoteDataImpl_Stub class is put under the RemoteDataImpl class, I am assuming that you mean in the tree structure that JBuilder builds in the project window. While it may look like it is under (and in the tree it is), the file is actually put at the same package level as the RemoteDataImpl class.
By default JBuilder creates a classes directory in your project folder. If you go to that folder you will find that the RemoteDataImpl and the RemoteDataImpl_Stub classes are in the same folder (certify). So you don't need to put anything to put the RemoteDataImpl_Stub class under that.
The problem I think you are running into was one that bugged me like no other...
When you start up the rmiregistry, it uses the classpath of your system, or the classpath of the current terminal window that you are running it from. Which means that if you don't have the appropriate directory specified in your classpath, you'll get the "class not found" error. If you search any of the many discussion groups out there you'll see that you aren't the only one to have run into this problem either.
The appropriate fix is to set the classpath with an entry that points to your certify folder. For example, if you had your project stored in c:\Jbuilder5\myproject\, you'd want to put C:\Jbuilder5\myproject\classes\certify; into your classpath system environment variable. I don't remember if you have to re-start JBuilder or not to have it pick up the change, but you might try it.
I think you can also start the rmiregistry from the directory that your package starts in and it will work as well. In this case that would be the classes directory.
Good luck, and post back if that doesn't fix it.
I am guessing a bit here, so bear with me. The configuration of the VM parameters is basically providing the parameters for the call to java.exe that JBuilder makes. You can see the JVM parameters by going to your command propmt and typing java -?. You'll see an option -D<name>=<value>, which is the one you are trying to set with the CM parameters in JBuilder.
To make a long story short, I think you are missing the -D in front of your parameters.
Hopefully that will get it.
My guess is that you are trying to specify the policy file as one of the parameters for the call to start your project. While you can't get to the configurations menu, which would allow you to set up new configurations (runtime parameter configurations), you can still change the parameters by going to the Project Menu, selecting Project Properties, selecting the Run tab, and adding the appropriate parameters for the command.
For example, if my project is set to run my client class by default, and the client needs a policy file, the VM parameters I would specify would be -Djava.security.policy=client.policy (changing the name of the client.policy file depending on the name of the file you use).
Hope that helps.
For your first question I think most people agree that Sun wants you to have two options for processing.
1) Local (one client, one DB)
2) Network (many clients, one DB)
To me that means that I'll only have one DB object whether it's on the server or on a local machine.
For your second question I honestly haven't started looking at making things thread safe yet, so I don't want to hazard a guess yet. Once I get to that point I'll jot my comments back here...
I wouldn't worry about the user in this particular situation. Just focus on the requirement, and provide the option of choosing either a network solution or a local solution. Make the assumption that the user will know which option to pick. (Especially because your excellent documentation will describe what the options do!)
This doesn't sound like a requirement in the assignment. Can you copy the quote from the instructions that would lead you to think you need to include customer names?
It depends on when you downloaded the assignment. I downloaded twice, once last year, and once again this year. The older version of the assignment requires you to build the conversion tool. The newer assignment doesn't. I wrote to Sun, and they said to use the newer version of the assignment.
I don't think they would hold it against you if you did create the conversion tool however (assuming you have the older assignment copy).
- James