Win a copy of Rust Web Development this week in the Other Languages forum!

Marcelo Camargo

Ranch Hand
+ Follow
since Jul 05, 2007
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 Marcelo Camargo

Bruno,

I am not starting any file with this comment. As you sad, you should not you must. I am using these comments as implementation comments, and only when necessary.

Marcelo.
I just have finished my assignemnt (today), and I now I have the same questions. As I know, we do not need to study for the exam, do we? Its just a few questions about the project?

Thanks,
Marcelo.
I already have findAll and findByCriteria. They are 4 methods.
2 to update data.

Marcelo.
If you are doing the SCJD assignment, to get a better idea of what the project is, I recommend the "SCJD Exam with J2SE5" book. It is a short book, and direct to the point. I am sure it will help you about any topic you have.

The book explains in details how to use the random access objects to access a file, and implements an example database.

The second tool is this forum. As you could see, your first question was asked quicly.

Good look,
Marcelo.
I am exposing only the book reservation and cancel previous reservation to the client. but my assignment only talks about booking.

I am thinking about expose only the book operation (removing the cancelation).

Does someone have other idea?
I think hardcoding is acceptable and is a good solution, because the file are not going to change.
But, I am reading the schema and storing it in a array list, because it is easier to implement, and it demands less code. for example, to write all fields of a record to the file I just need the folowing code:



See, with just a few lines all the fields are saved. Using constants, you need to use each one of them, and the code will have more lines.

Marcelo.
Well, I took the folowing solution: I create the VO using strings as the fields, because this way I dont need to check for the field integrity.
My would be creating an aditional problem to me doing that.

So, now its more simple and easy to understand.

Marcelo.
Yes Gabriel,

I am doing the same as you !

I just finished my business and data layers. Now, I am working on the documentation and after that I will start working in network. How about you?

Marcelo.
Gabriel,

I think the solution is do an unconditional unlock inside the DBAccess delete method. And, if the delete was not done, the client need to get the lock again before try again. I think if it is documented, no problem. That's what you did, right?

Are you from Brazil?

Thanks,
Marcelo.
Hi Gabriel,

OK, in your business tier, that calls your DBAccess implementation, in the business delete method, what do you do if the DBAccess delete method fail? you unlock or not the record? because you don't know if the record was unlocked or not (the DBAcess method fail)...

Marcelo.
Hi Gabriel,

I chose a) option too, but note that I have a 3-tier architecture too.

Even in a 3-tier architecture, where the client are not aware about the existance of the logical locking, I am writting a test code that test the DBAccess interface directlly, because I think SUN will test with this interface with an automated tool. That's because SUN sent to me the DBAccess interface, and they know how to test it. But they can't test the business interface on an automated way (they need to construct another tool to do that).

So, I am looking for all details in my DBAccess implementation, even the client will never know about it.

And, suppose another client is written, and this new client access the DBAccess interface directly... So, we need to worry about all of the details concerning the DBAcess implmentation.

That is what I am doing...

Thanks,
Marcelo.
I am not sure about what to do here.
In the sequence lock->operation->unlock, if I delete a record, should I remove the lock?

We already discuss this issue before, I know, but I see we have two sides: one that defends the automatic unlock, and other that not.

I know there are motivation for both and I agree with both sides, that's my conflict...

option a) For example, a big argument for the automatic delete:
- Does not make sense to delete a record that does not exist.

option b) And a big one for the other case:
- You break the sequence lock->unlock->operation if you unlock the record inside the delete method, and the client should have to know to wich operation he need to call unlock... for some he needs, and for others not.

I first implemented using the option a, and changed to option b, but, at some time, I have a problem in the client side code: if I call delete method, and it return an exception, should I call unlock or not? In this case, I don't really know if the delete already unlocked the record before the exception... and again, I am thinking about option a...

I am in a conflict. Do someone have a very good argument for one side?

Thanks,
Marcelo.
I am using a VO to exchange information from the server (business layer) and the client over network.

But, in the server, when I need to create a array list of the VOs, I am converting the database strings for each field in its base type to store in VO. And, when converting the rate string (currency) to a Float wrapper type, I need to care about localization, because in the database, the rates are stored as "$450.80" for example, and this are the US currency format.

My Vo has this variable:



But I don't know what to do at this point... Someone have a solution?

Other way I thought is just don't convert the database strings to its base types, and my VO could have strings as fields too. Maybe this be the way...

I would appreciate some comments.

Thanks,
Marcelo.
Mihai,

My lockRecord signature does return only the lockCookie to the client. I use the lockCookie to identify the client when it wants to unlock the record. I dont have this ID you sad for each client.
Then, if the same client calls lockRecord again, I dont know if it already have other lockCookie.

And, the thread id does not work for me, because, as I sad, I am working with RMI and many clients can share the same thread. Ans, even with TCP/IP, I couldnt be sure using the thread id, because if the same client uses two different threads to call the DBAccess, I cant identify it as the same client.



I dont understand how you identify your client, could you send your signatures?

Thanks,
Marcelo.
Ziji,


I thing to clarify, Should we check isRecordLock() in the delete
method body of the Data class?

I am doing a check before deleting the record from database file.
then invoke lockManager's unlock method (no Data class's unlock )



You must verify if the client owns the lock on this record before delete it. So, this is the same to say that you need to call the isRecordLock() inside the delete method of the data class (that implements the DBAccess interface).

Marcelo.