aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes [NX]How to design the Server or accessing mode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "[NX]How to design the Server or accessing mode" Watch "[NX]How to design the Server or accessing mode" New topic
Author

[NX]How to design the Server or accessing mode

Richard Jackson
Ranch Hand

Joined: Jun 25, 2003
Posts: 128
Hello,every professionals!
I just downloaded my assignment(ver 1.2.3),and in it,you will see the following paragraphs about Server:
"Network Approaches
Your choice of RMI or serialized objects will not affect your grade, but no other approach is acceptable. In either case, the program must allow the user to specify the location of the database, and it must also accept an indication that a local database is to be used, in which case, the networking must be bypassed entirely. No authentication is required for database access.
Locking
Your server must be capable of handling multiple concurrent requests, and as part of this capability, must provide locking functionality as specified in the interface provided above. You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server. Any attempt to lock a resource that is already locked should cause the current thread to give up the CPU, consuming no CPU cycles until the desired resource becomes available. "
Please teach me the detail ways to implement the Server,and at the same time,I've two problems:
1)How to do to"lock a resource that is already locked should cause the current thread to give up the CPU"?
2)And how to do ... "local database is to be used, in which case, the networking must be bypassed entirely"?


Regards, Richard
frank sun
Ranch Hand

Joined: Apr 11, 2003
Posts: 102
Originally posted by Richard Jackson:
I've two problems:
1)How to do to"lock a resource that is already locked should cause the current thread to give up the CPU"?
2)And how to do ... "local database is to be used, in which case, the networking must be bypassed entirely"?

the first one, if one record is being locked, you have to wait the lock to be released, and try to obtain the opptunity to lock that record, you can use wait/notify mechanism to implement it.
the second one, in standalone mode, you can not use the serized approach to access the objects, that means, you can not depend on the RMI to do that in this mode.
Hope that help.
Frank. Jun 25,2003
[ June 25, 2003: Message edited by: frank sun ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Please teach me the detail ways to implement the Server
That sounds too general a question, I think. You ought to have some ideas of your own about this if you're taking the test. Perhaps if you explain your current ideas, we can offer suggestions? You also may want to buy Max Habibi's book, as it contains a complete sample project which is similar to what you'll have to do for the assignment.


"I'm not back." - Bill Harding, Twister
Richard Jackson
Ranch Hand

Joined: Jun 25, 2003
Posts: 128
Thanks for JIM and Frank.
In my starting point,I want to know the details about my assignment.So as my said,I've still two problems:
1)What does it mean the word "bypass" when you are asked for implementing the accessing database function through BYPASSing the networked-mode entirely?
2)The Data class is required data access class.According to this,can't I modify the name or create other classes to implement the accessing function?
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
1)What does it mean the word "bypass" when you are asked for implementing the accessing database function through BYPASSing the networked-mode entirely?
In this case "bypass" == "circumvent", if that helps. Create a solution in which you do not use the network classes at all if the standalone mode is invoked.
2)The Data class is required data access class.According to this,can't I modify the name or create other classes to implement the accessing function?
You can certainly create other classes. I would say all data should go through the Data class at some point. You can have other layers though, other classes that call the Data class, and the Data class can call on other classes (like a RandomAccessFile or FileChannel for example). But any time a user accesses or modifies data, somehow, somewhere there should be a call to a method in the Data class that handles the request.
Richard Jackson
Ranch Hand

Joined: Jun 25, 2003
Posts: 128
Thanks for Jim's answer.
But I still confuse the way to implement RandomAccessFile or FileChannel.Could you explain the detail procedures when I do the part of work.
Thanks again.
-------------------------------------------------
Regards,
Jackson
Richard Jackson
Ranch Hand

Joined: Jun 25, 2003
Posts: 128
Hi,all.
I am still confused some states in the instuctions.html file.One shows as follows,
All numeric values are stored in the header information use the formats of the DataInputStream and DataOutputStream classes.

1)What does it mean?
2)Need I do my work to write all the part of codes in the another header file(e.g called Header.java)? This mean that I must use DataInputStream and DataOutputStream classes to read and write data info?
Regards,
Richard.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [NX]How to design the Server or accessing mode