Apache Qpid : Multiple AMQP Version Support
This page last changed on Oct 30, 2006 by kpvdr.
Multiple-AMQP Version Support in QpidThis page describes an effort to allow multiple AMQP versions to be supported in the broker. This implies:
The thinking behind the following generator description is described in AMQPVersion.1. Option 3 (Intelligent Generation) was selected for this implementation. 1. Current Generator StatusThe Java generator is more-or-less complete and has been checked into subversion under the gentools directory for initial review. It has not been integrated into the Qpid project as yet; I would like to complete the C++ generation first. However, while the C++ work is in progress, the Java generator is available for review and comment. For instructions on installing and running, see the README file in the gentools directory. 2. Generator Description2.1. OverviewThe generator first reads in all the listed specification files and constructs from them a memory model (structure) of the specifications "superimposed" on top of each other so that the differences between them are easy to determine. A domain map (which maps all domain names to their simple domain types) is also constructed. The generator then uses the model to perform code generation. This is achieved by using templates which contain the static parts of the code (which are simply reproduced) and in which are embedded tokens. These tokens, when encounted in the template, are passed on to the generator class, which then uses the context and model to generate specific the version-dependent sections of the code. Both of these are discussed in more detail below. 2.2. AMQP verion modelThe memory model has two parts - the domain map and the model (specification structure) itself. Domain Map The domain map is a two-level map. The lowest level maps the simple domain types to the AMQP versions in which they are defined. The upper level maps the domain names to the simple domain type. In the following hypothetical example, the class-id domain is changed from short in v.0.8 to long in v.0.9, then back to short in v.0.10. The queue-type domain was introduced in v.0.10, while the redirected was removed in v0.9. access-ticket --- shortstr --- V[0.8, 0.9, 0.10] class-id -+------ short ------ V[0.8, 0.10] +------ long ------- V[0.9] queue-type ------ shortstr --- V[0.10] redirected ------ bit -------- V[0.8] A simplified version of the object model is as follows: Domain Map class diagram
Specification Model The specification model consists of a series of embedded maps in the same logical structure as the XML specification elements themsleves: the model contains a map of class maps; class maps contain field and method maps; method maps contain field maps. At the lowest level, there is a map to a set of AMQP versions. The following illustrates a small portion of a model. C Access -+---- I 30 ---------- V[0.8, 0.9, 0.10] +---- M request -+-+- I 10 -------- V[0.8, 0.9] | +- I 20 -------- V[0.10] +-+- F active --+- O 1 ---------- V[0.8, 0.9, 0.10] | +- D bit -------- V[0.8, 0.9, 0.10] +- F realm -+--- O 0 ---------- V[0.8, 0.9, 0.10] +-+- D path ------- V[0.8] +- D shortstr --- V[0.9, 0.10] C = class; M = method; F = field; D = domain name; I = index; O = ordinal; V = version(s) An ordinal is the index number of a field implied by its relative position in the XML specification file. The first field in a class or method has ordinal 0, the second ordinal 1, etc. A simplified version of the object model is as follows: Model class diagram
Generation The Generator itself consists of a template passer and large number of code-generating methods for handling the various tokens that are embedded in the templates. Templates contain three types of tokens:
3. Code Generation3.1. Difference ModesThe following changes may take place between one version and the next:
3.2 Java Generation3.2.1. MethodBody classesMethodBody classes here. 3.2.2. PropertyContentHeader classesPropertyContentHeader classes here. 3.2.3. Registry classesRegistry classes here. 3.3. C++ GenerationWatch this space... |
Document generated by Confluence on Apr 22, 2008 02:47 |