LinkedIn
Copied!

Table of Contents

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.

  1. Create a new abstract class for your custom repository type.

    This class should be a subclass of the Embed-Repository-Type-Custom class.
  2. Configure the repository type.

    1. Upload an icon that represents your custom repository type to the webwb directory.

      For more information, see Adding images to Image Library.
    2. 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.
    3. 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:

      1. Set the pxObjClass property to Data-Repository.
      2. Set the pyType property to the full name of your custom repository type.
      3. Set the pyRepositoryName property to the shorthand name of your custom repository type.
      4. Set the pyImageUrl property to the name of your icon file.
      5. 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.
    4. 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.
  3. 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.

Did you find this content helpful?

100% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.