Building Services: The Assembly Model
The Assembly Model describes how services are defined and configured.
Components are at the core of the SCA Model, and can be implemented in any language that supports SCA. Once defined, Components can be configured declaratively using Properties, which map to accessors and mutators in the underlying implementation. Figure 2 is a digram of a component. Example 1(a) is a declaration of a component in XML.
(a) <component name="AddServiceComponent"> <implementation.java class="calculator.AddServiceImpl"/> </component> (b) <component name="CalculatorServiceComponent"> <implementation.java class="calculator.CalculatorServiceImpl"/> <reference name="addService">AddServiceComponent</reference> </component>
References let Components invoke other services. References are resolved at deploy time or runtime. Example 1(b) shows an example reference.
Composites are groupings of Components. Depending on the declaration, a Composite can be used as a service or new Component. Thus, the SCA model supports recursive assembly.
Services are essentially Composites that you promote to Services by including the service element in the Composite declarations. Like Components, Composites and Services can be configured declaratively through Properties. As you can see from the description of the elements of an SCA assembly, existing applications can be incorporated into the architecture by modeling the application as a Component, Composite, or providing a Reference to a callable interface of the application.