-
Notifications
You must be signed in to change notification settings - Fork 35
Bootstrap Extensions
Trooper profiles are implementations for handling specific types of workloads such as Batch, Service and Orchestration. However there may be instances where a profile might needed to be extended - for e.g. providing a web-console or hosting a portal.
Extensions to Trooper runtime is possible by leveraging the Bootstrap Extension support. As the name suggests, a Bootstrap extension - an implementation of the BootstrapExtension
interface, is an add-on to the runtime bootstrap sequence that is executed before loading any configured ComponentContainer
. All initialized bootstrap extensions are also made available to the ComponentContainer
.
Bootstrap extensions are defined and used as explained below:
- Define a class class that implements the
BootstrapExtension
interface. TheApplicationContextFactory
is one such implementation of this interface that provides a convenient way to initialize a Spring Application Context. - Bootstrap extensions are declared in files named
bootstrap_extensions.xml
and deployed under the Trooper resources location i.e./resources/external
. A sample bootstrap configuration example :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<!--
Bootstrap extensions configuration. Loads the Jetty Server Beans
-->
<bean id="dashboardBootstrapExtension" class = "org.trpr.platform.runtime.impl.bootstrapext.BootstrapExtensionInfo">
<property name="beName" value="dashboardBootstrapExtension" />
<property name="beClassName" value = "org.trpr.platform.runtime.impl.bootstrapext.spring.ApplicationContextFactory" />
<property name="beProperties">
<map>
<entry key="jettyBean" value="jetty-config.xml"/>
</map>
</property>
</bean>
</beans>
In the above example, the file jetty-config.xml
contains bean definitions for bringing up a Jetty instance. This file too needs to be deployed under the Trooper resources location i.e. /resources/external
. A sample file with Jetty bean definitions : Embedded Jetty