Class BHiveRegistry

java.lang.Object
io.bdeploy.bhive.remote.jersey.BHiveRegistry
All Implemented Interfaces:
AutoCloseable

public class BHiveRegistry extends Object implements AutoCloseable
The BHive registry holds all instances of BHive which are served by the server.

The registry can hold BHive which are manually registered as well as BHives discovered when scanning a registered location.

  • Constructor Details

  • Method Details

    • getRequiredPermission

      public ScopedPermission.Permission getRequiredPermission(BHive hive)
    • addManifestSpawnListener

      public void addManifestSpawnListener(BHiveRegistry.MultiManifestSpawnListener listener)
      Parameters:
      listener - a listener to be notified if Manifests spawn in any of the registered BHives.
    • removeManifestSpawnListener

      public void removeManifestSpawnListener(BHiveRegistry.MultiManifestSpawnListener listener)
      Parameters:
      listener - a previously registered BHiveRegistry.MultiManifestSpawnListener.
    • register

      public void register(String name, BHive hive)
      Manually register an additional (non-discovered) BHive to be available in the registry.

      Note that this BHive will be closed along with all other BHive when the registry is destroyed.

    • unregister

      public void unregister(String name)
      Removes this hive from the registry and closes all open resources
      Parameters:
      name - the hive to remove.
    • get

      public BHive get(String name)
      Retrieve a named BHive.
    • getAll

      public Map<String,BHive> getAll()
      Returns:
      all registered BHives
    • getLocations

      public Set<Path> getLocations()
      Returns:
      all locations which have been scanned for BHives
    • scanLocation

      public void scanLocation(Path location, Function<Path,Auditor> auditorFactory)
      Parameters:
      location - the location to scan for available BHives (recursively).
    • binder

      public org.glassfish.hk2.utilities.Binder binder()
      Returns:
      the HK2 Binder which can be used to provide the BHiveRegistry using dependency injection.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable