link
Avalon
Merlin Runtime
Home PlanetProductsCentral
Include Directive
Description

An include directive instructs Merlin to load and deploy the block defined within the referenced jar file as a subcontainer within the enclosing container. The include directive is equivalent to the nesting of a full block definition within another block. Block includes enable composition of pre-packaged component based solutions as the included block appears to other components as a regular component (exposing services and dependecies, etc.).

Nested Elements
ElementOccuranceDescription
target* A set of target directives scoped relative to the container established by the include. Each target declaration corresponds to the specification of target override target element presented under the config.xml spec.
Attributes
AttributeRequiredDescription
nameyes A name to assign to the container created by the block include. Will default to the name of the included block.
idyes The resource repository identifier.
versionno The resource version.
typeno A resource type such as 'jar' or 'xml'. Tge default value is 'jar'.
Sample XML

The following example block.xml demonstrates the inclusion of three blocks within another enclosing block. In this example, the common shared API (containing service interfaces classes is declared in the containing block classloader).

<container name="application">

     <classloader>
       <classpath>
         <repository>
           <resource id="avalon-framework:avalon-framework-api" version="4.1.5"/>
           <resource id="avalon-framework:avalon-framework-impl" version="4.1.5"/>
           <resource id="merlin-tutorial:locator-api" version="1.0"/>
           <resource id="merlin-tutorial:publisher-api" version="1.0"/>
           <resource id="merlin-tutorial:application-impl" version="1.0"/>
         </repository>
       </classpath>
     </classloader>

     <include name="location" id="merlin-tutorial:locator-impl" version="1.0"/>
     <include name="publisher" id="merlin-tutorial:publisher-impl" version="1.0"/>

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

</container>