Include Directive

Nested Elements

Element Occurance Description
target * A set of target directives scoped relative to the container established by the include. Targets declarations correspond to the specification of target elements presented under the config.xml spec.

Attributes

Attribute Required Description
name yes A name to assign to the container created by the block include. Will default to the name of the included block.
id yes The resource repository identifier.
version no The resource version.
type no A resource type such as 'jar' or 'xml'. Tge default value is 'jar'.

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.).

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="tutorial">

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

     <include name="publisher">
       id="tutorial:composition-publisher" version="1.0"/>

     <include name="application">
       id="tutorial:composition-application" version="1.0"/>

     <include name="location">
       id="tutorial:composition-location" version="1.0"/>

</container>