This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Simple question about Data Access Component 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 "Simple question about Data Access Component" Watch "Simple question about Data Access Component" New topic
Author

Simple question about Data Access Component

Shahriar Husain
Greenhorn

Joined: Aug 09, 2009
Posts: 24
Hi everyone,

Best wishes to you.
I just read the assignment spec and intend to start it immediately. But I need some advice from you, the experts and the experienced, to guide me to get started. I'm actually a bit uncertain with some aspects. Which are :

What is exactly referred to by the term "database?"

----> A. The Data Access Classes (implementing DBMAin.java) + the Data file x.db

----> B. The Data Access Classes (implementing DBMAin.java) + the Data file x.db + The server side networking & other components


Reference: "In this mode, the database and GUI must run in the same VM and must perform no networking, must not use loopback networking,.... " [Non-Networked Mode Description]


If the database refers to only "A" in above, then:

Is it correct to instantiate the Data Access Class from the Server package and use it in the Standalone Client Mode for the data operations ?



.... i'm really not sure about this. or is it going to be an automatic failure since the Data Access Class from the server package is really a part of the server side.
At the back of my mind i am thinking about a reusable data access component that can be used by both the Network Server and Client depending on the usage scenario, after all everything is going into the same runme.jar file, just different packages .... i think.

Somebody please guide me with this.

Thanks in advance.

Best Regards,
Shahriar



Johnny Barbosa
Greenhorn

Joined: Sep 29, 2009
Posts: 26
Hi guy!
"Database" refer to your x.db file. Your DBMAin Interface, is only the main access to the DB.
Shahriar Husain wrote:Is it correct to instantiate the Data Access Class from the Server package and use it in the Standalone Client Mode for the data operations ?

Yes, no problem. It's up to you. Since than not use the networking... however, as you saw in others topics, do you have only explaining about your design choices.

Guy, as you just read your spec, so, try to understand all thing in your spec, first of all. Start to code something, and give you a chance learning about all thing that will show up during of the developing. You will see, that, will the hope overcame fear...


Cheers,
Johnny Barbosa
SCJA, SCJP, SCWCD, SCJD(Story | Relato), SCBCD (coming soon)
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

Howdy, Shahriar!

Is it correct to instantiate the Data Access Class from the Server package and use it in the Standalone Client Mode for the data operations ?


Hum... you're going to instantiate the Data class from the server package to use in standalone mode? Well, remember that the server code must be entirely bypassed when running in standalone mode. So, you'll essentially have GUI -> Business layer -> Data class -> .db file.

At the back of my mind i am thinking about a reusable data access component that can be used by both the Network Server and Client depending on the usage scenario, after all everything is going into the same runme.jar file, just different packages


Well, you are correct! Remember that the Data class doesn't have to know if the application is running in client or standalone mode. So, you can have a business interface, with 2 implementations (one for standalone mode and another one for client mode), which just sends data to your Data class. Then, your GUI will use it (and it also doesn't have to know what is the implementation being used) and you'll be able to keep everything flexlble and easily maintainable!


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Shahriar Husain
Greenhorn

Joined: Aug 09, 2009
Posts: 24
Johnny Barbosa wrote:Hi guy!
"Database" refer to your x.db file. Your DBMAin Interface, is only the main access to the DB.
Shahriar Husain wrote:Is it correct to instantiate the Data Access Class from the Server package and use it in the Standalone Client Mode for the data operations ?

Yes, no problem. It's up to you. Since than not use the networking... however, as you saw in others topics, do you have only explaining about your design choices.

Guy, as you just read your spec, so, try to understand all thing in your spec, first of all. Start to code something, and give you a chance learning about all thing that will show up during of the developing. You will see, that, will the hope overcame fear...




Hi, thanks a lot for replying and the suggestions.

cheers.
Shahriar Husain
Greenhorn

Joined: Aug 09, 2009
Posts: 24


Hi Roberto !

Its nice to hear from you and to see you around.

Hum... you're going to instantiate the Data class from the server package to use in standalone mode? Well, remember that the server code must be entirely bypassed when running in standalone mode.


So I think you are also considering it as a potentially dangerous idea. Is it?

I'm also wondering if it is going to be an automatic failure. What you think about this ?


So, you'll essentially have GUI -> Business layer -> Data class -> .db file.


That is how I envisaged the design, regardless of the location of the Data Access Class and the Data File.

At the back of my mind i am thinking about a reusable data access component that can be used by both the Network Server and Client depending on the usage scenario, after all everything is going into the same runme.jar file, just different packages

Well, you are correct! Remember that the Data class doesn't have to know if the application is running in client or standalone mode. So, you can have a business interface, with 2 implementations (one for standalone mode and another one for client mode), which just sends data to your Data class. Then, your GUI will use it (and it also doesn't have to know what is the implementation being used) and you'll be able to keep everything flexlble and easily maintainable!


According to the spec: the Database and GUI must run in the same VM but must not use the network server code at all.

So I am actually wondering about how do most people solve the Data Access part for the Standalone mode. Do they reuse the server code ? or write few more standalone Data Access Classes for the client application (for standalone mode)?

Advice from your experience would be really helpful to get me over with this.

Thanks in advance.

Best Regards,
Shahriar


Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

Howdy, my good buddy Shahriar!

Its nice to hear from you and to see you around.


It feels good to be here, my friend! And it is even better when we can help good people, like you!

So I think you are also considering it as a potentially dangerous idea. Is it?


Oh, absolutely. We must bypass the server code when running in standalone mode. If we use it, then we're automatically failed.

So I am actually wondering about how do most people solve the Data Access part for the Standalone mode. Do they reuse the server code ?


Well, the server code cannot be used when running the application in standalone mode. This is how it can be done: you can write an interface with the business methods that you want to offer. One of the implementations use the Data object directly (that is, in standalone mode), and the other one makes calls to the server (that is, in client mode). The services that you want to offer in your server is really up to you. If you want to have a thick client, you can create a remote interface that will look pretty much like the interface that was provided to you, and you will control the start of the transaction and the end of it in the client side. Or, if you want to have a thin client, then you'll have a remote interface with business methods, and the implementation of it will implement the business operations and deal with the Data class.
Shahriar Husain
Greenhorn

Joined: Aug 09, 2009
Posts: 24

Hello my good friend Roberto ! How you doing ?

It feels good to be here, my friend!

I completely agree. Although I am relatively new member here. Just came to know about this forum some months back only. But ever since I am more and more impressed with the vibrant Java community here. Just amazing and so much encouraging for someone who has a deep passion for Java.

And it is even better when we can help good people, like you!


Thanks !


One of the implementations use the Data object directly (that is, in standalone mode),


did you say a data object for which the actual class file resides in the client package ? and explicitly NOT the one used by the server ( residing in suncertify.db )?

please let me know.

and the other one makes calls to the server (that is, in client mode)................................................... the Data class.

These are all fine .. and cool with me

Its a bit disappointing that understanding the spec file with its all scattered pieces of info and vague details is more difficult than doing the actual assignment.

Have a nice weekend.

Best Regards,



Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

Howdy, my good buddy Shahriar!

did you say a data object for which the actual class file resides in the client package ?


Hum... the Data class should only be located in the suncertify.db package, but please confirm that. This class should be located in the same package as the interface that is provided in the assignment.

The difference is that, when running in client mode, the GUI will request information to the server, and the server will deal with the Data class. In standalone mode, the GUI will retrieve information from the Data object directly, or via a business layer, which is even better.

I know the assignment may look sort of hard to understand at a first look, but you may feel free to come here and ask your questions whenever you feel like, and we'll do our best to help you!
Shahriar Husain
Greenhorn

Joined: Aug 09, 2009
Posts: 24
Howdy, my good buddy Roberto !

Hum... the Data class should only be located in the suncertify.db package, but please confirm that. This class should be located in the same package as the interface that is provided in the assignment.


Yes the spec is clear that the data access class must be called Data.java and should be in the package suncertify.db, along with the provided interface DBMain.java.

The difference is that, when running in client mode, the GUI will request information to the server, and the server will deal with the Data class. In standalone mode, the GUI will retrieve information from the Data object directly, or via a business layer, which is even better.


This is what i have been wondering about from the beginning.

My confusion was whether in standaole mode, I am allowed to directly use the Data class from the suncertify.db package.

Best regards,






 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple question about Data Access Component
 
Similar Threads
NX: UrlyBird. data class shared by client?
database/server location
non-network mode serialization?
Question about DesignPattern
Miscellaneous Questions