From dfe5c525109e57d1a40522217623371d78919092 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Wed, 22 Jul 2026 16:33:59 +0200 Subject: [PATCH] Call the generated JMEOS surface from the AIS and SNCB mains JMEOS carries two FFI facades: functions.GeneratedFunctions, emitted from the MEOS-API catalog at build time, and the hand-maintained functions.functions. These two mains are the only callers of the hand one left in the ecosystem, and holding it alive costs the surface its single generated source: a MEOS rename reaches a hand-maintained declaration as an UnsatisfiedLinkError at call time. Bind GeneratedFunctions instead. Every signature involved is identical between the two facades, including tsequence_make, whose first parameter is a Pointer in both, so the call sites change only in the class they name. The SNCB main imported the facade without calling it; that import goes too. --- .../src/main/java/aisdata/Query8_V2_Main.java | 25 +++++++++---------- .../main/java/sncbdata/Query8_V2_Main.java | 1 - 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/flink-processor/src/main/java/aisdata/Query8_V2_Main.java b/flink-processor/src/main/java/aisdata/Query8_V2_Main.java index dc55789..9594ec4 100644 --- a/flink-processor/src/main/java/aisdata/Query8_V2_Main.java +++ b/flink-processor/src/main/java/aisdata/Query8_V2_Main.java @@ -24,7 +24,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import functions.functions; import functions.GeneratedFunctions; import functions.error_handler; import functions.error_handler_fn; @@ -63,8 +62,8 @@ public static void main(String[] args) throws Exception { logger.info("Java library path: {}", System.getProperty("java.library.path")); try { - functions.meos_initialize_timezone("UTC"); - functions.meos_initialize_error_handler(new error_handler()); + GeneratedFunctions.meos_initialize_timezone("UTC"); + GeneratedFunctions.meos_initialize_error_handler(new error_handler()); final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); @@ -97,7 +96,7 @@ public static void main(String[] args) throws Exception { logger.error("Error during execution: {}", e.getMessage(), e); throw e; } finally { - try { functions.meos_finalize(); } + try { GeneratedFunctions.meos_finalize(); } catch (Exception e) { logger.error("Error during MEOS finalization: {}", e.getMessage(), e); } } } @@ -125,8 +124,8 @@ public MeosEkfWindowFunction(double gate, double q, double r, boolean dropOutlie public void open(OpenContext parameters) throws Exception { super.open(parameters); errorHandler = new error_handler(); - functions.meos_initialize_timezone("UTC"); - functions.meos_initialize_error_handler(errorHandler); + GeneratedFunctions.meos_initialize_timezone("UTC"); + GeneratedFunctions.meos_initialize_error_handler(errorHandler); } @Override @@ -149,11 +148,11 @@ public void process(Integer mmsi, Context context, AISData event = sorted.get(0); String wkt = String.format("POINT(%f %f)@%s", event.getLon(), event.getLat(), millisToTs(event.getTimestamp())); - Pointer inst = functions.tgeompoint_in(wkt); + Pointer inst = GeneratedFunctions.tgeompoint_in(wkt); if (inst == null) return; Pointer seedArray = Memory.allocate(runtime, Long.BYTES); seedArray.putPointer(0, inst); - Pointer singleSeq = functions.tsequence_make( + Pointer singleSeq = GeneratedFunctions.tsequence_make( seedArray, 1, true, true, TInterpolation.LINEAR.getValue(), true); if (singleSeq == null) return; String result = String.format( @@ -161,7 +160,7 @@ public void process(Integer mmsi, Context context, + " | window [%s - %s]%n" + " raw=cleaned: %s", mmsi, windowStart, windowEnd, - functions.tspatial_as_ewkt(singleSeq, 6)); + GeneratedFunctions.tspatial_as_ewkt(singleSeq, 6)); log.info(result); out.collect(result); return; @@ -172,7 +171,7 @@ public void process(Integer mmsi, Context context, for (AISData event : sorted) { String ts = millisToTs(event.getTimestamp()); String wkt = String.format("POINT(%f %f)@%s", event.getLon(), event.getLat(), ts); - Pointer inst = functions.tgeompoint_in(wkt); + Pointer inst = GeneratedFunctions.tgeompoint_in(wkt); if (inst == null) { log.error("[EKF-V2] tgeompoint_in returned null for MMSI={} wkt={}", mmsi, wkt); continue; @@ -186,7 +185,7 @@ public void process(Integer mmsi, Context context, for (int i = 0; i < instants.size(); i++) { ptrArray.putPointer((long) i * Long.BYTES, instants.get(i)); } - Pointer rawSeq = functions.tsequence_make( + Pointer rawSeq = GeneratedFunctions.tsequence_make( ptrArray, instants.size(), true, true, TInterpolation.LINEAR.getValue(), true); if (rawSeq == null) { log.error("[EKF-V2] tsequence_make returned null for MMSI={}", mmsi); @@ -208,8 +207,8 @@ public void process(Integer mmsi, Context context, + " cleaned: %s", mmsi, instants.size(), gate, q, r, dropOutliers, windowStart, windowEnd, - functions.tspatial_as_ewkt(rawSeq, 6), - functions.tspatial_as_ewkt(cleanedSeq, 6)); + GeneratedFunctions.tspatial_as_ewkt(rawSeq, 6), + GeneratedFunctions.tspatial_as_ewkt(cleanedSeq, 6)); log.info(result); out.collect(result); diff --git a/flink-processor/src/main/java/sncbdata/Query8_V2_Main.java b/flink-processor/src/main/java/sncbdata/Query8_V2_Main.java index 706de3c..b49c187 100644 --- a/flink-processor/src/main/java/sncbdata/Query8_V2_Main.java +++ b/flink-processor/src/main/java/sncbdata/Query8_V2_Main.java @@ -24,7 +24,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import functions.functions; import functions.GeneratedFunctions; import functions.error_handler; import functions.error_handler_fn;