Include Directive

Attributes

Attribute Required Description
id normally A resource artifact identifier in form [group]:[artifact-name]. The value identifes a jar file containing a block defintition that is resolved relative to a repository established by the Merlin Kernel.
version no Used in conjuction with the id attribute to qualify the artifact version.
config no Relative url referencing a configuration target defintion.
path no May be used to reference a jar file relative to the base directory of the containing block. Is useful as alternative form to the "id" model during development. If the "path" attribute is declared, the id and version attribute will be ignored.

NOTE: It is an error the include directive does not container one of two possible include forms ("path" or "id").

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 regual 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 id="tutorial:composition-publisher" version="1.0"/>
     <include id="tutorial:composition-application" version="1.0"/>
     <include id="tutorial:composition-location" version="1.0"/>

</container>