The Basil Model Framework
Jonathan
Riehl
Figure: The Basil
Model Framework Class Diagram
The figure
above illustrates the current state of the class design behind the Basil model
framework. Using generator scripts,
model modules may be created from meta-models (such as a DTD, MOF model, or the
NovoSoft meta-model.) The generated
modules conform to the IModelFactory interface and contain a specialization of
the BaseModelFactory class. Additional
generators allow model translation by providing a handler framework that
mirrors the model module via a separate interface (IModelHandler and
BaseModelHandler.) All of these are
documented in more detail below.
- IModelFactory
The IModelFactory simply defines an interface that allows a module (in the
current Python implementation, the Python module conforms to this
interface) to return an instance of the factory class for a model (the
Python implementation diverges somewhat by returning the class itself,
leaving the caller responsible for instantiating the factory class.)
- IModelHandler
The IModelHandler mirrors the IModelFactory class by exposing an interface
that allows clients of the handler module to obtain a handler
instance. The handler class is
described below.
- BaseModelFactory
The BaseModelFactory is an abstract base class for a given model’s factory
class. As such, the
BaseModelFactory exposes an interface that allows a model to be
internalized from a serial stream or externalized to a serial stream. In the current implementation, the
BaseModelFactory implements an internalize (and hopefully an externalize)
method for the “XML” format.
Subclasses of the BaseModelFactory may implement externalization
and internalization routines for other formats as well. Additionally, subclasses are expected
to provide methods for the construction of model elements.
- BaseModelHandler
The BaseModelHandler is an abstract base class that provides an interface
or the traversal of a model.
Handler subclasses are bound to specific model implementations for
the purpose of performing a specific model wide function (such as code
generation from an XMI model.) The
processModel() method allows for arguments that are meaningful to the
handler to passed as a vector (in the current implementation, these are
used to process excess command line arguments.)
- BaseModelElement
The BaseModelElement class is the primary abstraction class for all model
elements. In the Python
implementation, the role of the BaseModelElement is served via the UserList class from the standard Python
library.