This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Olivier Gregoire

Greenhorn
+ Follow
since Dec 30, 2009
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 Olivier Gregoire

Hi,

I'm a 10 years experienced Java programmer, but I'm only starting Java EE 6, coming from 4. I'm a fellow Ubuntu user for 6 years (read "user", not "administrator", even if I have the sudo access).

So I just bought a book called "Beginning Java EE 6 with Glassfish 3". While the book is very interesting, I just don't know how to perform all the installations Antonio Goncalves describes in his book, since he says "Linux and OS X are not supported in this book". Well, I would like to get all the software Goncalves speaks about in his book. That means:
* JDK 1.6 (that's ok, I got it)
* JUnit 4 (that's also ok, no issue with this)
* Maven 2
* Java DB
* GlassFish 3

So how can I get these installed? I've never worked with a Maven, Java DB or GlassFish before. All the previous installations I had (meaning Weblogic and other Java EE 4 application servers) were done by a system admin, not me.
9 years ago
I understand, but isn't composition better than extension? That's what I understand from reading the book "Effective Java" written by Bloch.
Hi all,


After well-reading my assignment, I see nowhere on it that my suncertify.db.Data class must be public. So I decided to make it package-private to have more control on the public interfaces I give outside the package (the only thing I can't reduce is the DB interface since its visibility is explicitly mentioned).

That means that all I allow outside of the package suncertify.db is the access to one interface (the DB interface), the exceptions and one factory. I also have a dao interface in some other package, but its suncertify.db implementation is not visible from outside the package. That dao is also built from the factory.

By looking at the code, it is 100% sure that the Data class fulfills all requirements. Additionally to all these requirements, I just made it package-private.

So, my only question now is: "am I really allowed to do that"?
Hi Roel, and thanks.


I know all these constructors with charsets given as string in String, InputStreamReader, etc. but it seems so much more proper defining once and for all the charset and using it afterwards.

I'll mention a strong notice, telling that I would have worked with Charset if it wasn't giving me a kind of sword of Damocles :
- there is an explicit mention of using either java.io or RMI for client/server communication (and only in this scope) in the instructions.html
- there is an implicit mention of no jdbc (by defining the format of the database), EJB or servlets (because it's a J2SE certification)
- there is no mention of no java.nio at all in the document. The only time the string "nio" is present is in the word "junior" (or "senior", I don't remember).


Regards,

Olivier
Hi all,


I read all around the Internet that I may not use the java.nio package for SCJD. I don't have that kind of restriction in my instructions.html file. The only restriction I have is the following sentence: "You must use either serialized objects over a simple socket connection, or RMI." I chose RMI, but for some reason regarding the database file, I need the class Charset (which is in a subpackage of java.nio). So what is correct, what should I do?


Thanks and regards,
Olivier
The implementation that I chose for this is the basic Lock implementation. It is contained directly in my Data class. But now with the issue I'm facing, I'm thinking about the default implementation of the ReadWriteLock. I'll implement the other lock too and check if everything is ok.

Roughly, I perform the lock only in the test classes used in my JUnit.

It's simply using the DB api:


I don't really know how I can go deeper in the explanation regarding the lock system itself without copy/pasting the code. All I could say without revealing much is that my method pattern is the following:


If I already wrote too much, please tell me so I remove the code.
Indeed, you couldn't know about the empty methods. I'll try to be clearer next times.

I'll try and use the shuffle but I don't really think it's gonna change much, since these are threads, and the execution is non-predictable, even if we add randomness.
That's not an issue right now, since all methods are empty, except about the lock.

Regarding the strange pattern, is this normal? Or should I already have to correct the lock system? I prefer to work one thing at a time, and started with the lock.
Hi,

My current tests on the locking system always shows the same pattern, and I don't know if it's right or wrong: all updates, and deletes on the record 1 are done at the end of the test, except one or two. I've tested it and seen it on two different systems (one Windows, one Linux).

The problem is that I really don't know how to interpret this. Does anyone have the same pattern?

Here's my test method adapted from the one present in the FAQ:



And here's a sample of the test result.

Dears,


I'm implementing some kind of mega-factory for some design reason I prefer, and in this scope, I would like to "force" the use of the factory, including for the Data class. So I'm thinking about setting the Data() constructor visibility to package-private. I haven't read anything about the requirement of the constructor Data() being public.

So my questions is: did any of the implementors of the singleton pattern for Data set the default constructor to anything else than public and still scored a perfect for that data access part?


Thank you,
Olivier

Roel De Nijs wrote:Hi Olivier,

Welcome to the JavaRanch and good luck with your assignment!

Because I created my own interface (which extends Sun interface to meet the must requirement) I left the comments in the given interface as-is and overrode all methods from the given interface and in my interface I added my javadoc comments.
I think you can change the comments into javadoc style in Sun's interface as long as you don't change any method signatures of course.

Kind regards,
Roel



Thank you for your response!

Of course, I don't change any method signatures and I don't add/remove methods.

Regards,
Olivier
Hi there,


I received my assignment about two weeks ago, and I have only read it so far (lack of time). However, I was wondering if we may (or not) rewrite the comments of the given interface to make them standard javadocs? I don't want to stupidly lose points because I reformatted them; but if I have the possibility, I'd better reformat it completely.