Setting Up Extensions

To set up the extended framework for BRM REST Services Manager, perform these tasks:

Task 1: Create a Java Extension Project

The following procedure shows how to create a Java extension project for extending BRM REST Services Manager.

Note:

BRM REST Services Manager includes a sample extension project, including a README.md file explaining the sample, in the REST_home/SDK/references/brm-rest-extension directory where REST_home is the directory in which you installed BRM REST Services Manager. Use this sample when developing your customizations.

  1. Create a Java project using an integrated development environment (IDE) such as Eclipse.

  2. Add the REST_home/SDK/libs/brm-rest-api-service.jar file as an external JAR to your project's build path.

  3. Add the following dependent JAR files from the REST_home/SDK/libs directory to your project's build path:

    • jackson-annotations-2.10.0.jar
    • jackson-core-2.10.0.jar
    • jackson-databind-2.10.0.jar
    • jakarta.ws.rs-api-2.1.6.jar
    • oraclepki.jar
    • osdt_cert.jar
    • osdt_core.jar
    • pcm.jar
    • pcmext.jar
    • pfc.jar
    • snakeyaml-1.26.jar
  4. Create a model class named ExtendedbaseObject.java in the REST_home/sdk/references/brm-rest-extension/src/com/oracle/communications/oms/brm/rest/extension/model/impl directory. Where baseObject is the name of the original BRM object, such as CustomerBill, Usage, AccumulatedBalance, or BillingAccount.

    Add attributes to the model class to meet your business needs. You can refer to the sample extended model classes in the REST_home/sdk/references/brm-rest-extension/src/com/oracle/communications/oms/brm/rest/extension/model/impl directory when making your customizations.

  5. Create a service model named ExtendedbaseObjectServiceImpl in the REST_home/sdk/references/brm-rest-extension/src/com/oracle/communications/oms/brm/rest/extension/service/impl directory and then customize it to meet your business needs. For example, you could customize the service model to retrieve additional attributes or to call a different BRM opcode.

    You can refer to the sample extended service model classes in the REST_home/sdk/references/brm-rest-extension/src/com/oracle/communications/oms/brm/rest/extension/service/impl directory when making your customizations.

  6. If you want the extended REST framework to call a custom opcode, create a helper model class named ExtendedbaseObjectHelper in the REST_home/sdk/references/brm-rest-extension/com/oracle/communications/oms/brm/rest/extension/helper directory.

    Customize the helper model to meet your business needs. You can refer to the sample extended helper model classes in the REST_home/sdk/references/brm-rest-extension/src/com/oracle/communications/oms/brm/rest/extension/helper directory when making your customizations.

  7. Build the JAR file by running this command:

    ant -f build.xml

Task 2: Run the BRM REST Services Manager API with the Extended JAR

To run the BRM REST Services Manager API with your extended JAR file:

  1. Copy the brm-rest-extension.jar generated in Task 1 to the REST_home/SDK/libs directory.

  2. Stop BRM REST Services Manager by going to the REST_home/scripts directory and running this command:

    ./stop_brm_rsm.sh
  3. Start BRM REST Services Manager by going to the REST_home/scripts directory and running this command:
    ./start_brm_rsm.sh

Task 3: Send a Request with the Extended URL Structure

BRM REST Services Manager determines whether to use the original REST framework or your extended REST framework by reading the @type query parameter passed in the URL of your requests:

  • When @type is missing or set to baseObject, such as CustomerBill, Payment, or Usage, the original framework is used.

  • When @type is set to baseObjectOracle, such as CustomerBillOracle, PaymentOracle, or UsageOracle, your extended framework is used.

To use your extended REST framework, include the @type query parameter, set to baseObjectOracle in the URL of your requests. For example, the URL for customer bills would be:

http://hostname:port/brm/customerBillManagement/version/customerBill?@type=CustomerBillOracle

For more information about the URL syntax, see "Send Requests".

Task 4: (Optional) Extend the Describe Endpoint

If you want the describe endpoint to include your custom API changes, such as schema extensions, in the endpoint specifications it retrieves, do the following:

  1. Update the YAML file in the REST_home/SDK/references/brm-rest-extension/src/resources/yaml directory with your custom changes.

  2. Copy the ExtendedDescribeServiceImpl file from the REST_home/SDK/references/brm-rest-extension/src/com/oracle/communications/oms/brm/rest/extension/service/impl directory and add it to your extension project.

  3. Copy the ExtendedDescribeHelper file from the REST_home/SDK/references/brm-rest-extension/src/com/oracle/communications/oms/brm/rest/extension/helper directory and add it your extension project.

  4. Build your extended JAR file.

For more information about the describe endpoint, see "Retrieve Endpoint Metadata".