The Java action runs a Java class that returns a string. The string value is an SQL statement that replaces the original SQL statement from the client request.
The Java class must contain a public static method with the following signature:
public static String execute(RuleContext ctx)
You must enter the correct class in the Class Path field of the Java action. The Rule Engine reads every rule in the rule set and returns an error if the class path is incorrect, even if the rule is disabled.
When an error occurs with the Java class, the Rule Engine does not apply the rule. Instead, the Rule Engine continues to the next rule. The Rule Engine logs a detailed error message in the following file:
<Dynamic Data Masking installation>\log\DDMError.txt
The Java action has the following parameters:
Class Path
Defines a list of JAR files that contain the Java action class and necessary libraries. Use semicolons to separate multiple JAR files.
Class Name
Defines the fully qualified class name. The class may be built within a named package or an unnamed package. The class must include a method named
execute
with the following signature:
public static String execute(RuleContext ctx)
.
The
RuleContext
object contains data from the Rule Engine. The
RuleContext
object has one method,
public String getSymbol(String symbol);
, that returns the symbol value from the symbol name. Use this method to retrieve symbol values defined by a Symbol rule action. Specify the name of the symbol as an argument to the method.
You can also use the following predefined symbols:
RuleContext.USERNAME
Retrieves the Oracle user name.
RuleContext.OS_USER
Retrieves the operating system user on the client machine.
RuleContext.CLIENT_HOST
Retrieves the name of the client machine.
RuleContext.PROGRAM
Retrieves the program name on the client machine.
RuleContext.STATEMENT
Retrieves the statement being processed.
The Rule Engine runs the Java class with the JVM that Dynamic Data Masking uses. You can compile the Java action class with a JDK of the same major version or lower version of the JVM that Dynamic Data Masking uses.