The Carbon Java Framework  

The Carbon Core Bootstrap Subsytem

Startup Service

Author: Doug Voet (dvoet at sapient.com)
Version: $Revision: 1.3 $($Author: dvoet $ / $Date: 2003/04/08 17:47:47 $)
Created: January 2002

Overview

The Startup Service is a simple component. It's only functionality is to load other components. The default implementation uses the configuration subsystem to get a list of component names then uses the component subsystem to fetch each component. It does not maintain references to each created component, it just asks the component subsystem to build them.

The Startup Service starts components as soon as Carbon is started. It can be used to execute functionality that must be completed before requests to other components can be allowed (e.g. Deployment Service).

How it Works

Once the Bootstrap subsystem has loaded the Configuration and Lookup Services, it calls the Startup Service. The Startup Service loads all of its configured components sequentially in the order that they are configured on a single Thread before other requests are served. If, for any reason, the Startup Service fails, a warning is logged. If an individual component fails to start, a warning is logged, then the Startup Service continues, starting any other configured components.

Configuration

The Startup Service is itself a component and has a configuration document located at /core/StartupService. Here is an example configuration.

StartupService
<?xml version="1.0" encoding="UTF-8"?>

<Configuration ConfigurationInterface="org.sape.carbon.core.component.startup.StartupServiceConfiguration">
    <FunctionalImplementationClass>org.sape.carbon.core.component.startup.DefaultStartupServiceImpl</FunctionalImplementationClass>
    <FunctionalInterface>org.sape.carbon.core.component.startup.StartupService</FunctionalInterface>

    <StartupComponentArray>
        <!-- This component creates the basic Deployment Service -->
        <StartupComponent ConfigurationInterface="org.sape.carbon.core.component.startup.StartupServiceConfiguration$StartupComponentConfiguration">
            <ComponentName>/deployment/DeploymentService</ComponentName>
            <Enabled>false</Enabled>
        </StartupComponent>

        <!-- This component acts as the primary JMX MBean server and provides the web console -->
        <StartupComponent ConfigurationInterface="org.sape.carbon.core.component.startup.StartupServiceConfiguration$StartupComponentConfiguration">
            <ComponentName>/manage/DefaultMBeanServer</ComponentName>
            <Enabled>true</Enabled>
        </StartupComponent>
    </StartupComponentArray>
</Configuration>
            

To add a new startup component, add a StartupComponent entry to the Startup Service's configuration. The ComponentName attribute should be the absolute logical name of the component you wish to add. The Enabled attribute allows an easy way to enable/disable the automatic starting of a component.

Note

The Startup Service is executed before the Deployment Service can be started. This means that deployment specific attributes cannot be referenced in the same way as configurations using the Deployment Service. If it is a requirement to enable/disable startup components based on environment/instance, reference Deployment Properties using Attribute Value References. Example:

Example
<StartupComponent ConfigurationInterface="org.sape.carbon.core.component.startup.StartupServiceConfiguration$StartupComponentConfiguration">
    <ComponentName>/manage/DefaultMBeanServer</ComponentName>
    <Enabled>{management.is.enabled}</Enabled>
</StartupComponent>
            

Copyright © 2001-2003, Sapient Corporation