*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes URLyBird 1.4.0 - How to start with? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "URLyBird 1.4.0 - How to start with?" Watch "URLyBird 1.4.0 - How to start with?" New topic
Author

URLyBird 1.4.0 - How to start with?

Ganesh Subramaniam
Greenhorn

Joined: Dec 18, 2008
Posts: 4
Hi Everyone

I recently downloaded my project which is URLyBird 1.4.0. I read completely the specification but honestly tell I do not understand where to start. Morever, regarding the .db file, dont know what to do with??!!

Can someone show me some light how to start with this project and complete it successfully?

Which component should I start first of all? Server side component accessing the database or else the GUI component or else?

Will highly appreciate your help!

Thanks & Regards
Ganesh
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

URLyBird 1.4.0?! Had never heard of it!!!

I started implementing the Data class, which is the class that handles the .db file. This file contains records that are related to the rooms that are sold by the URLyBird CSRs, and its structure is documented in the specifications file you received. Honestly, in my case, the first version of this class looked very different from the version that I submitted in the end.

To deal with the .db file, you can use either RandomAccessFile class or both DataInputStream and DataOutputStream classes (these classes implement InputStream and OutputStream interfaces respectively, and RandomAccessFile class implements both, so either way, you're fine). You could start by creating an algorithm (based on the database schema) that reads the content of this file, and also implement the Exceptions that you have to. This is how I started.

And one tip: almost everything that you have to know for this certification is here. Take a look at the threads related to your questions, and I'm sure you'll find interesting things. During the development phase, you'll understand better what you have to do. Anyway, please feel free to come here and ask questions! For sure, someone will help you!
[ December 19, 2008: Message edited by: Roberto Perillo ]

Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Jeffry Kristianto Yanuar
Ranch Hand

Joined: Oct 01, 2007
Posts: 759
Hi friends, first you have to try read all the records and print all the record's fields using the System.out.println() method.

After that, implement the interface provided by Sun. Your implementation may be different based on your networking solution so you have to decide wether want to use Socket or RMI.

Good Luck !!!


Jeffry Kristianto Yanuar (Java Instructor)
SCJP 5.0, SCJA, SCJD (UrlyBird 1.3.2)
Ganesh Subramaniam
Greenhorn

Joined: Dec 18, 2008
Posts: 4
Originally posted by Roberto Perillo:
URLyBird 1.4.0?! Had never heard of it!!!
[ December 19, 2008: Message edited by: Roberto Perillo ]


Hi Roberto

Thanks a lot for your reply! I will start implementing the data access(backend) class.

Regarding your question about the version of URLyBird, could you please kindly tell me where one can find about the version of URLyBird? I saw from other folks in Javaranch they wrote "URLyBird 1.3.2". Thanks for your answer in advance!!!

Thanks & Regards
Ganesh Subramaniam
Greenhorn

Joined: Dec 18, 2008
Posts: 4
Hi Roberto and Jeffry

Thanks a lot for your replies!

Before writing any code, I must decide which way I am going to implement the network layer(Socket or RMI)? I read from Jeffry's post that implementing the network layer using the Socket is not a good idea so it remains(as far as this project is concerned) only RMI, so is it better to use RMI for accessing data through network?

Please correct me, wherever I am wrong. Thanks in advance!

Best Regards
GS
Jeffry Kristianto Yanuar
Ranch Hand

Joined: Oct 01, 2007
Posts: 759
RMI is better and simpler unless you're the one who likes to make your life harder just like me.

If you want to use RMI, don't use the server thread object that handles the client as the owner of the locked record because it is not guaranteed that the same server thread object will serve the same client.


Anyway, I never heard that version of URLyBird, maybe it is the new version of URLyBird.

Good Luck !!!

Jeffry Kristianto Yanuar (Java Instructor)
SCJP 5.0, SCJA, SCJD (UrlyBird 1.3.2)
[ December 20, 2008: Message edited by: Jeffry Kristianto Yanuar ]
Ganesh Subramaniam
Greenhorn

Joined: Dec 18, 2008
Posts: 4
Originally posted by Jeffry Kristianto Yanuar:
RMI is better and simpler unless you're the one who likes to make your life harder just like me.

If you want to use RMI, don't use the server thread object that handles the client as the owner of the locked record because it is not guaranteed that the same server thread object will serve the same client.


Anyway, I never heard that version of URLyBird, maybe it is the new version of URLyBird.

Good Luck !!!

Jeffry Kristianto Yanuar (Java Instructor)
SCJP 5.0, SCJA, SCJD (UrlyBird 1.3.2)

[ December 20, 2008: Message edited by: Jeffry Kristianto Yanuar ]

Hi Jeffry

Thank you very much for your reply!

Could you please tell me how to know which version of URLyBird assignment I have downloaded?

Thanks & Regards
GS
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

It's just that there are some versions of each type of project. For instance, the project that used to be submitted was the Fly By Night Services one. Nowadays, there are some versions of the Bodgitt and Scarper and the URLyBird ones, but the essence is pretty much the same. My project was the URLyBird 1.3.1.

If you clearly have what you have to do, there's no difference if you start by the services layer, or the persistence layer, or any other layer. I used the traditional four-tier layered architecture, but in this case, we are not so sure about what to do exactly (this gets clear as we develop the project), so a good tip is to start by the persistence layer. I myself used RMI to implement the server, where I just created a class that uses an instance of the Data class (which in my case was a singleton). So I created an interface that extends Remote and has all methods of the DBMain interface, but also throwing RemoteExceptions, plus one method called startServer, and this method has a shutdownHook. In my case, when the application starts, I read all records from the .db file and put all of them in a HashMap<Integer, Room>, where the key is the record number (the record number is the position of the record in the .db file), and the value is a Room object (a class that I created) that represents the record itself. When the shutdownHook is invoked (or when the application finishes), I write back to the .db file all records that are in the HashMap. And since the lock method of the DBMain interface does not return any value, I also added the wait/notifyAll logic in the lock method of the server. You need to have the locking mechanism because, for instance, if two clients try to update a record at the same time, without the locking mechanism, both of them will get a "Record updated successfully" message, but one of them overwrote the other client's data. You need the locking mechanism so this won't happen. Here's how you can create your server.

In my case, since I wasn't so familiar with Swing, here's what I did: I created an interface, and created a class that was generated by a tool called WindowBuilder, and this class implemented this interface. I did this just to have an idea of what I wanted, and to support the development of the other layers. After I finished everything, I created the code that reproduced what I had designed with the tool, and kept the interface, so everything continued to work normally. Remember that you must not submit any code that is not your own work.
[ December 20, 2008: Message edited by: Roberto Perillo ]
Jeffry Kristianto Yanuar
Ranch Hand

Joined: Oct 01, 2007
Posts: 759
The version is in your assignment.

Good Luck !!!


Jeffry Kristianto Yanuar (Java Instructor)
SCJP 5.0, SCJA, SCJD (UrlyBird 1.3.2)
Georgiana Lungu
Ranch Hand

Joined: May 17, 2010
Posts: 34
I have URLyBird too, as the assignment. I simply implemented the Socket solution and, as i found it as being pretty straight forward, I didn't browse the forum regarding it while i was implementing it. Now I was sort of at the end of my GUI part(I haven't not really taken things in order ), and I was browsing the forum for ideas of how to adjust my business layer. Thing is, that, i found different posts that, encouraged using RMI, at least for this assignment. I thought a lot about what networking solution to take, and, it all for me it all resumed to which for i can find a better reason for my choice that i can present to the assessors. Although I have a long lockCookie that comes to rescue the threading reuse situation for RMI, and although RMI was said to be easierto use, I still took Sockets(besides my personal preference ) because of this phrase from my assignement "In the future, URLyBird wants to move into Internet-based marketing, and hopes to be able to accept bookings direct from customers over the web. " and, what Sockets can offer over RMI, is performance, better control of the protocol, and because I did't have to concern about client disconnection as the server would receive an exception by default in such case and last but not least, offers more flexibility for client's platform(which of course, stands up for the future plans of URLyBird, not for the present).
Now my question is, are all my arguments even valid, or are they week since RMI is more recommended, and i should after all redesign to RMI.
The next question would be, as I only red the RMI solution described in "SCJD Exam with J2SE5", but didn't try to figure out a RMI solution for my assignment, what special things are to be concerned about in case of Sockets or in case of RMI, for my business layer, since i have seen posts that mention the fact that designing the business layer depends on it?
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

Howdy, Georgiana!

I still took Sockets(besides my personal preference ) because of this phrase from my assignement "In the future, URLyBird wants to move into Internet-based marketing, and hopes to be able to accept bookings direct from customers over the web. " and, what Sockets can offer over RMI, is performance, better control of the protocol, and because I did't have to concern about client disconnection as the server would receive an exception by default in such case and last but not least, offers more flexibility for client's platform(which of course, stands up for the future plans of URLyBird, not for the present).


Well, I think that this phrase means that if they move to internet-based marketing, then JEE would be used. That means that there would be a Servlet (or better yet, a Controller) handling requests from the user and delegating them to a business component that could possibly the one you'll build in the assignment. Thus, since they don't know yet if your components will be used, you can design them as low coupled as possible, so they can use them if they want when they move to internet-based marketing. And then, your server won't be used anymore.

Now, I myself think that RMI is easier and more straighforward, but if you prefer Sockets, then there is no problem at all. You'll just have to justify why you chose it and it will be a-ok!

Now my question is, are all my arguments even valid, or are they week since RMI is more recommended, and i should after all redesign to RMI.
The next question would be, as I only red the RMI solution described in "SCJD Exam with J2SE5", but didn't try to figure out a RMI solution for my assignment, what special things are to be concerned about in case of Sockets or in case of RMI, for my business layer, since i have seen posts that mention the fact that designing the business layer depends on it?


Well, try to design your components as isolated components. In this post, I proposed a way to design your business layer. It was designed to be used with RMI (because of the RemoteExceptions in the methods of the Services interface, but it shouldn't be very different in the Sockets scenario). It was the clearest design I could think of. Please take a loot at it. The way these interfaces and classes were designed, it would be very easy to use them in a web application, and thus, the hidden objective in the phrase you posted (something like "prepare the components expecting them to be used in a web application) would be achieved.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: URLyBird 1.4.0 - How to start with?
 
Similar Threads
Cleared SCJD (UrlyBird 1.3.3) with 381
URLybird
NX: Persistence in the URLyBird
URLybird
UrlyBird 1.3.2 locking with no cookie