Version 6
    Scope

    The jboss-bootstrap base is responsible for providing a:

    • Simple configuration allowing a bootstrap to be parsed from XML
    • Server Start / Stop API
    • Lifecycle Event Notification system
    • Threadsafe implementation

     

    Intentionally left out-of-scope is:

     

    Modules
    Module Name
    Maven2 ID
    apiorg.jboss.bootstrap:jboss-bootstrap-api
    spiorg.jboss.bootstrap:jboss-bootstrap-spi
    impl-baseorg.jboss.bootstrap:jboss-bootstrap-impl-base

     

    Sample Code

    Start and shutdown a Server Using an Explicit ClassLoader

    final ClassLoader cl = Thread.currentThread().getContextClassLoader();
    final Server<?,?> server = ServerFactory.createServer(
      "some.package.ServerFullyQualifiedClassName",cl);
    server.start();
    // Do some tests
    server.shutdown();
    

     

    Register an Event Handler to Fire When the Server is Started

    final Server<?,?> server = null; // Assume we've got a server
    server.registerEventHandler(LifecycleState.STARTED,new LifecycleEventHandler()
      {
        public void handleEvent(final LifecycleState state) 
           throws LifecycleEventException 
        {
          log.info("I'm in state: " + state);
        }
      });
    server.start();
    

     

    Obtain and Use Typesafe Configuration

    // Define our server class
    class TestNoOpServer extends AbstractServer<TestNoOpServer, TestServerConfig>
          implements
             Server<TestNoOpServer, TestServerConfig> {// ...}
    
    // Define our server configuration class
    class TestServerConfig extends AbstractBasicServerConfig<TestServerConfig>
          implements
             ServerConfig<TestServerConfig>{//...}
    
    // Now we can make typesafe API calls, using method chaining for ease-of-use
    final TestNoOpServer server = new TestNoOpServer();
    final TestServerConfig config = server.getConfiguration();
    config.bootstrapHome("file:/path/to/home").bootstrapName("nameOfBootstrap.xml");