Introduction

This document will describe the process for creating your first block. There are essentially three steps that must be completed before your block is ready for assembling.

  1. Write the Block component.
  2. Write the BlockInfo meta-info description file.
  3. Package the component and related resources into a block jar file.

Writing the Block component

Writing the Block is the main task you will be called to do. It follows all the rules of writing a standard Avalon component. If a block 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 Block's container (the Phoenix Kernel) supports all the Avalon lifecycle methods or will in the near future (at the moment suspend/resume is not yet supported).

The block can implement an interface if it wishes to export a service to external blocks. It is also possible to aquire services from other blocks in the service() method.

Write the BlockInfo

You must create this file to indicate which services this Block depends upon and those services which it offers. It is more fully documented in the BlockInfo Specification document.

Create the jar package

The final step is packaging up the implementation files, BlockInfos and other resources into a jar file. The jar file is a standard jar file with special manifest entries. For each Block that is included in the jar, a new manifest attribute must be added, namely "Avalon-Block: true". An example manifest file is displayed below.

Manifest-Version: 1.0
Created-By: Apache Avalon Project

Name: com/biz/cornerstone/blocks/MyBlock.class
Avalon-Block: true