Difference between revisions of "SCA/Components/SCA MMExtension"

From Eclipsepedia

< SCA
Jump to: navigation, search
(Create an SCA meta model extension)
 
(5 intermediate revisions by one user not shown)
Line 27: 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 (Figure 7), with the following DetailEntry:
+
# 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 33: Line 33:
  
 
== Generate the meta model code ==
 
== Generate the meta model code ==
# Create a new genmodel: '''File>New>Other>EMF Model''' (Figure 8).
+
# 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 (Figure 9), click the '''Next''' button.
+
# 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 (Figure 10), then click the '''Next''' button. Select which package to generate (Figure 11) and the referenced generator models (sca, sca.policy and sca.instance). Click the '''Finish''' button.
+
# 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

[edit] Create a new plugin

  1. Create a new plugin:
    1. File > New > Project..., then select Plug-in Project. Click Next. SCA-01-pluginWizard.png
    2. Set the project name. Click Finish. SCA-02-pluginWizard.png
  2. Create a directory named “model” SCA-03-3-ModelDirectory.png.

[edit] Create an SCA meta model extension

  1. Create a new Ecore model. SCA-04-EcoreModel.png
  2. Open the ecore model.
  3. Load the SCA meta model (right click > Load Resource...). Click Browse Registered Package, select the SCA/OSOA meta model. SCA-05-LoadResource.png
  4. Select the EPackage of your meta model. Set the Name, NSPrefix and the NSURI.
  5. Add a new EClass named DocumentRoot. This EClass must extend the DocumentRoot of the SCA meta model. SCA-06-DocumentRoot.png
  6. Add a new EAnnotation (source = http:///org/eclipse/emf/ecore/util/ExtendedMetaData).
  7. Add two DetailEntry:
    • name → empty Value.
    • kind → mixed.
  8. Then, under the DocumentRoot add a new EReference. Set the name, the cardinality (min:0, max: -2), and the containment (true).
  9. 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).

[edit] Create a new SCA Element

  1. Select the EPackage and create a new EClass. Set the name (for instance FractalImplementation) and the ESuper Type (Implementation, Interface or Binding).
  2. Create a new EAnnotation, with the following DetailEntry: SCA-07-NewSCAElement.png
    • name → SCA Type name
    • kind → elementOnly
  3. Then, add the attributes and references for the new SCA element.

[edit] Generate the meta model code

  1. Create a new genmodel: File>New>Other>EMF Model. SCA-08-CreateGenmodel.png
  2. Click the Next button. Set the genmodel name, click the Next button. Select Ecore model as Model Importer, click the Next button. SCA-09-ChooseEcore.png
  3. Select the ecore file defined in the previous section, then click the Next button. SCA-10-ChooseEcore.png
  4. Select which package to generate and the referenced generator models (sca, sca.policy and sca.instance). Click the Finish button. SCA-11-ChooseEcore.png
  5. That's all, you can generate the code.