This document will describe the process for creating your first component. The following steps are required before your component is ready for assembling.
- Write the Component.
- Associate MetaData with the Component.
- Package the component and related resources into a jar file.
Writing the Component
Writing the component is the main task you will be called to do. It follows all the rules of writing a standard Avalon component. If a component implements the Contextualizable interface it will be passed an instance of org.apache.avalon.phoenix.BlockContext which is an extended version of org.apache.avalon.Context. Other than this minor change the container supports all the Avalon lifecycle methods.
Associate MetaData with the Component
Loom uses the same mechanism as is described in the DNA MetaData documentation. The developer should be aware that the DNA documentation describes the metadata associated with DNA components. The only difference that must be taken into account for Avalon components is the name of the methods that the attributes are associated with. For example the dna.dependency attribute must be on associated with either Avalons Composable.compose(ComponentManager) or Serviceable.service(ServiceManager) methods.
The only difference is that Loom has an enhanced Ant task to generate the MetaData. This enhanced has backward compatible support for Phoenix metadata annotations and should be used if classes contain historic annotations. See below for a sample on how to use the task to generate metadata.
Create the jar package
The final step is packaging up the implementation files, MetaClass descriptors and other resources into a jar file.