Package com.yahoo.jdisc.application
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 Summary
Modifier and TypeMethodDescriptionactivateContainer
(ContainerBuilder builder) Creates and activates aContainer
based on the providedContainerBuilder
.This method creates and returns a newContainerBuilder
object that has the necessary references to the application and its internal components.
-
Method Details
-
newContainerBuilder
ContainerBuilder newContainerBuilder()This method creates and returns a newContainerBuilder
object that has the necessary references to the application and its internal components.- Returns:
- The created builder.
-
activateContainer
Creates and activates aContainer
based on the providedContainerBuilder
. 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 beforeApplication.start()
or afterApplication.stop()
.
-