Meanwhile, here is how a client would use a warrant to bind to our
skeleton service (the SkeletonServiceProvider, Section ![[*]](crossref.png) ).
This is just general Jtrix code, to be used by any consumer who is
using our service, and not specific to Beatrix.
).
This is just general Jtrix code, to be used by any consumer who is
using our service, and not specific to Beatrix.
try
{
    // Assumes _node is an INode interface to our node
    Warrant  my_warrant          = // ...Some warrant to the "skeleton" service
    IService my_consumer_service = // ...Some service. If we're using Beatrix this
                                   // could be generated using IPeerSupport
    IService service = _node.bindService(my_warrant, my_consumer_service);
    String sf_name = ISkeletonFacet.class.getName();
    ISkeletonFacet facet = (ISkeletonFacet)(service.bindFacet(sf_name));
    // Now use this facet
}
catch(ServiceBindException e)
{
    // ...
}
catch(FacetBindException e)
{
    // ...
}
Beatrix plugins can get direct access to the local node using the IPeerSupport.getLocalNode() method:
    IPeerSupport ps = (IPeerSupport) _plugin_manager.lookup(IPeerSupport.class)[0];
    INode n = ps.getLocalNode();
    IService service = n.bindService(my_warrant, my_consumer_service);
    // Or if this is a subclass of AbstractPlugin...
    INode n = peerSupport().getLocalNode();
    IService service = n.bindService(my_warrant, my_consumer_service);
Recall that the IPeerSupport plugin also contains a simple createClientSession() method to help create reciprocating consumer service sessions.
Nik Silver 2002-03-09