XINS can support multiple implementations for the same API. To add a
new implementation for the API add in the
name attribute to the api. For example
<project name="myprojects" domain="com.mycompany"> <api name="allinone"> <impl /> <impl name="mystub" /> </api> </project>
New targets are created for this implementation. Only server side
targets (war, javadoc-api, run, ...) are created for this new
implementation. The other targets only depend on the specification which
doesn't change. The new target syntax is
name>-<implementation name>. For example to compile the
new implementation of the example above execute xins
The list of the API names with the possible implementation is printed at the end of the execution of the xins help command.
Having the possibility to have more than one implementation is useful when you want to create a stub (fake API) so that other systems can test the API before being implemented.
XINS offers the possibility to generate a stub implementation of the API. The stub is generated based on the examples defined in the function specification.
To generate the stub implementation execute xins
stub-<api name>-<implementation name>. Then the stub
file are generated in the directory
name>\impl-<implementation name>\<package name>.
You can also edit the generated code, for example to be more flexible with
some input parameters or to return other values. Note that the stub target
won't replace existing files.