About our code

We only need one public class, a client netlet we'll call Hello3Client, and it works like this:

  1. Its initialise() method is minimal. It does (almost) nothing but return true.
  2. Meanwhile, our netlet offers the facet IBootstrapFacet, which the node will discover if it checks our getFacets() method. And in facet when Jnode runs a bootstrap netlet that's exactly the facet it does look for.
  3. Jnode will try to bind the facet by calling the bindFacet() method of our netlet. We have to return some object which implements IBootstrapFacet, so we'll return something called WarrantReader. This is an inner class. We also make sure we don't merely return it as-is--we wrap it in a FacetHandle, which we must always do when we return a facet to the world outside our netlet.
  4. Since the WarrantReader implements IBootstrapFacet it has a boot() method which the node will call. It will pass in an IManager and from this we'll take the IInputStream called warrant-in.
  5. We'll read the warrant through this input stream, bind it, and use it.
And finally a note on sequence: the node will always wait until the initialise() method is complete before it calls any other methods. So our IBootstrapFacet will be called after the initialise() method has returned. Actually, there is one exception to this: we might get terminated before the initialise() is done, but that's understandable, because termination could happen for any number of reasons and can't always be expected to be polite.

Nik Silver 2002-03-09