Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "SCA/Components/SCA MMExtension"
< SCA
(New page: This page explains, step by step, how to extend the SCA meta model. == Create a new plugin == # Create a new plugin: '''File > New > Project...''', then select '''Plug-in Project''' (Fig...) |
|||
(8 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
== Create a new plugin == | == Create a new plugin == | ||
− | # Create a new plugin: '''File > New > Project...''', then select '''Plug-in Project''' | + | # Create a new plugin: |
− | # Create a directory named “model” | + | ##'''File > New > Project...''', then select '''Plug-in Project'''. Click '''Next'''. [[Image:SCA-01-pluginWizard.png]] |
+ | ## Set the project name. Click '''Finish'''. [[Image:SCA-02-pluginWizard.png]] | ||
+ | # Create a directory named “model” [[Image:SCA-03-3-ModelDirectory.png]]. | ||
== Create an SCA meta model extension == | == Create an SCA meta model extension == | ||
− | # Create a new Ecore model | + | # Create a new Ecore model. [[Image:SCA-04-EcoreModel.png]] |
# Open the ecore model. | # Open the ecore model. | ||
− | # Load the SCA meta model ('''right click > Load Resource...'''). Click '''Browse Registered Package''', select the SCA/OSOA meta model | + | # Load the SCA meta model ('''right click > Load Resource...'''). Click '''Browse Registered Package''', select the SCA/OSOA meta model. [[Image:SCA-05-LoadResource.png]] |
# Select the EPackage of your meta model. Set the Name, NSPrefix and the NSURI. | # Select the EPackage of your meta model. Set the Name, NSPrefix and the NSURI. | ||
− | # Add a new EClass named DocumentRoot | + | # Add a new EClass named DocumentRoot. This EClass must extend the DocumentRoot of the SCA meta model. [[Image:SCA-06-DocumentRoot.png]] |
# Add a new EAnnotation (source = http:///org/eclipse/emf/ecore/util/ExtendedMetaData). | # Add a new EAnnotation (source = http:///org/eclipse/emf/ecore/util/ExtendedMetaData). | ||
# Add two DetailEntry: | # Add two DetailEntry: | ||
Line 25: | Line 27: | ||
== Create a new SCA Element == | == Create a new SCA Element == | ||
# Select the EPackage and create a new EClass. Set the name (for instance FractalImplementation) and the ESuper Type (Implementation, Interface or Binding). | # Select the EPackage and create a new EClass. Set the name (for instance FractalImplementation) and the ESuper Type (Implementation, Interface or Binding). | ||
− | # Create a new EAnnotation | + | # Create a new EAnnotation, with the following DetailEntry: [[Image:SCA-07-NewSCAElement.png]] |
#* name → SCA Type name | #* name → SCA Type name | ||
#* kind → elementOnly | #* kind → elementOnly | ||
Line 31: | Line 33: | ||
== Generate the meta model code == | == Generate the meta model code == | ||
− | # Create a new genmodel: '''File>New>Other>EMF Model''' | + | # Create a new genmodel: '''File>New>Other>EMF Model'''. [[Image:SCA-08-CreateGenmodel.png]] |
− | # Click the '''Next''' button. Set the genmodel name, click the '''Next''' button. Select Ecore model as Model Importer | + | # Click the '''Next''' button. Set the genmodel name, click the '''Next''' button. Select Ecore model as Model Importer, click the '''Next''' button. [[Image:SCA-09-ChooseEcore.png]] |
− | # Select the ecore file defined in the previous section | + | # Select the ecore file defined in the previous section, then click the '''Next''' button. [[Image:SCA-10-ChooseEcore.png]] |
+ | # Select which package to generate and the referenced generator models (sca, sca.policy and sca.instance). Click the '''Finish''' button. [[Image:SCA-11-ChooseEcore.png]] | ||
# That's all, you can generate the code. | # That's all, you can generate the code. | ||
+ | |||
+ | |||
+ | [[Category:SOA_Tools]] | ||
+ | [[Category:SOA]] | ||
+ | [[Category:STP]] | ||
+ | [[Category:SCA]] |
Latest revision as of 11:17, 8 July 2010
This page explains, step by step, how to extend the SCA meta model.
Contents
Create a new plugin
Create an SCA meta model extension
- Create a new Ecore model.
- Open the ecore model.
- Load the SCA meta model (right click > Load Resource...). Click Browse Registered Package, select the SCA/OSOA meta model.
- Select the EPackage of your meta model. Set the Name, NSPrefix and the NSURI.
- Add a new EClass named DocumentRoot. This EClass must extend the DocumentRoot of the SCA meta model.
- Add a new EAnnotation (source = http:///org/eclipse/emf/ecore/util/ExtendedMetaData).
- Add two DetailEntry:
- name → empty Value.
- kind → mixed.
- Then, under the DocumentRoot add a new EReference. Set the name, the cardinality (min:0, max: -2), and the containment (true).
- Add a new EAnnotation with the following DetailEntry:
- kind → element
- name → scaType.name (for instance implementation.fractal or binding.jbi)
- namespace → ##targetNamespace
- affiliation → http://www.osoa.org/xmlns/sca/1.0#scaType (scaType = binding, interface or implementation).
Create a new SCA Element
- Select the EPackage and create a new EClass. Set the name (for instance FractalImplementation) and the ESuper Type (Implementation, Interface or Binding).
- Create a new EAnnotation, with the following DetailEntry:
- name → SCA Type name
- kind → elementOnly
- Then, add the attributes and references for the new SCA element.
Generate the meta model code
- Create a new genmodel: File>New>Other>EMF Model.
- Click the Next button. Set the genmodel name, click the Next button. Select Ecore model as Model Importer, click the Next button.
- Select the ecore file defined in the previous section, then click the Next button.
- Select which package to generate and the referenced generator models (sca, sca.policy and sca.instance). Click the Finish button.
- That's all, you can generate the code.