Guide - Creating a Block

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.

Guide Contents

  1. What is a block?
  2. What is a block listener?
  3. What is an application listener?
  4. How do I create a block?
  5. How do I make my components phoenix-compatible?
  6. BlockInfo specification
by Phoenix Documentation Team