Manager support

The IManagerSupport plugin is provided by the Manager. It is mainly concerned with locating workers, but also allows the manager to generate warrants. Warrants and other service issues are dealt with in Section [*].


public interface IManagerSupport
{
    /** Make up a new worker name for the given worker type.
     * @param worker_type  Worker type = netlet subtype.
     * @return New unique worker name or null if it could not create a
     *         worker name.
     */
    public String getNewWorkerName(String worker_type);

    /** Check if a worker name represents a worker of a given type.
     */
    public boolean isWorkerType(String worker_type, String worker_name);

    /**
     *  List all workers of a given type.  Workers are listed
     *  regardless of which manager created them.
     * @param worker_type  Worker type = netlet subtype.
     */
    public IWorkerHandle[] listWorkers(String worker_type);

    /**
     *  List all workers.
     */
    public IWorkerHandle[] listWorkers();

    /**
     *  Get a warrant for the specified service, with embedded warrant data.
     *  If Beatrix has a key pair this warrant will be signed.
     *  This warrant data will be available to createServiceSession calls
     *  (within Beatrix) which passes it straight on to the
     *  createFacetCollection call of IServiceProvider.
     * @param service_type  Service which the warrant will grant access to.
     * @param warrant_data  Arbitrary data which will go into the warrant and
     *                      provides extra information to the service provider.
     */
    public Warrant getWarrant(String service_type, Property warrant_data)
        throws BeatrixException;

    /** Get the private key for the application, so it can sign and encrypt
     * things. As added when creating the Beatrix launch descriptor, and set
     * in the application descriptor.
     */
    public PrivateKey getPrivateKey();

    /** Set the load balancing comparator for a specific service type. This
     ** Set how netlets should load balance for a specific service type. We set
     *  a comparator to order IManagedHandles in a manner specific to the
     *  service type. Here is a (not very useful) Comparator which orders
     *  netlets alphabetically by name:
     *  <p>
     *  <pre>
     *  int compare(Object o1, Object o2)
     *  {
     *      IManagedHandle handle1 = (IManagedHandle)o1;
     *      IManagedHandle handle2 = (IManagedHandle)o2;
     *
     *      return handle1.getLabel().compareTo(handle2.getLabel());
     *  }
     *  </pre>
     *  <p>
     *
     *  The default for all service types will order the servers with
     *  the one with the least number of connections first.
     */
    public void setAccessServerLoadBalancer(String service_type, 
                                            java.util.Comparator comparator);

    /** Utility class helping lookup.
     */
    public static class Get
    {
        /** Get the only instance of this plugin in the given manager.
         * Only the first such plugin is returned. If there isn't one then
         * an ArrayIndexOutOfBoundsException is thrown.
         */
        public static IManagerSupport one(IPluginManager pm)
        {
            return ((IManagerSupport)pm.lookup(IManagerSupport.class)[0]);
        } 
    }
}

Here is another instance of the inner class method Get.one() for easier access to this plugin.

The method setAccessServerLoadBalancer() is used in very specialised circumstances. It allows us to implement custom load balancing for those netlets which access points connect to (i.e. the access servers).

Nik Silver 2002-03-09