Block Metadata

The meta-data about each block is stored in a BlockInfo file. The info includes details on what version the block is, what Service s it depends upon and which Service s it can offer to other Blocks. In the future the info will also store such data as the schema for configuring the block.

The BlockInfo file has the same name as the Block except with the extention .xinfo . Thus if you were looking up the meta info for a block named com.biz.cornerstone.blocks.MyBlock you would look up the resource com/biz/cornerstone/blocks/MyBlock.xinfo in the same block jar file that the block was packaged in. The BlockInfo file is a simple XML format. An example of such a file follows.

<?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; block , services and dependencies .

BlockInfo 'block' Section

The block section specifies the version of class. In the future this section will also specify the configuration schema if the block is Configurable .

BlockInfo 'services' Section

The services section documents the services that this block can offer other Blocks. The service instances indicate an interface and optionally a version (defaults to version 1.0 if not specified). This section is optional and a Block can choose to not offer any services.

BlockInfo 'dependencies' Section

The services section documents the services that this block requires to operate. Required services are placed in the Blocks ServiceManager under the name specified by the role element of dependency. As is documented in the components section, the concept of Role is more than just a behavioural contract. A Service is a behavioural contract and thus the necessity to support the role element. In most cases however the role element and the name attribute of the service will be identical. In these cases it is sufficient to just specify service element and role will default to name of service.