Custom classifier Java class for Guardium

This guide describes how to create a custom classifier Java class for Guardium


Author(s): Richard Lennert | Created: 14 April 2023 | Last modified: 14 April 2023
Tested on: IBM Security Guardium 11.4, IBM JDK 8.0.7.0

Custom classifier Java class for Guardium

First, create a local copy of the Evaluation interface that your class must implement.

package com.guardium.classifier.custom;

import java.io.Serializable;

public interface Evaluation extends Serializable {
    public boolean evaluate(String value);
}

Then, develop your logic in a class that implements this interface.

package com.guardium.classifier.custom;

public class MyClassifier implements Evaluation {

    private static final long serialVersionUID = -1962187816746123717L;

    public MyClassifier() {

    }

    @Override
    public boolean evaluate(String value) {
        // Implement your logic here
        return false;
    }
}

As your scenario is executed Guardium will instantiate your class once, then call evaluate() for each value that needs to be classified.

Compile your class with the latest release of IBM JDK version 8, for example:

<ibm_jdk_path>/bin/javac Evaluation.java MyClassifier.java

Next, upload the compiled MyClassifier.class as described in the following article: https://www.ibm.com/docs/en/guardium/11.4?topic=system-manage-custom-classes

The class can be used in a classification rule by setting its fully qualified class name in the Evaluation name field of the rule. (Details: https://www.ibm.com/docs/en/guardium/11.4?topic=discover-rule-criteria)