Information Technology Reference
In-Depth Information
5
The RemoteJ Compiler/Generator
Implementation
5.1 Introduction
In this chapter we describe the implementation of the RemoteJ compiler/generator.
We describe the compiler and its features and discuss the implementation of the
recovery concern and the JMS, REST and RMI protocol implementations.
5.2 Compiler/Generator Overview
The RemoteJ compiler is a simple three-phase compiler/generator, illustrated in
Figure 5.1, that is used to apply distribution to existing bytecode using instructions
contained in a Distribution Definition Language file.
The compiler/generator consists of three phases; syntactic analysis phase,
the contextual analysis phase and the code rewriting phase.
The syntactic analysis phase checks the syntax of the DDL file and generates
an abstract syntax tree (AST) representation. The AST is passed into the contex-
tual analysis phase, which ensures that the context of the grammar conforms to the
DDLs contextual constraints and decorates the AST with information about the
parameters, scope rules, types etc. The decorated AST is passed into the aspect
weaver, which rewrites the existing bytecode and outputs the resultant file into the
location stipulated by the DDL's service statement as described in Section 4.3.4.
The RemoteJ compiler/generator has been developed to the compiler/inter-
preter patterns defined by Watt and Brown [119].
The compiler/generator supports any number of back-end code generators
using an extendible dynamic model that eliminates the need for changes to be
made to the compiler/generator for the addition of new protocols or protocol
options.
A high-level view of the extendible code generation support is illustrated in
Figure 5.2.
To add a new protocol, the developer extends the Protocol class, which
implements the IProtocol interface, illustrated in Figure 5.3.The Protocol class
contains generalised aspect-weaving code, such as generating recovery routines
and altering a class to implement an interface, and other useful routines including
Search WWH ::




Custom Search