3 Developing an Adapter
Developing an adapter requires you to understand the overall process. You should plan your programs and packages carefully.
For details on this process, see the following:
- Adapter Development Process
The adapter development process is detailed. You should understand this process before beginning your development. - Planning Programs and Packages
Each custom function and procedure required for your adapter must be contained in a PL/SQL package (Package B) and the package must be uploaded to a Source Code definition in the Program definition in your Adapter Area. - Using the Security API Package During Development
You must call a security API, CDR_PUB_API_INITIALIZATION, from every package that calls an Oracle Life Sciences Data Hub API and that you intend to run from outside Oracle Life Sciences Hub.
Adapter Development Process
The adapter development process is detailed. You should understand this process before beginning your development.
The following diagram depicts the process required to create an adapter.
To develop an adapter, work in SQL Developer or a similar tool, using your own Oracle Life Sciences Data Hub user account that is linked to a database account with Execute privileges on the API security package CDR_PUB_API_INITIALIZATION.
Parent topic: Developing an Adapter
Planning Programs and Packages
Each custom function and procedure required for your adapter must be contained in a PL/SQL package (Package B) and the package must be uploaded to a Source Code definition in the Program definition in your Adapter Area.
The required functions and procedures can all be in the same package or in different packages. If multiple people are developing the adapter, it may be helpful for each of them to work on a separate package, upload each package to a different Source Code definition and create a different Program for each Source Code definition so that each Program can be installed separately. However, all Program instances must be contained in the same Work Area.
Note:
It is very important to have only one Work Area in an Adapter Area. This ensures that all the custom PL/SQL packages you write are installed in the same schema.
Parent topic: Developing an Adapter
Using the Security API Package During Development
You must call a security API, CDR_PUB_API_INITIALIZATION, from every package that calls an Oracle Life Sciences Data Hub API and that you intend to run from outside Oracle Life Sciences Hub.
This API contains three functions:
- EnableApis sets the EnableAPIs flag to True.
- DisableApis sets the EnableAPIs flag to False.
- AreApisEnabled returns the flag setting.
The initialization of almost every API calls the AreApisEnabled function of the security API, CDR_PUB_API_INITIALIZATION, to check if the EnableAPIs flag is set to True in the calling program. If EnableAPIs set to False, the initialization fails.
To set the EnableApis flag to True, your user account must have Execute privileges on the CDR_PUB_API_INITIALIZATION API.
Package A: Package A is always run outside of Oracle Life Sciences Hub. Therefore you need to call EnableApis at the beginning of your package body and call DisableAPIs at the end.
Package B: You develop Package B outside of Oracle Life Sciences Hub, so you must call EnableApis at the beginning of the package body and call DisableAPIs at the end. However, you upload Package B to a Program inside an Oracle Life Sciences Hub Adapter Area and the adapter calls the functions and procedures and runs them inside Oracle Life Sciences Hub. Packages that call CDR_PUB_API_INITIALIZATION from within Oracle LSH fail.
Therefore, if you call public APIs from Package B, you must call EnableApis and DisableApis so that you can run the package outside Oracle Life Sciences Hub, but when you are ready to upload the code to Oracle Life Sciences Hub, you must comment out the calls.
You may well want to use public APIs in your custom functions and procedures. For example, if you allow users to upload Table Columns during Load Set definition, you can take advantage of the public API for creating Table Descriptors as part of the upload_table_columns function.
Parent topic: Developing an Adapter