A REST RA module generates a Rhino resource adaptor (RA) that has support for one or more REST API (modules).
Follow these steps to build a resource adaptor, that supports one or more REST APIs, for use in Rhino TAS - Telecom Application Server.
Step 1: Create a REST RA module
The first step is to use the SDK tool sdkadm to create an REST RA module from a module-pack. The REST RA module creates a deployable REST RA.
Use the
sdkadm list-modules command to list available module-packs.
|
1 |
Create a REST RA module Create a REST RA module with the For example, to create a REST RA module called sdkadm create-module
|
---|---|
2 |
Confirm the name of REST RA module The suggested value is the directory name passed in the sdkadm top level module
|
The create-module
command will then create your new REST RA module.
Renaming ivy modules and updating dependencies.
Renaming symbolic property references in source files.
Checking "deps.properties" for missing values.
Done. New module(s) should now be available at: ~/work/unified-rest-ra-sdk/example-rest-ra
The generated module for the example REST RA is:
~/work/unified-rest-ra-sdk$ ls -la example-rest-ra/
total 40
drwxr-xr-x 9 fwuser staff 288 3 Nov 13:53 .
drwxr-xr-x@ 17 fwuser staff 544 3 Nov 13:53 ..
-rw-r--r-- 1 fwuser staff 54 3 Nov 13:53 .sdk.root
-rw-r--r-- 1 fwuser staff 830 3 Nov 13:53 HOW-TO-ADD-API.txt
-rw-r--r-- 1 fwuser staff 695 3 Nov 13:53 build.xml
drwxr-xr-x 3 fwuser staff 96 3 Nov 13:53 config
-rw-r--r-- 1 fwuser staff 2924 3 Nov 13:53 ivy.xml
-rw-r--r-- 1 fwuser staff 183 3 Nov 13:53 module.properties
drwxr-xr-x 3 fwuser staff 96 3 Nov 13:53 src
-
Instructions for configuring the REST RA
-
directory with a configuration file that is updated when you add new REST APIs to the REST RA
-
Ivy configuration file that you edit to define the REST APIs your RA will support
Step 2: Configure the REST RA module
The developer customizes properties in the REST RA Module, and updates its dependencies to include all required API Modules.
There are two steps to follow:
1 |
Add dependencies to ivy.xml Add two Ivy dependencies for each REST API in your project that this REST RA should support.
The plugin should be in the For example, to add support for the PingPing API add:
|
||
---|---|---|---|
2 |
Update config/raname-unfied-rest-ra-config.yaml This configuration file defines properties such as the tracer level for the RA, IncomingRequestTimeout and so on. |
The finished RA Module can be checked into source control.
Step 3: Build the REST RA module
The REST RA Module build retrives the Unified REST RA Core module artifacts and all dependent API Modules artifacts (including SLEE libraries & RA Types). These artifacts are assembled to produce a deployable REST RA that supports all the given APIs.
The developer can now deploy their REST RA into Rhino, and use all of its supported APIs with their service.
For an introduction to the architecture of a Unified REST RA see: Rhino REST API Framework Architecture |
Generated package-info.java
The following java code snippet is for an example RA that implements the the Pet Store API and the Ping Pong API.
@ResourceAdaptorDeployableUnit(
securityPermissions = @SecurityPermissions(
securityPermissionSpec = "grant {... };"
)
)
@ResourceAdaptor(
vendorExtensionID = "unified-rest-ra-id",
raTypes = {
@ResourceAdaptorTypeReference(
raType = @ComponentId(name="petstore-api-server", vendor="ExampleCo", version="1.0")),
@ResourceAdaptorTypeReference(
raType = @ComponentId(name="pingpong-api-server", vendor="ExampleCo", version="1.0")),
@ResourceAdaptorTypeReference(
raType = @ComponentId(name="rest-api-common", vendor="OpenCloud", version="1.0.0"))
},
libraryRefs = {
@LibraryReference(
library = @ComponentId(name="base-rest-api-plugin", vendor="OpenCloud", version="1.0.0")),
@LibraryReference(
library = @ComponentId(name="petstore-api-server-plugin", vendor="ExampleCo", version="1.0")),
@LibraryReference(
library = @ComponentId(name="pingpong-api-server-plugin", vendor="ExampleCo", version="1.0")),
@LibraryReference(
library = @ComponentId(name="rest-ratype-spi", vendor="OpenCloud", version="1.0.0"))
}
)
@OcAssociatedType(UnifiedRestFrameworkRA.class)
package com.opencloud.slee.rest;
import com.opencloud.slee.rest.impl.UnifiedRestFrameworkRA;
import com.opencloud.slee.annotation.*;
import javax.slee.annotation.*;
import javax.slee.annotation.du.*;
-
@ResourceAdaptorTypeReference for the Pet Store API RA Type
-
@ResourceAdaptorTypeReference for the Ping Pong API RA Type
-
@LibraryReference for the Pet Store API plugin
-
@LibraryReference for the Ping Pong API plugin
-
@OcAssociatedType references the Unified REST RA core, where other remaining RA relatred annotations are defined