 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
David Guest
|
Posted: Sun Nov 20, 2005 2:29 pm Post subject: Possibilities with RMI |
|
|
Hi,
I've been reading up on RMI but am still unsure if the following is
totally possible please advise, thanks.
I'd like to basically have a RMI Server working on 1 or more clients,
which connects to an overall server. I would like this server to send
out various different objects that implement a set interface. I would
like these sent over RMI, and processed on each client. The object then
- or a resulting object being returned. Can this be done so that the
RMI server on programmed into each client can contain no code about
what it has to call on the objects, only use the interface methods,
each object is guaranteed to implement?
Thanks for any help in advance.
David
|
|
| Back to top |
|
 |
VisionSet Guest
|
Posted: Sun Nov 20, 2005 2:39 pm Post subject: Re: Possibilities with RMI |
|
|
"David" <david.goodyear (AT) gmail (DOT) com> wrote
| Quote: | I'd like to basically have a RMI Server working on 1 or more clients,
which connects to an overall server. I would like this server to send
|
Yes, the server initiates the call on the clients yes?
So atypical direction, the server must know what port the client is
available on.
| Quote: | out various different objects that implement a set interface. I would
like these sent over RMI, and processed on each client. The object then
- or a resulting object being returned. Can this be done so that the
RMI server on programmed into each client can contain no code about
what it has to call on the objects, only use the interface methods,
each object is guaranteed to implement?
|
RMI always works like this. You just extend Remote interface and objects
you receive will be of this type.
You can use an adapter object client side, if you prefer, to strip out the
RMI specific RemoteExceptions.
Or have I misunderstood?
Mike W
|
|
| Back to top |
|
 |
Roedy Green Guest
|
Posted: Sun Nov 20, 2005 2:45 pm Post subject: Re: Possibilities with RMI |
|
|
On 20 Nov 2005 06:29:45 -0800, "David" <david.goodyear (AT) gmail (DOT) com>
wrote, quoted or indirectly quoted someone who said :
| Quote: | Can this be done so that the
RMI server on programmed into each client can contain no code about
what it has to call on the objects, only use the interface methods,
each object is guaranteed to implement?
|
In RMI, both ends must be compiled against identical code implementing
the classes. One end may end up using a stub, a class that has the
same signatures with each method implemented as a remote procedure
call.
Serialization, upon which RMI is based, can't create objects unless
the corresponding class file for them is present. So you can't for
example receive a Dog object as a return value (or send a Dog object
as a parameter for that matter) without the real Dog class being
present in the client.
One way to deal with pruning the list of classes in the client is to
use genjar.
see http://mindprod.com/jgloss/genjar.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
|
|
| Back to top |
|
 |
VisionSet Guest
|
Posted: Sun Nov 20, 2005 4:35 pm Post subject: Re: Possibilities with RMI |
|
|
"VisionSet" <spam (AT) ntlworld (DOT) com> wrote
| Quote: |
"David" <david.goodyear (AT) gmail (DOT) com> wrote in message
news:1132496985.204295.292230 (AT) o13g2000cwo (DOT) googlegroups.com...
RMI always works like this. You just extend Remote interface and objects
you receive will be of this type.
You can use an adapter object client side, if you prefer, to strip out the
RMI specific RemoteExceptions.
Or have I misunderstood?
|
Sorry if these opinions differ, I probably misunderstood.
I'm talking about the remote objects themselves, these never actually leave
the machine, RMI creates a stub at the other end that implements your Remote
interface.
Roedy is correct when talking about other objects.
You could also, instead of a common jar, create one app that runs in two
modes depending on the command line that launches it.
--
Mike W
|
|
| Back to top |
|
 |
Alex Molochnikov Guest
|
Posted: Sun Nov 20, 2005 7:00 pm Post subject: Re: Possibilities with RMI |
|
|
One small addition to what Roedy said: instead of having the required
implementation classes packaged into the client's jar file and deployed with
the client, you can keep them on the server side, and write a custom class
loader to fetch them from the server when needed. This way the client will
always get the latest version of the implementation.
Alex Molochnikov
Gestalt Corporation
"David" <david.goodyear (AT) gmail (DOT) com> wrote
| Quote: | Hi,
I've been reading up on RMI but am still unsure if the following is
totally possible please advise, thanks.
I'd like to basically have a RMI Server working on 1 or more clients,
which connects to an overall server. I would like this server to send
out various different objects that implement a set interface. I would
like these sent over RMI, and processed on each client. The object then
- or a resulting object being returned. Can this be done so that the
RMI server on programmed into each client can contain no code about
what it has to call on the objects, only use the interface methods,
each object is guaranteed to implement?
Thanks for any help in advance.
David
|
|
|
| Back to top |
|
 |
Daniel Dyer Guest
|
Posted: Sun Nov 20, 2005 10:43 pm Post subject: Re: Possibilities with RMI |
|
|
On Sun, 20 Nov 2005 14:29:45 -0000, David <david.goodyear (AT) gmail (DOT) com> wrote:
| Quote: | I'd like to basically have a RMI Server working on 1 or more clients,
which connects to an overall server. I would like this server to send
out various different objects that implement a set interface. I would
like these sent over RMI, and processed on each client. The object then
- or a resulting object being returned. Can this be done so that the
RMI server on programmed into each client can contain no code about
what it has to call on the objects, only use the interface methods,
each object is guaranteed to implement?
|
I'm sure you can do what you want with pure RMI, but it sounds like what
your trying to achieve would be a suitable application for JavaSpaces.
Take a look at these links, it might save you some work. The third one
seems to be the kind of thing that you are trying to develop (correct me
if I am wrong):
http://java.sun.com/developer/Books/JavaSpaces/introduction.html
http://www.javaworld.com/javaworld/jw-11-1999/jw-11-jiniology.html
http://www.javaworld.com/jw-01-2000/jw-01-jiniology.html
Dan.
--
Daniel Dyer
http://www.dandyer.co.uk
|
|
| Back to top |
|
 |
David Guest
|
Posted: Mon Nov 21, 2005 1:46 pm Post subject: Re: Possibilities with RMI |
|
|
Hi, thanks to everyone for all your answers. JavaSpaces seems an ideal
candiate to solve the problem. Im stil reading it all up now :S.
Yet another question :-
Does anyone know however, if the space can be run in an encryted link,
without the need for servers with SSL certificates? Maybe if anyone has
seen example code of this on the web somewhere as well?
Thanks yet again
David
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|