1 Description OODVS
is a library which goal is to increase
the Java support for Distributed Virtual Systems providing local access
to distributed resources via proxies. Our main componets are Participants, Entities,
Proxy
Enties, Proxy Methods and Remote Methods.
1.1 License This
library is free software; you can
redistribute it and/or modify it under the terms of the GNU Lesser
General Public License as published by the Free Software Foundation;
either version 2.1 of the License, or (at your option) any later
version. This library is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
General Public License for more details. You should have received a
copy of the GNU Lesser General Public License along with this library;
if not, write to the Free Software Foundation, Inc., 59 Temple Place,
Suite 330, Boston, MA 02111-1307 USA. 1.2 Downloads
Home page: http://oodvs.sourceforge.net Project page: http://sourceforge.net/projects/oodvs
1.3 Contact Information
|
| public interface EntityExample_I { public void printMsg_TCPP(String msg) throws RMClientException; public void printMsg_UDPP(String msg) throws RMClientException; } |
|
public class EntityExample extends Entity implements EntityExample_I { public EntityExample(String name) throws
RMClientException { public void printMsg_TCPP(String msg) throws
RMClientException { public void printMsg_UDPP(String msg) throws
RMClientException { } |
The next code part creates a participant "A"
and
adds a
Entity "A1" to it.
A proxy handler of entity
"A1" is obtained.
The proxy handler is used to invoke the two proxy methods, the
handler uses the prefic of the method name (UDPP,TCPP) to determine how
to handle the method invocation.
|
Participant a = new Participant("A").start(); EntityExample_I handler= (EntityExample_I) a.getHandler("A1",0); handler.printMsg_UDPP("hello 1."); |
The next code part creates a
participant
"B".
Participants "A" and "B" will eventualy discover each other and
send proxys to each other.
After particpant "B" is created a proxy for the entity "A1", will
be retrieved.
Then the local method getName of the proxy will be invoked.
Finally a proxy handler for the proxy "A1" will be obtained
Then the handler will be used to
invoke the a proxy method.
|
Participant b = new Participant("B").start(); EntityExample proxy = (EntityExample)
b.getEntity("A1",0); handler = (EntityExample_I)proxy.getHandler(); |
These are the interface and class
for the
object to be used for remote method invocation in the next code
fragments.
| public interface ObjectExample_I { public String msg1(String name) throws Exception; } |
| public class ObjectExample implements
ObjectExample_I
{ public String msg1(String str) { System.out.println(str); return "RE: "+ str ; } } |
A remote method server is
created and
started .
An object is created and added to the
server to be ready for remote invocations.
| RMServer server = new RMServer().start(); server.putObject("O1", new ObjectExample()); |
This is the client part, a handler is created and used to perform the remote method invocation.
|
RMClientContext cc = new RMClientContext("HTTP://localhost"); |
These are the interface and class
for the
object to be used for remote method invocation in the next code
fragments.
| public interface ObjectExample_I { public String msg1(String name) throws Exception; } |
| public class ObjectExample implements
ObjectExample_I
{ public String msg1(String str) { System.out.println(str); return "RE: "+ str ; } } |
This is the server part.
This code part firts creates
and intializes the server if the keyDir and keys does not
exists it will be created.
UDP information is especified as part of the initialization for UDP
remote
method invocations.
Finally the server is started.
An object is created and added to the server to be ready for
remote
method invocation.
|
FileUtils.mkdirs("keyDir"); server.putObject("O1", new ObjectExample()); |
This is the client part, a RMClientContext is created and used to obtain handlers to perform remote method invocations using various protocols.
|
RMClientContext context; ObjectExample_I handler; handler = (ObjectExample_I)
context.getHandler(RMClient.RM_UDP_V1_0, ObjectExample_I.class, "/O1"); handler = (ObjectExample_I)
context.getHandler(RMClient.RM_HTTP_SIG_V1_0, ObjectExample_I.class,
"/O1"); |
Every window in these examples is a diferente participant,
each participant sees it entites and proxy enties of other
participants. This examples ilustrates the implemtation of
physics predictive and convergence algorithms, an various
visualization techniques using OODVS.
OODVS Object Oriented Distributed Virtual Systems
RMI Remote Method Invocation (TCP,UDP,HTTP)
RPC Remote Procedure Call
TCP Transmission Control Protocol
UDP User Datagram Protocol (broadcast and multicast)