Create a Component
Install SmartTools on your Eclipse
Please install SmartTools Feature on your Eclipse if it is not already done.
Create a project
Launch the "New SmartTools Component" wizard.
New Component Wizard
Type your component name and click Finish. It is used for the package path, so you may put mycompany.mymodule.mycomponent for example.
Finish
The wizard build the basic structure of the component: a CDML for describing the services of your component, a Facade for your business code and an Activator for OSGi.
new Project
Build the component
SmartTools generates a Ant script called "buildST.xml", which will generate the container of your component, and link it to your facade.
Delete buildST.xml to force it to re-generate
Delete buildST.xml
Add the buildST.xml Ant script to the Ant view and execute it.
Add buildST.xml and execute it
No error should be in the console
Console result
Refresh the project.
Refresh the project
Java will compile the generates classes, and no Error should remain on the Java project. Build of all Java files
Execute the builtST.xml everytime you change the CDML file. The wizard puts 1 input and 1 output you can duplicate as you want.
the CDML
Create new services
Let's create two new services, generate again the component, and complete the Facade
Duplicate the "input" and "output" entries to new entries, say for example "input2" and "output2".
Change the type of the parameters of these services
new CDML
After you saved the CDML, you have to generate the component again with buildST.xml.
Add buildST.xml and execute it
Remember to refresh the project.
Refresh the project
Now Errors come from the generated Facade, which needs the input2 method from your own Facade.
Eclipse helps you in resolving this issue quickly.
Create method input2 in the facade
Ok.
Output
The outputs are optional, and if you want to invoke an output from your facade, you need to duplicate the method from the generated facade to your facade, and put it as an abstract method.
Output
Output
It should be completed now.
Output
Run your components
Now you know how to create and generate a component for SON, please follow the next tutorial where we present how to run your components in SON.