First, you need to create a model extension of the JBI meta-model.
You will have to create a set of EStructuralFeatures that are "detached" from the static JBI type but that can be inserted into JBI class instances. Types are not really what is manipulated. This extensively uses *EAnnotation* and *ExtendedMetaData*.
* Create an ecore file in the "model" folder. Set Name and prefix as you want (a meaningful name for this component).
* Set the NS URI to the namespace of the component.
\\
To create a type in the ecore model:
* Create a _<Component>_*Provides* class extending the *CDK Provides* class (also works when extending the *JBI Provides* class).
* Add an EAnnotation on the type.
** Source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData"
** Create a detail entry: "name" with a blank value (not null).
\\
Types are one thing to maniulate in the ecore model. Features are another thing.
Features are the extension of the JBI element for this component. You can deduce them from the XML schemas of the component.
To add a feature in the ecore model:
* Create an *EAttribute* for each attribute and element in the XML schemas.
* Set its properties (Multipliciy, type...) according to the XML schemas.
* A good thing is to put the "Unsettable" to true (equivalent to _nillable_ in the XML schema terminology). Unsettable elements will result in _xsi:nill="true"_ when _eSet(null);_ is called.
* Create an *EAnnotation* on the type.
** Source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData".
** The content of the details for this annotation specify the serialization of XML:
*** namespace: ##targetNamespace
*** kind: element
*** group: #group:0
*** name: <name of the element in XSD>
You can define enumerations too.
h1. Generation Model (*.genmodel)
Create a genmodel file from the ecore.
When asking for packages in the wizard, import other genmodels from the JBI and CDK plug-ins. Mark all the packages, except the component one, as "Referenced".
Select the root package and edit its properties.
A good convention is to set "Base package" to the same value as Bundle name. Since it is the Java package, ensure it is not the same as a package already used.
* Select the genmodel root. Set the Copyright. Set the *Model > Model-Directory* to *src-model*.
* Right-click the root element and click *Generate Model Code*.
* Ensure src-model folder is in your build.properties src path.
h1. Miscellaneous
h2. Architecture