Interface ContainerActivator

All Known Implementing Classes:
ApplicationLoader, TestDriver

public interface ContainerActivator

This interface defines the API for changing the active Container of a jDISC application. An instance of this class is typically injected into the Application constructor. If injection is unavailable due to an Application design, an instance of this class is also available as an OSGi service under the full ContainerActivator class name.

This interface allows one to create and active a new Container. To do so, one has to 1) call newContainerBuilder(), 2) configure the returned ContainerBuilder, and 3) pass the builder to the activateContainer(ContainerBuilder) method.

Author:
Simon Thoresen Hult
  • Method Details

    • newContainerBuilder

      ContainerBuilder newContainerBuilder()
      This method creates and returns a new ContainerBuilder object that has the necessary references to the application and its internal components.
      Returns:
      The created builder.
    • activateContainer

      DeactivatedContainer activateContainer(ContainerBuilder builder)
      Creates and activates a Container based on the provided ContainerBuilder. By providing a null argument, this method can be used to deactivate the current Container. The returned object can be used to schedule a cleanup task that is executed once the the deactivated Container has terminated.
      Parameters:
      builder - The builder to activate.
      Returns:
      The previous container, if any.
      Throws:
      ApplicationNotReadyException - If this method is called before Application.start() or after Application.stop().