aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Atlast i have come with some design. (critics are invited) 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 "Atlast i have come with some design. (critics are invited)" Watch "Atlast i have come with some design. (critics are invited)" New topic
Author

Atlast i have come with some design. (critics are invited)

Siddharth Mehrotra
Ranch Hand

Joined: Aug 21, 2001
Posts: 185
my design,
I have the following set of interfaces and classes, Please do peek in and find out the flaws that it might have.
-----------
DB side
-----------
1> DataInterface it defines all the public methods of Data class.
2> RemoteDataInterface it extends DataInterface and Remote
3> LocalDataImpl it extends Data and implements DataInterface
4> RemoteDataImpl it extends Data and implements RemoteDataInterface
5> DataFactory it will return either LocalDataImpl or RemoteDataImpl depending upon the input given to its constructor. the returned object will be of type Data class.

---------
Server Side
---------
6>LockManager this is a singleton class, so that there are no two copies of it on server. It will have all the locking and unlocking code and also the collection object for storing the locked records.
7> DataServer
8> DataServerFactory
i havent figured out anything for the above two( i.e ponts 7 and 8), i dont know if i should go for the factory stuff of just have the DataServer for extending UniCastRemoteObject
9> Timer class, planning to use it to remove stale locks, that remain when client crashes. I have decieded to use it as i'am not able to implement unrefrenced interface. i might use the unrefrenced interface as soon as i start getting it, but till then i plan to use Timer to remove stale locks.
------------
Client side
-----------
10> FBNClient this is the GUI control of the application. User input as to how he wants to connect will be taken from a dialog input, and that input is passed to the DataFactory. (might use Facade pattern here)


SCJP, SCJD.
Terry Wang
Ranch Hand

Joined: Aug 27, 2001
Posts: 102
are you copying my design? hehe, just kidding.
i didn't use factory on server side, others are almost the same.


scjp/jd/wcd/mcad/scea 1
Siddharth Mehrotra
Ranch Hand

Joined: Aug 21, 2001
Posts: 185
Originally posted by An Wang:
are you copying my design? hehe, just kidding.
i didn't use factory on server side, others are almost the same.

Hi dont remember reading anyone's post but read a lot of design related questions on this board. and went through the design patterns book. Last night even i was thinkin wether i should go on or drop factory on server side, kepping that question open for some time more, tell me have u used unrefrenced interface on server, i wish to use that but that method
public void unreferenced()
is not being called even after 30 mins , and as far as i know that the average time for it is 15 mins after the client has died.
can u through some light on it..
Siddharth Mehrotra
Ranch Hand

Joined: Aug 21, 2001
Posts: 185
helloo everyone,
isin't there anyone who can give me some constructive comments.
I do have some doubts on my design and there are some topics of it that i dont know how to do, i have made those comments in my post.
its been 24 hrs and still only one person popped on my Topic.
Burk Hufnagel
Ranch Hand

Joined: Oct 01, 2001
Posts: 814
    
    3
Hi,
If you've read a lot of the older posts then you should know that by having a factory class that is registered which returns a uniques instance of your DataServer then the DataServer can act as a proxy to the LockManager (which lets LockManager identify each client while letting the client just call lock(record) ) whereas if you just register the DataServer then every client will call the same object and you can't tell who's who without modifying the lock signature.
Or, at least, that's what I think.
Burk


SCJP, SCJD, SCEA 5 "Any sufficiently analyzed magic is indistinguishable from science!" Agatha Heterodyne (Girl Genius)
Siddharth Mehrotra
Ranch Hand

Joined: Aug 21, 2001
Posts: 185
hi Burk,
at last someone replied.
can u explain the stuff that u explained in a bit detail.
and lastly what do you feel about the design
[ March 22, 2002: Message edited by: Siddharth Mehrotra ]
Siddharth Mehrotra
Ranch Hand

Joined: Aug 21, 2001
Posts: 185
whats up no one out of sleep yet.
Siddharth Mehrotra
Ranch Hand

Joined: Aug 21, 2001
Posts: 185
as per the deisgn i plan to have
i have come up with the following design for points 7 and 8.
My DataServerFactory will have multiple instances ( say 5) of DataServer in it. and all requests will be circled through these objects.
i feel that by doing this way i will be able to service requests faster.
Laudney Ren
Ranch Hand

Joined: Jan 06, 2002
Posts: 111
Your design looks terrific and sound! Just go ahead.
Just one simple question:
What does DataServer do?
-- Laudney


" Veni, vidi, vici "<br />" I came, I saw, I conquered "
Siddharth Mehrotra
Ranch Hand

Joined: Aug 21, 2001
Posts: 185
Originally posted by Laudney Ren:
Your design looks terrific and sound! Just go ahead.
Just one simple question:
What does DataServer do?
-- Laudney

hi, thanks for the review. i was waiting for someone tor respond.
even i was thinkin for that dataserver thing.
i have modified the design a bit.
I dont have dataserverfactory class now. Its just the DataServer class there now. this class will extend unicastremoteobject and will wrap the calls to the data class. and will interact with lockmanager class for lock/unlock mechanism
amit ahuja
Ranch Hand

Joined: Nov 20, 2001
Posts: 38
Hi Siddharth,
It seems we are from same planet or atleast our planets are near by in the galaxy.
Becoz i too have very same design except just timer class (i don't do cleaning job...)
I have nearly finished my coding.. just tits-bits left here and there.
keep up the good work...
amit
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

1> DataInterface it defines all the public methods of Data class.
2> RemoteDataInterface it extends DataInterface and Remote

I have seen a good number of people take this approach and get great marks. My take on it it that there is redundancy there. I only had one interface, it extended Remote, but the methods only threw Exception. In my implementation I throw the more specific RemoteException for my Implementation of Remote.
With that said, it is up to you. and it is fine the way you have that.
the returned object will be of type Data class.

don't you mean it returns type DataInterface?
i havent figured out anything for the above two( i.e ponts 7 and 8), i dont know if i should go for the factory stuff of just have the DataServer for extending UniCastRemoteObject

This to me says Connection Object, which is the way you want to go.
Point 9 - USE UNREFERENCED. lol
You RemoteImplementation will implement unreferenced. Like all interfaces you just need to declare the methods in the interface. In this case there is only one method.:
public void unreferenced()
You make an implementation that will unlock all the records this client has, that's all you need to do.
But you design is right on track. Keep up the good work.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Siddharth Mehrotra
Ranch Hand

Joined: Aug 21, 2001
Posts: 185
Originally posted by Mark Spritzler:

don't you mean it returns type DataInterface?
Mark

yes i went through my stuff , it is datainterface.
and about the unrefrenced interface
well i tried doing it seprately, i mean on a different code not of SCJD but that method unrefrenced was not called even after 20 mins.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

was not called even after 20 mins.

actually it is 15 minutes. that is the default.
You can change the default, but it really wasn't necessary for this assignment.
Try using it in the SCJD. Maybe your other test didn't have the object be a remote object, and the client loose connection, but keeping the remote object still on the server. I can't really help there, in figuring that code out. But try it in the Assignment. It is much easier to have than to have a timer, and figure things out manually.
Mark
 
 
subject: Atlast i have come with some design. (critics are invited)