The following document provides the necessary information for getting started with generating TPTP EMF model code.
2.0 Installation of the EMF Generator
3.0 Generating the model code
4.0 Maintaining the model code
5.0 Additional documentation
The TPTP models are EMF based models which are generated from ECore model files. The main model plugin org.eclipse.tptp.platform.models hosts the following models:
- Trace model under the src-trace/model subfolder
- Test model under the src-test/model subfolder
- Statistical model under the src-statistical/model subfolder
- Probekit model under the src-probekit/model subfolder
The Log and Trace Anayzer models are located in the org.eclipse.tptp.platform.models.lta plugin:
- Consumer Common Base Event model under the src-cbe\model subfolder
- Generic Log Adapter model under the src-gla\model subfolder
- Old Symptom model (Symptom 0.1) under the src-sdb\model subfolder
- New Symptom model (Symptom 2.0) under the src-symptom\model subfolder
Note that the two model plugins depend on a common plugin org.eclipse.tptp.platform.models.hierarchy which defines the hierarchical structure that is used to organize and interact with the various agent content.
Also note that the Trace, Statistical and CBE models depend on the Hierarchy model.
The Producer CommonBaseEvent model is located in the plugin org.eclipse.tptp.platform.logging.events, the EMF implementation under the src.cbe101 subfolder and the Java implementation under src.events.
Locations of the various sources for the TPTP models are listed in the following:
- the source for the Trace, Test and Statistical, CommonBaseEvent and old Symptom model are the ECore model files located in their corresponding model location described above.
- the Probekit model source is an XML schema, probekit.xsd
- the Generic Log Adapter is based on XML schema files located in org.eclipse.hyades.logging.adapter/schema
- the new Symptom model is based on XML schemas located in org.eclipse.tptp.platform.models.lta/src-symptom/model
- Download Eclipse 3.3 and the EMF 2.2.4 runtime package from the TPTP web site, a milestone driver or a release driver, and install them under the same directory.
- Open a command line prompt in the eclipse subfolder of the workbench installation and add a JRE 1.4.2 or above to the system path
- Start Eclipse with the -clean option.
- Select the model plugin and subfolder for the corresponding model for which you want to perform code generation.
- Select the EMF generator model, i.e. the <model>.genmodel file, right click and choose "Open with"->"EMF Generator", the EMF Generator editor opens.
- Select the root node in the main view (the whole model), right click and choose "Show Properties View", the properties view is shown displaying various properties used for code generation.
- Verify that the following properties are pointing to the right locations:
- Model->Model Directory: the directory where the model will be generated
- Templates & Merge->Template Directory: the directory where the templates used to generate the model reside, if any customized templates are used or blank, in this case the default EMF templates are used.
- if customized templates are used make sure to set the property Templates & Merge->Dynamic Templates to true and otherwise to false
- Right click on the root element in the main view and choose Generate Model Code, the model files will be generated in the directory specified at bullet 4.1.
- Make sure no compilation errors are displayed, if any, try to fix them manually or revisit the code generation procedure for what could have gone wrong.
- Synchronize the generated code with CVS and do a difference on each generated class. Be aware that existing methods tagged with @generated NOT in the method's Java doc comment, are not overwritten.
- Once you've decided that the generated code looks good, check the code into CVS.
- hierarchy.ecore
- TRCAnnotation_values unique=false
- trace.ecore
- TRCThread_initialInvocations unique=false
- cbe.ecore
- CBEDefaultElement_values unique=false
- SymptomPackageImpl
- getSymptomCatalog_SymptomDefinition() unique=false
- getSymptomCatalog_SymptomRule() unique=false
- getSymptomCatalog_SymptomEffect() unique=false
- Once per release it is good practice to regenerate the model using the latest EMF runtime and generator available because generated code can differ from a version to another.
- When changes to the model are required execute the following steps:
- go to the corresponding source, whether it's an ecore file, XSD, Rose model or annotated Java classes, do the required changes if any.
- select the EMF generator model, i.e. the <model>.genmodel file, right click and choose "Reload.." and next select the corresponding source: annotated Java, Rose class model, XML schema, ecore model. The <model>.genmodel will be updated with the the model source and the EMF Generator editor will open.
- regenerate the model as described in section 3.0 Generating the model code
- if necessary the code can be generated into a different directory and changes merged with the current model.
- For additional information on EMF code generation consult the online EMF tutorials following the link EMF tutorials.
- For additional information related to the TPTP models consult the online documentation following the link TPTP models.
Author: Alex Nan