A big point of interest is the bindService() method of INetlet.
We'll ignore its parameters for now, but let's have a look at IService
itself (Section
). It's just a collection of facets
which can be terminated together. So any IService interface
has to implement the following methods. Note these are described from
an implementor's point of view, not a client's point of view:
- getFacets() needs to return a list of those facets this service
connection supports. In our case, just the one.
- bindFacet(). Called by the client when it wants to bind a
particular facet. If it doesn't request the IHelloFacet we
should throw an exception.
- terminate() needs to respond to the connection with the client
being severed. The node actually terminates the connection, possibly
on the request of the client. When we receive a call here it's just
a notification.
Notice that these three methods appear not only in the IService
interface, but also in the INetlet interface. However, let's
not confuse them. Each method does the same sort of thing in both
interfaces, but they're used in completely different contexts. The
INetlet interface is presented to a node, so it can talk
to the netlet, and so there the methods offer facets to the node,
and respond to netlet termination from the node. But the IService
interface is presented to another netlet, making a service connection,
and so there the methods offer facets to the other netlet and respond
to a termination of the service connection.
If you didn't get all that, it's worth reviewing. An IService
interface represents a service connection to another netlet. The INetlet
interface is how the netlet presents itself to its node.
In particular, a call to INetlet.terminate() means ``This
netlet is about to terminate'', but a call to IService.terminate()
means ``The other netlet has terminated its connection to you''.
In that latter case perhaps other netlets are still using us and we'd
want to keep on running.
But in our current little example, if the client netlet terminates
its connection with us then we no longer serve a purpose and our access
point netlet will ask the node to put us out of our misery.
Nik Silver
2002-03-09