> How can I make it so that the SampleClient can run alone. I want to be
> able to make changes to the SampleServer without having to copy a new
> .class to the remote client with every change.
> That is the remote interface.
Ok, I see now.
So I can change the ...Impl.class to change the implementation, but I
always need the /stub/, SampleServer.class near the client.
Thanks!!!
> Note it is just an interface the implementation is in the class
> SampleServerImpl which can be left entirely serverside.
[quoted text clipped - 6 lines]
>
> http://i1.tinypic.com/xknpcz.png
WOW!
Is there a book that goes along with that UML ?
:D
VisionSet - 09 May 2006 00:59 GMT
> > My personal favorite way to do this is via what I call the mirrored
> > interface pattern:
[quoted text clipped - 4 lines]
>
> Is there a book that goes along with that UML ?
Well...
Remote is java.rmi.Remote
my DBRemote is your SampleServer
my DBRemoteImpl is your SampleServerImpl
my DBRemoteImpl_Stub is generated automatically by the RMI 'engine' as is
yours, you can't see it, but this is what you get when you do
Naming.lookup(), it is the object you get from this that implements your
remote interface (SampleServer) and this is why you need it on the client.
But, also the server too!
That just leaves my DBClient interface, DataAdapter and RemoteDBClient
classes that you don't have and these are specifically to decouple both
client and server side code from the RMI API. The classes implement
DBClient, which is a copy of the DBRemote, except no RMIExceptions are
thrown so therefore, it is not dependent on RMI code. The classes then wrap
a remote reference (stub or skeleton) one on the server side and one on the
client side. DataAdapter does the real server buisness work, while
DBRemoteImpl adapts this to RMI. RemoteDBClient wraps the stub and strips
out all the RMIExceptions and passes them to clients as some
IDontCareWhatCausedThisButThereWasSomeGeneralTransportException.
--
Mike W