Class BootstrapRegistry

All Implemented Interfaces:
GlobalInvocationResolver, GlobalRegistryServiceProvider, ConfMgrRegistry, ADEPT2Service, AuthenticatingService, LogService, NameResolution, ServiceThreadHandling
Direct Known Subclasses:
TwoPhaseBootstrap

@ConfigurationDescription(properties={@Property(name="Components.ClientService",isRequired=true,description="A required service to provide clients convenient access to platform services."),,,,,,}) public class BootstrapRegistry extends ServiceRegistry
This bootstrap registry is the central entity from which other registries and services can be retrieved. Therefore this registry kind of represents the whole platform. After bootstrapping, the convenience methods for the client service and the registry (wrapper) can be used. While the client service provides access to services for usage by clients, the registry wrapper provides access the way server services have.
Bootstrapping consists of creating the bootstrap registry which implicitly validates its configuration and the actual bootstrapping.

The configuration of a bootstrap registry requires the client service, a security manager identifying an org model manager which will be used for authentication in the platform as well as an arbitrary instance name for the registry. The name is used for logging and identifying the API user of the registry (client service and registry wrapper).

  • Field Details

    • instanceName

      protected final String instanceName
      The name of the bootstrap registry, which equals the configured name of the platform (client or server).
  • Constructor Details

    • BootstrapRegistry

      protected BootstrapRegistry(UrlConfigurationManager confMgr, Class<? extends BootstrapRegistry> bootstrapClass) throws AbortServiceException
      Creates a new bootstrap registry having the designated configuration manager. Before creating the registry, the root configuration will be validated against the designated class.
      Parameters:
      confMgr - The initial configuration manager that provides the root configuration and configurations for the loaded component instances.
      bootstrapClass - The class the root configuration is validated against the configuration description. Use this class unless you have a subclass that has its own configuration description. This class is also used for retrieving the release information from the version file.
      Throws:
      ConfigurationException - If the registry configuration is invalid, a ConfigurationExceptionwill be thrown.
      AbortServiceException - If the initialisation or starting of the registry fails, an AbortServiceException will be thrown.
  • Method Details

    • bootstrap

      protected void bootstrap() throws AbortServiceException
      Bootstraps this registry and therefore the platform. The registry is initialised with either the configured URI or a local URI with the instance name. Afterwards the registry is started.
      Throws:
      AbortServiceException - If the initialisation or starting of the registry fails, an AbortServiceException will be thrown.
    • shutdown

      public void shutdown(boolean emergency)
      Description copied from class: LocalServiceRegistry
      Shut down all started services.
      Specified by:
      shutdown in interface ADEPT2Service
      Overrides:
      shutdown in class LocalServiceRegistry
      Parameters:
      emergency - Whether the shutdown will be an emergency shutdown.
    • terminate

      protected void terminate(boolean emergency, String hierServName)
      Description copied from class: LocalServiceRegistry
      Terminates all started services or until the designated service and signals the shutdown of this registry. If a service name is provided all services will be shut down that have been started after the designated service. The shutdown of the registry will not be signalled yet.
      Just call this method again afterwards using null as service name.
      Overrides:
      terminate in class LocalServiceRegistry
      Parameters:
      emergency - Whether it is an emergency shutdown.
      hierServName - The hierarchical name of the service until which to shutdown all services started later. If this is null, all services and the registry will be shut down.
    • resolveInstanceName

      protected Pair<String,String> resolveInstanceName(Configuration conf) throws ConfigurationException
      Description copied from class: ServiceRegistry
      Gets the cluster and the instance name for this registry from the designated configuration.

      Note that this method is called from the constructor and must not rely on instance fields!

      Specified by:
      resolveInstanceName in class ServiceRegistry
      Parameters:
      conf - The configuration to retrieve the instance name from.
      Returns:
      The cluster and the instance name for this registry from the designated configuration. The cluster name may be null.
      Throws:
      ConfigurationException - If the instance name does not exist in the configuration, a ConfigurationException will be thrown. However, this should never happen if the configuration is validated beforehand.
    • prepareGlobalSecurityManager

      public GlobalSecurityManager prepareGlobalSecurityManager() throws ServiceNotKnownException
      Description copied from class: LocalServiceRegistry
      Prepares the security manager that is, the global security manager will be retrieved (and started) if necessary.
      This method will be called before (auto) starting any service. Implementations may then prepare a global security manager and provide it appropriately. Before this method has been called, the security manager will authenticate locally. Afterwards it will work with the global security manager.
      Specified by:
      prepareGlobalSecurityManager in class LocalServiceRegistry
      Returns:
      The prepared global security manager to use instead of the local authentication.
      Throws:
      ServiceNotKnownException - If the security manager could not be retrieved, a ServiceNotKnownException will be thrown. The registry must not continue starting in this case!!
    • getClientService

      protected ClientService getClientService() throws ServiceNotKnownException
      Gets the client service providing convenient access to the services provided by this registry and needed by client components.
      Returns:
      The registry for usage by client components.
      Throws:
      ServiceNotKnownException - If there are problems loading the registry, a ServiceNotKnownException will be thrown.
    • getRegistry

      protected Registry getRegistry() throws ServiceNotKnownException
      Gets the wrapper for access to this registry via the Registry -interface. This is used by (server) services to access the registry. Clients should always use an appropriate client service. Only use this registry for very special purposes.
      Returns:
      The registry wrapper for this registry.
      Throws:
      ServiceNotKnownException - If there are problems loading the registry, a ServiceNotKnownException will be thrown.