Scope
The Microcontainer extension is the default operational implementation of the JBoss Bootstrap project. It integrates a configured Bootstrap to be backed by JBossMicrocontainer and, as a result, brings in the MC internals as part of the dependency chain. In many senses, jboss-bootstrap-spi-mc is a simplified facade atop MC itself, though it does allow for direct hooks into the underlying Kernel.
Modules
Module Name | Maven2 ID |
---|---|
api-mc | org.jboss.bootstrap:jboss-bootstrap-api-mc |
spi-mc | org.jboss.bootstrap:jboss-bootstrap-spi-mc |
impl-mc | org.jboss.bootstrap:jboss-bootstrap-impl-mc |
Sample Code
Booting an MC Server pointed at an explicit configuration
// Create a configuration final MCServerConfig config = new BasicMCServerConfig() .bootstrapHome("file:/path/to/home").bootstrapName("custom.xml"); // Create the server final MCServer server = new MCServerImpl(config); // Start server.start();
Using a factory to create an MC Server with default configuration
final ClassLoader cl = null; // Assume we have this final MCServer server = MCServerFactory.createServerWithDefaultConfiguration(cl);
Programmatically Installing an MC Bean into the Server
// Create and start the server final MCServer server = null; // Assume we get this from somewhere server.start(); // Construct BeanMetaData final Pojo pojo = new Pojo(); final String mcBindName = "example.MyPOJO"; final BeanMetaData beanMD = BeanMetaDataBuilder.createBuilder(mcBindName, pojo.getClass().getName()).getBeanMetaData(); // Install into the Server via the MC Kernel server.getKernel().getController().install(beanMD, pojo);
Comments