Setting up a content validation handler

You may need to create a subclass of the system provided class Content Validation Action to represent the content validation action and the handler that you provide.

Before you begin

You can skip the procedure if your content validation handler does not require any unique property values like a hostname or port number to access the external service that provides logic for content validation. You can proceed with creating a new content validation action. For more information, see topic Creating a content validation action.

About this task

In order to use the content validation handler, you need to create, deploy, and manage a content validation action along with the content validation handler. The handler may need configuration parameters to control its operation, for example to allow it to connect to an external service. This is accomplished by creating a subclass of the Content Validation Action and defining custom properties to hold the configuration parameters. You can then configure the validator for one or more storage areas.

Procedure

To set up a content validation handler:

  1. Create a Content Validation Action sub-class.
    1. Go to Object StoreData Design > Classes > Other Classes.
    2. Right-click on Content Validation Action and select New Class.
      You can provide a name for new class, for example, "ClamAV Validation Class"
    3. Finish the Create Class wizard.
  2. Create the property templates that hold the values that your content validation handler requires to access the external service that provides logic for content validation. Assign the property templates to the Content validation action subclass that you created in Step 1.
    1. Follow the instructions in Creating a property template to create a property template.
      For example, the property templates for the sample "ClamAV Validation Class" can include values for information like ClamAVHost and ClamAVPort. These values could be required to connect to the external content validation services such as a ClamAV instance.
    2. Follow instructions in Assigning properties to a class to assign the property templates to the Content Validation Action subclass.
      For example, you can assign the properties that you created like ClamAVHost and ClamAVPort to the "ClamAV Validation Class" that you created in Step 1.
  3. Create an instance of the custom sub-class that you created in Step 1.
    You can use the object reference of the instance that you create in the step when you assign a content validation object to a storage area.
    1. Click Data Design > Classes.
    2. Right-click the sub-class that you created in Step 1.
    3. Click Create Instance.
      For example, you can create an instance named "ClamAV Instance" for the ClamAV Validation Class that you already created.
    4. In the Properties pane, enter the details of the content validator instance.
      For example, for the "ClamAV Instance", you can specify the display name, enter the Prog ID as com.ibm.ecm.sample.contentvalidation.ClamAVContentValidator and provide the values for the properties like ClamAVHost and ClamAVPort to connect to the ClamAV instance. Specify the code module for the content validator. If you have an existing code module, copy and paste the object reference of the code module in the wizard. To create a new code module, see topic Creating a code module. Copy and paste the object reference of the created code module in the wizard.
    5. Complete the wizard.