External Java interfaces

    Introduction

    JChem Cartridge supports the ability to execute external program objects written in Java. To make an own external Java program available from SQL a PL/SQL function (and an according operator) and a Java class has to be defined.

    JChemCartModul

    A Java class can be called from JChem Cartridge if it implements the JChemCartModul interface.

    The interface has a doFunc function that is called by the send_user_func PL/SQL function. The doFunc function gets a String array as parameter. This array contains the items of the parameter list defined in the third parameter of the send_user_func PL/SQL function (the parameter list is converted into a String array using the separator String defined in the second parameter of the send_user_func PL/SQL function).

    The doFunc function returns a Java object type and sends it back to the caller send_user_func PL/SQL function.

    JChemCartEvalModul

    There is a more efficient way to evaluate user defined operators appearing in the where clause. To increase the speed of these queries the evaluation of the user defined operator's return value has to be performed on the Java side. This requires another Java class beside the one that implements the JChemCartModul interface. This Java class has to implement the JChemCartEvalModul interface. Its name has to be the same as the name of the Java class that implements the JChemCartModul interface with the "_eval" end.

    This interface has an eval function that gets two parameters. The first one is the returning object of the JChemCartModul Java class. The second is a String called "opStr" containing the lower and upper boundary points for the operator return value and information of the relational operator (were defined in the SQL statement).

    Format of the opStr string: lower_value/upper_value/op where:

    lower_value the lower value of the operator returning value. If there is no lower value defined it's values is "null".

    upper_value the upper value of the operator returning value. If there is no upper value defined it's values is "null".

    op an integer describing the relational operator:

    4 if no upper value defined: operator >= lower value

    else operator >= lower value and operator < upper value

    8 if no lower value defined: operator <= upper value

    else operator <= upper value and operator > lower value

    12 operator <= upper value and operator >= lower value

    13 operator = upper value

    The eval function has to return a boolean value. Returns true if the returning value is acceptable regarding to the relational conditions (defined by the "opStr" String), returns false if not.

    Here are some examples concerning to the "opStr" String:

    SQL statement opStr string
    select ... where my_op(cd_smiles) < 11; null/11/0
    select ... where my_op(cd_smiles) <= 5; null/5/8
    select ... where my_op(cd_smiles) = 34; 34/34/13