Background on annotations in the Sentinel Express SDK

Java annotations are used to define component metadata. When modules are built, the annotations are processed by the slee-annotation-processor. All OpenCloud annotations are scoped to the class file, that is, they exist in both the source file and the Java compiler-generated class files. Therefore, they can be inspected by various tools that operate on class files.

In the Sentinel Express SDK Java annotations are used to produce

  • JSLEE standard deployment descriptor files

  • OpenCloud extended deployment descriptor files

  • OpenCloud Sentinel JSON bindings metadata files

  • OpenCloud Sentinel provisioning metadata

  • OpenCloud Sentinel metadata files.

All of the above files are produced by the default build.xml when a module is compiled.

Variables in annotation source code

The annotation processor supports the use of variables in Java annotations. The variables are substituted to values at build time. The source code for the annotation includes the variable; whereas the class file contains the variable translated into a constant. Annotation variables are always quoted, and begin and end with the @ character.

Here’s an example of a variable, the VariableVersion:

@LibraryReference(library = @ComponentId(name = "ExampleLibrary", vendor = "ExampleVendor", version ="@VariableVersion@"))

If variables cannot be substituted, the annotation processor fails at compile time, noting the name of the unsubstituted variable.

SLEE annotations

SLEE annotations provide functionality for developing SLEE components, covering the JSLEE 1.1 specification, and OpenCloud extensions.

Sentinel annotations

Sentinel annotations provide functionality for developing Sentinel components. Sentinel components are also SLEE components, so the SLEE Annotations Javadoc is a useful source (see above).

Setting up your IDE to view annotations

The most productive way to view the content of annotations is to view them inside an IDE that supports Java annotations.

If you are an Eclipse user, type ant eclipse-setup in the root of your SDK. Then, each time you add a module, type ant eclipse-setup in the root again. Dependency discovery for the generated Eclipse project requires the SDK to have been fully built with ant publish-local in the root of the SDK.

If you are an Idea user, type ant idea-setup in the root of your SDK. Then, each time you add a module, type ant idea-setup in the root again.

To view annotation content without using an IDE, please refer to the Javadoc.

Examples of annotations in real modules

The Sentinel Express SDK includes several features, libraries, profiles, and so one throughout its module packs. To view available module packs, use the sdkadm command, and type

list-modules +module-pack

You can create modules from different module packs using the create-module command within sdkadm; and then look at the contents of the various src directories.

Note

For more about modules, see Modules in the Sentinel Express SDK

Also, the Creating a feature section includes inline source code for several modules. These include annotations.

Previous page Next page