Creating a custom repository type
Use a repository API to create a custom repository type for repository types that are not provided with Pega Platform. The Google Drive Repository Integration component that is available on Pega Marketplace is an example of a custom repository type. Custom repository types appear wherever you can select a repository, such as the content storage options in the Application definition in Dev Studio.
- To see an example of a custom repository type, you can download the Google Drive Repository Integration component on Pega Marketplace.
- 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. The authentication mode might require user credentials, or use a token-based protocol such as OAuth 2.0.
Once you create a custom repository type, it functions in the same way as the repositories delivered with Pega Platform.
Create a new abstract class for your custom repository type.This class should be a subclass of the Embed-Repository-Type-Custom class.
Configure the repository type.
Upload an icon that represents your custom repository type to the
webwbdirectory.For more information, see Adding images to Image Library.
Create a field value that translates the full name of your custom repository type to a shorthand name that appears in the repository type selector when you create a new repository data record. Create the field value in the Data-Repository class for the pyType field.For more information, see Creating a field value.
Update the Code-Pega-List.pyRepoTypes data transform so that it appends a new page to the pxResults page list property. Configure the appended page by setting the following properties:
- Set the pxObjClass property to Data-Repository.
- Set the pyType property to the full name of your custom repository type.
- Set the pyRepositoryName property to the shorthand name of your custom repository type.
- Set the pyImageUrl property to the name of your icon file.
- To test whether your data transform is adding the correct content to the pxResults property, run the D_pxLoadRepoTypes data page and inspect the results.
Override the pyRepoConfiguration section rule in your custom repository type.You use this section to configure connectivity details for your repository, such as host name or URL, authentication details or credentials, custom properties, and options.
Implement the following repository APIs:
- Create folder API – Override the pyNewFolder activity, which is called by the D_pxNewFolder data page.
- Create file API – Override the pyNewFile activity, which is called by the D_pxNewFile data page.
- Get file API – Override the pyGetFile activity, which is called by the D_pxGetFile data page.
- List files API – Override the pyListFiles activity, which is called by the D_pxListFiles data page.
- Exists API – Override the pyExists activity, which is called by the pxExists When rule.
- Delete API – Override the pyDelete activity, which is called by the D_pxDelete data page.
- Is Authenticated API – Override the pyIsAuthenticated activity, which is called by the D_pxIsAuthenticated data page.
For usage information about these APIs, see Repository APIs.