Introducing BlocksOverviewA block is a specialisation of an Appliance . A block manages a container (a type of component). In addition, a block exposes services derived from the set of appliances that are managed by its container. As such, a block can be view as a composite component. A block may be contained within other blocks. A container manages a set of components declared within the containment scope. As such, a container represents a logical and structural partition within a containment hierarchy. Each container is associated with a classloader. The classloader parent is the classloader of the parent container. As such, a container (and component within the container) have access to the services defined within the immediate container and all parent containers. Cascading ContainersThe Merlin system provides support for cascading containers . This model enables component assemblers to (among other things) associate jar files under a protected block scope where each block is associated with its own classloader. Each block manages a single container. A container manages multiple components. Merlin will handle resolution of service dependencies for components contained in containers by looking for explicitly declared components commencing within the local container, and working progressively up the container hierarchy. If no explicit solutions are resolved, Merlin will attempt to build an implicit solution based on components declared in the respective container classpath. Block ModelA new block is defined by the <container> element. The element is the definition of a block, its classpath, and the components it is responsible for managing. Blocks are declared programmatically or via an XML description as shown below: Minimilist block definition: <container name="tutorial"> <component name="hello" class="tutorial.HelloComponent" activation="startup"/> </container> |