Container Directive

Nested Elements

Element Occurance Description
services 0..1 A container can declare the export of a set of services established by the components contained within it. This enables a container to function as a composite component relative to its peers.
classloader 0..1 The classloader to assign to the container.
component 0..n A component directive is an instruction to merlin to build a component of the type specified, and deploy the component in accordance with a stated policy.
container 0..n A container directive is simply a composite component. A container establishes a partition within which a set of other components and containers can be declared.
include 0..n An include directive instructs Merlin to include an external block within the container. Services exported by the block will be made available to other components at the same level as the included block.

Description

A container holds a set of components, sub-containers, and includes that make up the compostion of the block in terms of its internal functionality, exported through optional service directives.

Sample XML

The following XML is a sample of a implementation declaration containing an engine, components, subcontainers and block includes.

 <!-- block implementation declaration -->
<container>
  
     <!-- 
     declaration of the classloader that this block 
     will execute within 
     -->

     <classloader>
       <classpath>
         <repository>
           <resource id="tutorial:composition-api" version="1.0"/>
         </repository>
       </classpath>
     </classloader>

     <!-- 
     declaration of a root component (services provided by this component
     will be avbailable to all other components at the same or lower levels
     in the container hierachy
     -->

     <component name="application" 
        class="tutorial.application.Application" activation="startup">
     </component>

     <!-- 
     declaration of a container contining other components
     -->

     <container name="subcontainer">
       
       <!--
       This component is only visible to other components at the same
       level or lower in this branch of the container hierachy
       -->

       <component name="test2" class="AnotherComponent"/>

       <!--
       A subcontainer declaring a custom container type.
       -->

       <container name="testing" class="MySpecialContainerClass">
         <!-- etc. -->
       </container>

     </container>

     <!--
     Declaration of a block to includes.  The inclusion of a block
     results in the establishment of a container with a name correponding
     to the name of the block.
     -->

     <include path="example-block.xml"/>
     <include id="osm:collaboration" version="1.0"/>

</container>