Apache Main | Avalon Main | Up |
BlockInfo SpecificationThe BlockInfo FileThe BlockInfo file defines meta-information about a block, such as which services the block depends upon, and which services it can offer to other blocks. The BlockInfo file is an XML file. It must be located in the same jar file as the block's implementing class. It must have the same name as the block's class, with the extention .xinfo. Thus, if you were looking up the BlockInfo for a block of class com.biz.cornerstone.blocks.MyBlock, you would look up the resource com/biz/cornerstone/blocks/MyBlock.xinfo in the jar file containing the block. Below is an example BlockInfo file: <?xml version="1.0"?> <blockinfo> <block> <version>1.2.3</version> </block> <services> <service name="com.biz.cornerstone.services.MyService" version="2.1.3" /> </services> <dependencies> <dependency> <role>com.biz.cornerstone.services.Authorizer</role> <service name="com.biz.cornerstone.service.Authorizer" version="1.2"/> </dependency> <dependency> <!-- note that role is not specified and defaults to name of service. The service version is not specified and it defaults to "1.0" --> <service name="com.biz.cornerstone.service.RoleMapper"/> </dependency> </dependencies> </blockinfo> You will notice that the information in the BlockInfo file is separated into three main sections:
The <block> ElementThe <block> element specifies the name and version of the block. The <block> element includes the following nested elements:
The <services> ElementThe <services> element defines the services that the block can offer to other blocks. This element is optional; A block can choose to not offer any services to other blocks. The <services> element should contain a nested <service> element for each service that the block provides. The <service> element takes the following attributes:
The <dependencies> ElementThe <dependencies> element defines the services that the block requires to operate. Phoenix provides these services to the block using the ServiceManager passed to the block's Serviceable.service() method. The <dependencies> element should contain a nested <dependency> element for each service that the block uses. The <dependency> element takes the following nested elements: The <service> ElementThe <service> element defines the expected service. The service element takes the following attributes:
The <role> ElementThe <role> element specifies the role that the service plays. This must match the role name that the block supplies when it locates the service using ServiceManager.lookup( role ). The role name is also used in the Assembly File, to identify the dependency when connecting the block to the services it requires. The <role> element is optional, and the role name defaults to the service name. The <management-access-points> ElementThe <management-access-points> element defines the management interfaces that the block provides. These interfaces are exported by Phoenix's management system to allow the block to be managed. The <management-access-points> element must contain a <service> element for each of the block's management interfaces. The <service> element takes the following attributes:
|