| Home
Introduction
Operation Schemas
User Manual
Directory Structure
Parser
Model Extractor
Type Checker
Modifications
Extending the
compiler
Outstanding Issues
Current Status
References and Links
Javadoc |
Model Extractor
Any model information source will have to implement
the lglepfl.ocl.check.types.ModelFacade
interface. This interface contains just one method, Type getClassifier(String),
which takes a String as a parameter and returns a Type object corresponding
to the type for the parameter string in the model.
There are at present two implementations for ModelFacade:
-
A hard-coded implementation of the RoyLoy model
contained in the lglepfl.ocl.check.types.testfacade
package.
-
The implementation in lglepfl.ocl.check.types.xmifacade,
which obtains model information by parsing an XMI file.
The class which implements ModelFacade for the XMI parser
implementation is lglepfl.ocl.check.types.xmifacade.Model.
The XMI file itself is parsed by the class lglepfl.ocl.check.types.xmifacade.XmiParser,
which adds the operations and attributes to a lglepfl.ocl.check.types.xmifacade.ModelClass
object, and the ModelClass objects are themselves added to a lglepfl.ocl.check.types.xmifacade.Model
object. ModelClass implements the Type interface, so if the getClassifier
method of Model is called, it looks for the Type object in the set of ModelClasses
it has, and returns the appropriate Type object. ModelClass has sets containing
all the attributes and operations, so it can easily implement the navigateParametrized()
and navigateQualified() methods of the
Type interface.
The XmiParser class uses the standard Apache Xerces
XMI parser v1.4 (contained in the jar archive xerces1.4.jar) and obtains
the parsed document, from which it can extract the XML elements corresponding
to various element names. The DOMParser class parses XMI files.
See Modifications
to see the changes incorporated in XMIParser.java so that tool accepts
Rose 2001 generated files. |