exasol / script-languages-release

Release Repository for Script Language Container for user defined functions (UDF's) that can be used in the EXASOL database.
https://docs.exasol.com/database_concepts/udf_scripts.htm
GNU General Public License v3.0
9 stars 5 forks source link

Use generated JNI header file #948

Closed tomuben closed 1 week ago

tomuben commented 3 weeks ago

Background

Currently, the JNI header file for the exascript native interface is checked in: https://github.com/exasol/script-languages/blob/master/exaudfclient/base/javacontainer/exascript_java_jni_decl.h The variable methods in the file is needed by the Java VM to register the native methods, see here

However, this file can be automatically generated from the Java compiler:

Generate Header file

javac -h . exascript_javaJNI.java Metadata.java ResultHandler.java TableIterator.java SWIGVM_itertype_e.java SWIGVM_datatype_e.java ConnectionInformationWrapper.java ExportSpecificationWrapper.java SWIGTYPE_p_ExecutionGraph__ExportSpecification.java SWIGTYPE_p_ExecutionGraph__ImportSpecification.java  ImportSpecificationWrapper.java

Generate descriptions

javap -s -p exascript_javaJNI

The problem is, that the variable methods need to be constructed by some regular expression (Python script?) from the output of both steps above.

tomuben commented 3 weeks ago

Here a sample output from the javac ... command:

/*
 * Class:     com_exasol_swig_exascript_javaJNI
 * Method:    ConnectionInformationWrapper_copyKind
 * Signature: (JLcom/exasol/swig/ConnectionInformationWrapper;)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_com_exasol_swig_exascript_1javaJNI_ConnectionInformationWrapper_1copyKind
  (JNIEnv *, jclass, jlong, jobject);

/*
 * Class:     com_exasol_swig_exascript_javaJNI
 * Method:    ConnectionInformationWrapper_copyAddress
 * Signature: (JLcom/exasol/swig/ConnectionInformationWrapper;)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_com_exasol_swig_exascript_1javaJNI_ConnectionInformationWrapper_1copyAddress
  (JNIEnv *, jclass, jlong, jobject);
tomuben commented 1 week ago

As we plan to refactor the UDF client in the (far) future it does not make sense to put effort into this task. Will close this ticket.