Hi Mike,
> I want to write a VisAD-Server based on Java-RMI. I want to connect
> several clients to this server. Every client can set the data on the
> server for his own to visualize the specific data.
>
> I read the documentation of VisAD. There is a short explanation of writing
> distributed VisAD programs based on RMI. In this example several clients
> share the same data reference objects on the server. So, when one clients
> want to set the data, the other clients see the changes on their displays.
> This is not what i want.
>
> How can I write such applications ?
As I understand, you want each client to set up its own context
and dialog with the server. This should not be difficult.
I'd do it by creating an interface, say RemoteMultipleServer, that
extends visad.RemoteServer, and a class, say RemoteMultipleServerImpl,
that extends visad.RemoteServerImpl and implements RemoteMultipleServer
(actually, there's probably no reason for these to extend RemoteServer
and RemoteServerImpl - the important thing is that RemoteMultipleServer
extend java.rmi.Remote, and that RemoteMultipleServerImpl extend
java.rmi.server.UnicastRemoteObject and implement RemoteMultipleServer).
I would create a method of RemoteMultipleServer / RemoteMultipleServerImpl,
say getRemoteServer(), that constructs a new RemoteServerImpl and returns
a RemoteServer reference to it. The arguments of getRemoteServer() would
specify the data the client wants from the server, and the getDataReference /
getDataReferences methods of the new RemoteServerImpl would return
RemoteDataReferences to the data wanted by the client (getRemoteServer()
would construct the required data and RemoteDataReferenceImpls to that data,
and pass them to the new RemoteServerImpl constructor). So the server code
would look something like:
RemoteMultipleServerImpl obj = new RemoteMultipleServerImpl();
Naming.rebind("//:/multiple_server", obj);
and the client code would look something like:
RemoteMultipleServer remote_obj
(RemoteMultipleServer) Naming.lookup("//server.ip.name/multiple_server");
RemoteServer server = remote_obj.getRemoteServer(data_spec_arguments);
RemoteDataReference data_ref = server.getDataReference(0);
If you wanted clients to be able to share data, then the getRemoteServer()
method could include an argument to identify a shared "domain" and there
could be another method of RemoteMultipleServer / RemoteMultipleServerImpl
that allows a client to get an already constructed RemoteServerImpl
according to its argument identifying a shared domain.
Please let me know if this is not clear or if you have problems with it.
Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI 53706
hibbard@xxxxxxxxxxxxxxxxx 608-263-4427 fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html