Resource Adapter Description Language (RADL) and developing RAs in Eclipse
Introduction
RADL is a concrete textual syntax which describes a Resource Adapter and is an attempt (and currently examining the feasibility) for describing an RA in a way that decouples it from the underlying code. RADL’s textual syntax aims to be easier to describe a Resource Adapter than code in Java. So, we anticipate that one can define his RA in RADL without even knowing java . This description could be used also to publish the RA definition to the repository.
The abstract syntax of the language (defined in ecore) follows current RA definition as is used in PII PTM and the generated code runs on PII PTM. The RA developer can define the Resource Adapter in RADL and support tooling in Eclipse generates automatically the Java code that implements the RA definition through model-to-text transformations. The practitioner’s view and the artifacts are depicted in the following image:
The ecore model is currently depicted in the following image:
Creating a new Resource Adapter project in Eclipse by defining it in the RADL
After installing the RADL plugins (see Installation section later), you can create an RADL project in Eclipse by selecting File->New Project->Other… and select Panlab Resource Adapter Project as the next image displays:
Press Next. On the next window give a project name. This will be also the name of your Resource Adapter. Let’s assume here sample.wcl.ece.upatras.gr:
Press Finish. The new project will be created in Eclipse, having the following structure:
Ignore the error on MANIFEST.MF for the moment. The src folder contains the RA definition in the file with the .radl extension, the sample.wcl.ece.upatras.gr.radl.
A skeleton file is also created and opened in the RADL editor.
The RADL editor supports the RADL syntax and provides error support while defining an RA:
At any time press CTRL+SPACE for context assist:
The RA description starts with the RA name:
Resource Adapter "sample.wcl.ece.upatras.gr"
The syntax for now is really simple and consists of 5 parts, as it appears in the next image:
The first part is the:
Configuration Parameters {
param1;
param2;
}
It contains all the visible Parameters for the VCT user. For this example we have defined just two parameters: param1 and param2. The next (optional) part is:
Binding Parameters { //
remote_ip;
admin_port;
username;
password;
}
Binding Parameters are local parameters that can be used internally for resource configuration by the local testbed provider. This example RA will have as Binding parameters the remote_ip of the machine to connect, the admin_port, username and password. Next (optional) part is the Child RAs that this RA supports:
Supported Child Types {
}
Next (optional) is Allowed types that might refer to this RA:
Allowed Types {
}
The final (optional) part is what to do when an Update request arrives to the RA: The syntax is as follows:
On Update {
Execute when all Configuration Parameters are complete = YES or NO;
RAProtocol [Protocol Name] {
[Protocol Parameters]
}
}
}
Currently only the SSH protocol is fully supported in the code generation, but also http and xml-rcp is partially supported in the code generation. In our example RA, when we receive an update, we connect to the machine and execute two scripts:
The image show the syntax for SSH protocol. To select a protocol just change the syntax (context assist will help you).
Check also the RExecute syntax. It contains commands mixed with Configuration Parameters. Context assist will help you to write the correct syntax:
Code generation
When you have finished with the RA description you need to create the RA bundle. To automatically create the java code of your RA just right-click on the file Generator.mwe and select Run As->MWE Workflow.
When the workflow finishes, the src-gen folder contains all the RA source code. You can see it if you wish. Just check that there are no errors.
Finally, note that, if you do change the generated code and then at another moment you re-generate the code, all your changes will be lost.
Creating the RA bundle
To create the RA bundle just Right Click on the project name and select Export… Then select JAR file and press Next.
On the next window you can select the resources to export in your bundle and also you must select the export destination. Just select as depicted in the following image.
Press Next and the again Next. In the window that appears choose the manifest file from your project, like it appears in the next image:
Then press Finish. Your RA bundle is ready to be deployed in the PTM. Just follow instructions to install it through the PTM Manager.
Technology used
For the definition of the language (and the ecore model itself from the syntax of the language) the TMF of Eclipse was used and specifically the XText framework ( http://www.eclipse.org/XText ).
The model to text transformation is written in some xPand template files.
The gr.upatras.ece.wcl.radl.lib plugin contains all the necessary libraries: RALCommon, osgi.jar, etc
The editor is implemented by gr.upatras.ece.wcl.radl and gr.upatras.ece.wcl.radl.ui plugins.
The gr.upatras.ece.wcl.radl.generator contains the xPand templates
Installation
RADL has been tested with the latest Eclipse Helios version (RC4). You need the Eclipse Modeling Tolls edition so please go to http://www.eclipse.org/downloads/index-helios.php and download it.
Lunch Eclipse and go to Help-> Install Modeling components. Make sure to check XPand, XText (and any others you wish). After installation restart Eclipse.
UPDATE: Install the plugins by going to Eclipse Help-> Install New Software… and then put the location: http://svn.panlab.net/PII/repos/Software/download/binaries/RADL/gr.upatras.ece.wcl.radl.feature.updatesite/ and press Enter. Choose the latest version and continue. Older way by archive: Install the plugins by downloading the zip file from the PII svn http://svn.panlab.net/filedetails.php?repname=PII&path=%2FWork+packages%2FWP2-Infrastructure%2Fdev%2FRADL%2Fplugins.zip .(Currently the zip file contains many 3rd party plugins that are necessary for the RADL editor to work. Normally one should install separately the necessary software. We included here everything in order to make things much more easier)
Then go to Eclipse Help-> Install New Software… and press Add… On the window that opens click Local… and select the directory where you extracted the plugins. Finally, after clicking ok, it should look as the following image:
Press Next and normally no problems with dependencies should occur. Continue by installing the plugins, accept the plugins’ License and finally restart Eclipse when prompted.
Future work
If this way proves to be useful then more protocols will be added. Of course necessary bundles should be added to Oscar (like http or xml-rpc clients) which currently needs some time. Also the syntax can be easily improved when this is needed, i.e. for cases when one can import the definition of another RA or to assign default values (if PTM supports this).
The description could be used also to generate code for other PTMs or target platforms.
Finally, this description, can be used to easily create the java skeleton code for an RA and then proceed with more complex handling in Java code.
RA Examples
Here you can find the examples from http://trac.panlab.net/trac/wiki/RAExample described in RADL:
OS RA:
Resource Adapter "osRA"
Configuration Parameters { // Visible Parameters to VCT user
user_ip_address;
user_data_if;
}
Binding Parameters { // Local Parameters used for resource configuration
admin;
admin_pwd;
admin_ip;
}
Supported Child Types{ // Child RAs that this RA supports
sip_phone;
other_sw;
}
Allowed Types{ //Allowed types that might refer to this RA
}
SIP Phone RA
Resource Adapter "SIP_Phone"
Configuration Parameters { // Visible Parameters to VCT user
port;
}
Binding Parameters { // Local Parameters used for resource configuration
user_ip_address;
admin;
admin_pwd;
admin_ip;
}
Supported Child Types{ // Child RAs that this RA supports
}
Allowed Types{ //Allowed types that might refer to this RA
sip_server;
user_account;
}
SIP Server RA
Resource Adapter "Sip_Server"
Configuration Parameters { // Visible Parameters to VCT user
realm;
port;
}
Binding Parameters { // Local Parameters used for resource configuration
admin;
admin_pwd;
admin_ip;
}
Supported Child Types{ // Child RAs that this RA supports
user_account;
}
Allowed Types{ //Allowed types that might refer to this RA
sip_phone;
}
User Account RA
Resource Adapter "User_Account"
Configuration Parameters { // Visible Parameters to VCT user
username;
userpassword;
}
Binding Parameters { // Local Parameters used for resource configuration
}
Supported Child Types{ // Child RAs that this RA supports
}
Allowed Types{ //Allowed types that might refer to this RA
sip_phone;
}
Source Code
Included in the bundles
License
Licensed under the Apache License, Version 2.0
Contact
If you need some more info either submit an issue to trac or e-mail to tranoris (at) ece.upatras.gr
Attachments
-
image001.jpg
(10.8 KB) -
added by tranoris@… 2 years ago.
-
image002.jpg
(25.6 KB) -
added by tranoris@… 2 years ago.
-
image003.jpg
(13.6 KB) -
added by tranoris@… 2 years ago.
-
image004.jpg
(26.9 KB) -
added by tranoris@… 2 years ago.
-
image005.jpg
(12.6 KB) -
added by tranoris@… 2 years ago.
-
image006.jpg
(15.6 KB) -
added by tranoris@… 2 years ago.
-
image007.jpg
(10.3 KB) -
added by tranoris@… 2 years ago.
-
image008.jpg
(28.1 KB) -
added by tranoris@… 2 years ago.
-
image009.jpg
(15.5 KB) -
added by tranoris@… 2 years ago.
-
image010.jpg
(11.3 KB) -
added by tranoris@… 2 years ago.
-
image011.jpg
(36.6 KB) -
added by tranoris@… 2 years ago.
-
image012.jpg
(16.2 KB) -
added by tranoris@… 2 years ago.
-
image013.jpg
(27.6 KB) -
added by tranoris@… 2 years ago.
-
image014.jpg
(48.7 KB) -
added by tranoris@… 2 years ago.
-
image015.jpg
(39.9 KB) -
added by tranoris@… 2 years ago.
-
image016.jpg
(25.2 KB) -
added by tranoris@… 2 years ago.















