Custom repository types
You can build custom repository types for various file storage types. For example, you can build a Google Drive custom repository type that you can use similarly to how you use the repository types that are included with Pega Platform. Custom repository types appear in the Pega Platform user interface in the same places as the included repository types. Custom repository types are implemented by using repository APIs.
You can implement custom storage in the following ways:
- Use a custom repository type – Using a custom repository type is the preferred method for Pega 7.4 and later. Custom repository types make it easy to access back-end stores and migrate to a different store without changing application logic. For information about connecting to a custom repository, see Creating a custom repository type.
- Use a web storage provider – Using a web storage provider was the only method prior to Pega 7.4. For more information, see Downloading and configuring pluggable web storage components.
Repositories differ from web storage in the following ways:
- Only repositories support streaming. If your application processes large files or multiple concurrent files, use a repository.
- Custom repositories can be used for file interactions in different scenarios, such as with file listeners or the Deployment Manager. Web storage is limited to storing and sourcing Pulse and case attachments.
Before creating a repository, you must have access to the storage provider's API and you must select the authentication mode to use with the API.
For interactive authentication, use OAuth 2.0 and the Information Mashup gadget. For more information about this gadget, see Adding an Information Mashup section. For non-interactive authentication, use basic authentication.
Custom repository type subclass
To configure a custom repository type, you must create a subclass from the Embed-Repository-Type-Custom class. For example, to create a Box repository type, you must create the subclass, Embed-Repository-Type-Custom-Box. This class acts as the container for the information that is required to represent a repository type. This class is also the entry point for all the repository APIs.
To add support for the custom repository type to the Data-Repository rule form, override the pyRepoConfiguration section in your custom class.
Configuring the repository type
To add your custom repository type as an option in the list of repository types on the repository rule form, perform the following steps. For this example, the custom repository type is Box.
- Upload an icon that represents your custom repository type to the webwb directory.
- Update the Code-Pega-List.pyRepoTypes data transform with the repository details, such as icon and name.
- To add the Test connectivity button functionality to your repository so that you can test the connection to the repository, implement the D_pxIsAuthenticated API for the custom repository. For information about this API, see Defining repository APIs.
Repository APIs are savable data pages. To make your repository fully functional, you must implement all the following repository APIs:
- Create folder API (D_pxNewFolder)
- Create file API (D_pxNewFile)
- Get file API (D_pxGetFile)
- List files API (D_pxListFiles)
- Exists API (pxExists when rule)
- Delete API (D_pxDelete)
- Is Authenticated API (D_pxIsAuthenticated )
Repository APIs are implemented by creating an activity that an existing data page will call. You must delegate the data page API to custom extension points in the form of 'py' activities to be implemented in the custom class. For example, Embed-Repository-Type-S3 and Embed-Repository-Type-Azure each have different 'py' activities.
Refer to the pyNewFile activity in the Embed-Repository-Type-S3 class for an example of implementing the pyNewFile activity for the custom repository type. For more information about these APIs, see Implementing repository APIs for a custom repository. For usage documentation of these APIs, see the History tab of each API's data page implementation in Dev Studio.