Acceleo/Specifications/Improved Java Services Modules Generation
- 1 Improved Java Services Modules Generation
- 1.1 Introduction
- 1.2 Detailed Specification
- 1.2.1 Use the JDT to generate the content of the module used to call Java services
- 1.2.2 Provide a contextual action on Java files to generate a module to call the Java services
- 1.2.3 Improve the Acceleo builder to generate automatically the module used to call the Java services
- 1.2.4 API Changes
- 1.2.5 User Interface Changes
- 1.2.6 Documentation Changes
- 1.3 Tests and Non-regression strategy
Improved Java Services Modules Generation
Current status is DRAFT
There are several issues with the current implementation used to generate an Acceleo module used to call Java services. Firstly, this generation is realized by deploying the project containing the Java services which can create several side effect if the project and its dependencies are not in a valid state. The Java Development Tools (JDT) should be used instead. Secondly, the process used to generate such module is too heavy, a contextual action should be available on a Java class to generate the matching Acceleo module. Thirdly, the Acceleo builder should be able to automate the generation of the Acceleo module used to call Java services.
Use the JDT to generate the content of the module used to call Java services
Due to various possible side effects and performances issues with the current solution, involving the deployment of the project containing the Java services as an OSGi bundle, the generation of the module should use the JDT to determine the signature of the methods available in the Java class. Only public methods (static or not) will be considered, just like with the old way.
Provide a contextual action on Java files to generate a module to call the Java services
The contextual action should let anyone generate an Acceleo module invoking Java services easily. This action should only be available on Java files located in an Acceleo project. It will create the same result as the wizard used to create an Acceleo module initialized with Java services. Some information, entered by the user in the wizard, will be computed thanks to various metadata in the Javadoc of the class.
- The name of the module will be the name of the class starting with a lower case letter.
- The URI of the metamodels that should be used will be found by using the Javadoc of the Java class. In order to declare a nsURI to use, the end user should use the tag "@nsURI".
Improve the Acceleo builder to generate automatically the module used to call the Java services
The module used to call the Java services could be created automatically by the Acceleo builder. In order to provide this feature, the builder needs to know which classes should be taken into account for the automatic generation.
In order to determine if a Java file should be used by the builder to generate automatically the Acceleo module, the tag "@AcceleoJavaServiceClass" will have to be placed in the Javadoc of the class. Whlie detecting this tag in the Javadoc, the builder would use the same routine as the contextual action described before.
Those evolution have no impact on any existing API and they will create module similars to the ones generate by the wizard.
User Interface Changes
A new contextual action will be available on Java classes located in an Acceleo project
The documentation of the Java services will be improved to specify those two new ways to generate the module used to invoke the Java services.
Tests and Non-regression strategy
Unit tests of the code generated by switching to the JDT will be put in place. There was no tests before for the "deployment based" behavior.