Marcus Crafter wrote:
>What's the latest on the Merlin/Fortress merger ? Was there any
>progress there while I was away ?
>
The latest Merlin news is the completion of pluggable lifecycle
extensions.
The extension framework is fully incorporated in the component model -
components can declare a dependency on a lifecycle extension provider
via a <phase> declaration in the component type model. For example:
<component-info>
<component>
<name>my-component</name>
</component>
<phases>
<phase>
<reference type="org.apache.excalibur.playground.Exploitable"
version="1.0"/>
</phase>
<phase>
<reference type="org.apache.excalibur.playground.Demonstratable"/>
</phase>
</phases>
</componenent-info>
Declaration of a <phase/> is similar to the declaration of a service
dependency in that phase providers are managed by the Merlin container
as dependencies of the target component. In the above example, two
lifecycle extension dependencies are being declare. The type attribute
declares the lifecycle interface implemented by the component - its up
to the container to resolve an appropriate lifecycle extension to
provide this to the target component when handling component instantiation.
Lifecycle handlers are declared as extension of the "classic" component
type definition. Here is an example of a lifecycle handler. It
publishes its ability to handle a phase via an <extension/> element.
The container is responsible for locating extension providers based on
the matching of the <phase> type attribute with an
<extension><reference/> type attribute. Selection of an extension
handler is identical to the selection of a service dependency. This
means that multiple candidate extensions can exist within a singe
classloader scope.
<component-info>
<component>
<name>demo-extension</name>
</component>
<!--
Declaration of the lifecycle support phases that this manager provides.
-->
<extensions>
<!--
Each extension has a name, a versioned interface reference, and optional
attributes.
-->
<extension stage="ALL">
<name>demonstrate</name>
<reference type="org.apache.excalibur.playground.Demonstratable"
version="1.0"/>
<attributes>
<attribute key="status" value="experimental"/>
</attributes>
</extension>
</extensions>
</component-info>
Other important points are that a extension provider can declare its own
phase dependencies and also classic service dependencies. Merlin will
take care of the ordering of component establishment based on the phase
and service dependencies that the component publishes.
Extension providers must implement the following interface:
org.apache.excalibur.merlin.assembly.resource.Extension
The interface declares the operation "extend( int stage, Object object,
Context context ) which will be invoked by the Merlin container during
the appropriate stages. Merlin defines a number of stages that can be
associated with an extension provider. Merlin will only invoke extend
if the provider declares that it supports the particular stage.
Standard stages include the following:
CREATE invoked immediately before initialization
ACCESS invoked immediate before lookup
RELEASE invoked immediately before release
DESTROY invoked immediately before dispose
INNER equivalent to ACCESS + RELEASE
OUTER equivalinet to CREATE + DESTROY
ALL equivalent to INNER + OUTER
Demonstration of extension declaration and phase declaration is included
in the org.apache.excalibur.playground package (see assembly/demo) - in
particular, the DemoManager, ExpliotationManager (both examples of
extension providers), and SimpleComponent - a multi-phase phase consumer.
Cheers, Steve.
--
Stephen J. McConnell
OSM SARL
digital products for a global economy
mailto:[EMAIL PROTECTED]
http://www.osm.net
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>