Regards,
Jim
SCJP, SCJD, SCWCD, SCEA Part I
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Regards,
Jim
SCJP, SCJD, SCWCD, SCEA Part I
Originally posted by Sai Prasad:
Jim,
In addition to DataClient, you need a Factory object in the server side which is instantiated by the RMI server during startup. You don't want to instantiate the DataClient by the RMI Server standalone java application. Instead, the server Factory object has a method to return the remote object DataClient to the client. You do have the DataClient at the right side of the connection.
Regards,
Jim
SCJP, SCJD, SCWCD, SCEA Part I
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Originally posted by Michael Morris:
Hi Jim,
Each client should have a unique connection into the database that way there is less danger of them clobbering each other.
Regards,
Jim
SCJP, SCJD, SCWCD, SCEA Part I
Originally posted by Sai Prasad:
Jim,
In addition to DataClient, you need a Factory object in the server side which is instantiated by the RMI server during startup. You don't want to instantiate the DataClient by the RMI Server standalone java application. Instead, the server Factory object has a method to return the remote object DataClient to the client. You do have the DataClient at the right side of the connection.
Samual Harvey<br />SCJP2<br />SCJD2
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
scwcd, scjd, scjp<br /><a href="http://natejohnson.us" target="_blank" rel="nofollow">http://natejohnson.us</a><br /><a href="http://rice.kuali.org" target="_blank" rel="nofollow">http://rice.kuali.org</a>
Originally posted by Michael Morris:
Hi Jim,
. . .it's just so much simpler to bind a connection factory to the registry and have that factory issue unique connection objects (which also extend UnicastRemoteObject) but that are not bound to the registry. That also solves the client ID problem: the client is uniquely identified by his connection object.
Regards,
Jim
SCJP, SCJD, SCWCD, SCEA Part I
scwcd, scjd, scjp<br /><a href="http://natejohnson.us" target="_blank" rel="nofollow">http://natejohnson.us</a><br /><a href="http://rice.kuali.org" target="_blank" rel="nofollow">http://rice.kuali.org</a>
Originally posted by Nate Johnson:
Here is what I did...
DataInterface has all public methods of Data
RemoteDataInterface implements Remote and DataInterface (some people will argue that this is an unneeded interface, but I just liked having it )
RemoteData extends UnicastRemoteObject and implements RemoteDataInterface -- it is the remote connection to Data
RemoteDataFactory extends UnicastRemoteObject and is bound into the registry -- its only purpose is a getConnection method that creates a new RemoteData and returns it to the client. This RemoteData can be used as the client id for locking because it is going to be unique.
Hopefully that helps some and didnt give away too much...
Regards,
Jim
SCJP, SCJD, SCWCD, SCEA Part I
There is a very handy paper entitled something like "Implementing Factories Using RMI". I've seen links to it in other discussion threads. It explains this factory approach perfectly.
Samual Harvey<br />SCJP2<br />SCJD2
scwcd, scjd, scjp<br /><a href="http://natejohnson.us" target="_blank" rel="nofollow">http://natejohnson.us</a><br /><a href="http://rice.kuali.org" target="_blank" rel="nofollow">http://rice.kuali.org</a>
Guys can you explain why Factory class has to extend UnicastRemoteObject ?
and what is the difference between RemoteDataInterface and RemoteData class and why we need both of them
Originally posted by Nate Johnson:
RemoteDataInterface implements my DataInterface and Remote.... I could have had RemoteData just implement my DataInterface and have DataInterface implement Remote, but I also use DataInterface for the local implementation.... I dont want any local stuff to be a "Remote" object.
Samual Harvey<br />SCJP2<br />SCJD2
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Samual Harvey<br />SCJP2<br />SCJD2
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Originally posted by Samual Harvey:
Nate,
Based on ur inputs, I further assume that on the client side, ur client when in local mode uses the DataInterface object directly which provides a direct access to the data object, and when in remote mode calls RemoteFactory which returns a RemoteData.
As per the factory design the factory class hides the object type from the user and it should return the different type of object based on the data provided to it, but your factory will always return you a RemoteData object, so is this just the name or the concept that your factory class is using.
scwcd, scjd, scjp<br /><a href="http://natejohnson.us" target="_blank" rel="nofollow">http://natejohnson.us</a><br /><a href="http://rice.kuali.org" target="_blank" rel="nofollow">http://rice.kuali.org</a>
Originally posted by Michael Morris:
That's not completely true, I had a third connection type called ServerControlConnection which was used by the server to lock and close the database. That type of connection was not available remotely though.
Samual Harvey<br />SCJP2<br />SCJD2
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Originally posted by Michael Morris:
Hi Samual,
I diverged from the instuctions by neither modifying (except to fix the depracated methods and to make some cosmetic changes) Data nor subclassing it. I used a Builder Pattern to create composites. . .
Regards,
Jim
SCJP, SCJD, SCWCD, SCEA Part I
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Originally posted by Michael Morris:
...but I can see how it could work.
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
DataInterface has all public methods of Data
RemoteDataInterface implements Remote and DataInterface (some people will argue that this is an unneeded interface, but I just liked having it )
RemoteData extends UnicastRemoteObject and implements RemoteDataInterface -- it is the remote connection to Data
DataInterface has all public methods of Data
RemoteDataInterface implements Remote and DataInterface (some people will argue that this is an unneeded interface, but I just liked having it )
RemoteData extends UnicastRemoteObject and implements RemoteDataInterface -- it is the remote connection to Data
scwcd, scjd, scjp<br /><a href="http://natejohnson.us" target="_blank" rel="nofollow">http://natejohnson.us</a><br /><a href="http://rice.kuali.org" target="_blank" rel="nofollow">http://rice.kuali.org</a>
and then I have a RemoteDataInterface that extends DataInterface and Remote
Originally posted by sumesh_aravind:
Thanks Nate!
But I am still confused with this line you wrote
How can I extend both?
scwcd, scjd, scjp<br /><a href="http://natejohnson.us" target="_blank" rel="nofollow">http://natejohnson.us</a><br /><a href="http://rice.kuali.org" target="_blank" rel="nofollow">http://rice.kuali.org</a>
Originally posted by CYJENNY WONG:
Hi Nate,
I just wonder what Exceptions you throws in
DataInterface's methods as RemoteDataInterface will also extends DataInterface & Remote
scwcd, scjd, scjp<br /><a href="http://natejohnson.us" target="_blank" rel="nofollow">http://natejohnson.us</a><br /><a href="http://rice.kuali.org" target="_blank" rel="nofollow">http://rice.kuali.org</a>
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|