|
This project is hosted on
|
|
Network Discovery in Plover
Network discovery is an add-on service in Plover that is modeled on lines
similar to the Jini discovery mechanism. Using this service, Plover clients can
locate corresponding server-side hosting environments to establish communication
with the same. This is performed in absence of a dedicated locator service that
can become a single point of failure.
Network discovery is available only for RMI transport and that too, only within
the Intranet. The network, to which all hosting environments and clients are
connected, should not restrict the transmission of IP multicast packets.
An Example Discovery
The following code example shows how you can perform a network discovery within
the Intranet for RMI-based transport.
import omd.plover.invoker.*;
...
InvokerFactory factory = new InvokerFactory();
IPloverInvoker[] invoker = factory.discoverAll();
invoker[0].setAuthInfo("user", "pass");
...
|
In this example, it is assumed that both RMI transport and discovery service are
enabled on the server-side hosting environment using default parameter values.
The discoverAll() method returns a list of Plover invokers,
pre-configured with the connection string, to connect to respective hosts within
the Intranet. You need to set extra connection parameters (authentication
information as shown above) on these invoker instances, separately.
Filtered Discovery
In the above example, the result of discovery will create invokers for all
hosting environments that are available within the network. This might be
undesirable in cases where there are different hosting environments with
mutually exclusive capabilities (e.g. a file hosting service and an access
control service). In such cases, we need to perform appropriate filtering during
the discovery process.
The sample XML configuration below shows how you can specify information about
a server-side entity hosting environment.
<plover-host type="fileserver" version="2.1.2">
<rmi-server>
<discovery>
</plover-host>
The information includes the type and version of the service being provided. You
can also set these values programatically using appropriate methods defined in
the omd.plover.hosting.spi.IHostConfig interface.
On the client side, you can now perform a filtering on the discovery result as
shown in the code example below.
import omd.plover.invoker.*;
...
InvokerFactory factory = new InvokerFactory();
IPloverInvoker[] invoker = factory.discover("fileserver", "2.1.2");
...
|
This will return Plover invokers corresponding to only those hosting
environments that specify the service type as "fileserver" and the version as
"2.1.2".
|