-
Notifications
You must be signed in to change notification settings - Fork 89
api v3 guidelines
Nedelcho Delchev edited this page Aug 9, 2017
·
6 revisions
Since version 3.0 the Javascript API supports also V8 engine. This requires redesign of the API itself in an incompatible way, because the Java objects from the JVM are not directly accessible and manageable from the Javascript engine as it is the case for the Rhino and Nashorn engines.
API developers have to follow the rules below when introducing new APIs, which require communication with the JVM underneath:
- From the Java side a "facade" has to be implemented with public static methods, which are supposed to be called by the Javascript engine.
- The facade's methods must have input and output parameters only as primitives.
- In case of complex parameters needed, a serialization and deserialization to/from JSON have to be considered.
- The Java facade and Javascript API module should relate to each other 1:1
- The Javascript modules must be placed in repositories in the GitHub's DirigibleLabs organization following the naming convention "api-v3-XXX" where the XXX is the particular name of the API group of modules e.g. core, http, utils, etc.
- The repository should have a root folder named in the same way as the API group part of the repository following the subfolder "v3". All the modules in this group should be placed under "v3" subfolder and below.
- A separate module in the main Eclipse Dirigible repository have to be created under the "content" subfolder containing all the "webjars" modules.
- The necessary test cases have to be introduced in the "dirigible-api-tests" module, to guarantee the compatibility between the Javascript engines.