wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes How to create Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "How to create Server" Watch "How to create Server" New topic
Author

How to create Server

Roy Augustine
Ranch Hand

Joined: Jul 08, 2003
Posts: 30
Hi all
I am working on URLyBird assignment and I just finished my Data Class and Client part. Now my Question is how can I add Network server functionality to the DataBase part. Just give me an idea about which are the classes and technologies I need to use.
Thanks in advance.
Roy
Bharat Ruparel
Ranch Hand

Joined: Jul 30, 2003
Posts: 493
Hello Roy,
You can eithter use Sockets or use RMI. Max's book has a nice discussion on both these topics.
Regards.
Bharat


SCJP,SCJD,SCWCD,SCBCD,SCDJWS,SCEA
Roy Augustine
Ranch Hand

Joined: Jul 08, 2003
Posts: 30
Hi Bharat,
Thanks for your reply.
So that mean in non networked mode there is no server. Is that right? In non networked mode application is just Client and the Database system. And because of that, in non networked mode each client have a separate instance of data base system and each client have no idea about what other clients are doing. Am I right?
Thanks in advance
Ulrich Heeger
Ranch Hand

Joined: Jun 06, 2003
Posts: 266
Hi Roy,
So that mean in non networked mode there is no server. Is that right? In non networked mode application is just Client and the Database system. And because of that, in non networked mode each client have a separate instance of data base system and each client have no idea about what other clients are doing. Am I right?

When you bypass the networking mode, then the client and the Database Server are running on the same JVM. in networking mode, there will be an interaction between more than one JVM, so you have to use, like Bharat said, either RMI or sockets. In RMI you will have to start explicitly the server, so you can communicate through the RMI Server with the Database.
Regards
Ulrich
Roy Augustine
Ranch Hand

Joined: Jul 08, 2003
Posts: 30
Hi Ulrich,
First Thanks for your reply.
But I am still in confusion. May be I am understanding wrong. So you mean in non networked mode I still have to write the server codes. Is that right? But I feel like when we write server code we are performing some kind of Networking or serialization. Is my understanding right. If that is the case then then I am violating the requirement that.

The program must be able to work in a non-networked mode. In this mode, the database and GUI must run in the same VM and must perform no networking, must not use loopback networking, and must not involve the serialization of any objects when communicating between the GUI and database elements.


Thanks in advance
Roy
Bharat Ruparel
Ranch Hand

Joined: Jul 30, 2003
Posts: 493
Hello Roy,
Ulrich is right. The differentiating feature between non-network mode and network mode is whether the entire codebase is running in one JVM or multiple JVMs. In the non-network mode, in theory you are not really required to write a server, but in practice, you may want to anyway... What people are doing, including yours truly, is to write server and client code and call server code directly from the client using an Adapter class (connecting class, mediator class, broker class or whatever is easier for you to understand). This adapter class has the intelligence to figure out whether you are running in a non-networked mode or network mode and will call the server code (mainly your Data class which you may want to wrap in an Adapter class to give you another layer of separation for better encapsulation) either directly or via intermediate networking code (socket or RMI).
It might not all make sense to you right away. For me, it took some time in the library going through posts such as this one. Designing, throwing it away and redesigning, posting my questions here; in other words, you will find yourself iterating through the desing and furthering your understanding in each iteration.
Regards.
Bharat
Roy Augustine
Ranch Hand

Joined: Jul 08, 2003
Posts: 30
Hi all
Thanks for your reply.
I had some problems with my internet connection. So I couldnt read and respond to the postings on time. I am sorry about that.
I am still in confusion. But right now I have to go to school.
See you again
Roy
Roy Augustine
Ranch Hand

Joined: Jul 08, 2003
Posts: 30
Hi all,
I know what Bharat mean. Whatever be the case, networked mode or non networked mode, there is a server, the only difference is that, in networked mode the server is in a different JVM. But my fear is that, if I provide a server in the non networked mode is that againist assignment condition as I stated earlier?
My next question is, in non networked mode, why dont, I can just provide the data class without any server part? Is that break any conditions?
Thanks in advance.
Roy
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
Whatever be the case, networked mode or non networked mode, there is a server, the only difference is that, in networked mode the server is in a different JVM.
In a non-networked mode, there is no server, server JVM, networking, RMI, or sockets. The client simply opens a data file that is stored on the same machine.
Bharat Ruparel
Ranch Hand

Joined: Jul 30, 2003
Posts: 493
Hello Eugene/Roy,
Eugene wrote:

The client simply opens a data file that is stored on the same machine.

It may be simplifying it a bit. The data file is stored on the disk somewhere. The code that uses Data.class in conjunction with other classes, e.g., DataSchema.class can be viewed as the Database Server. May be you want to wrap Data Class in another class to provide higher level "Book", "Find" operations which use the services of the Data Class' services, e.g., lock, unlock, read, etc. This code base is common to the solution whether used in a networked mode or standalone mode. It is useful to think of this codebase as the Database Server especially for the beginners so as to factor out the common functionality. Hence the terminology.
Regards.
Bharat
Roy Augustine
Ranch Hand

Joined: Jul 08, 2003
Posts: 30
Hi Eugene/Bharat,
I think we all are in the same page. In non networked mode we are not using java.rmi or Socket or ServerSocket classes to create a server. But we can call our database system (term used by Sun) a server, as Bharat said. We use the actual server- server using rmi or socket -just for networked mode.
Thank you all
Roy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to create Server
 
Similar Threads
What does IE 8 Cache?
RMI:Placing different objects on different ports
online help
Deploying a dynamic web project output as folder in eclipse
Hardware Location