From 12b49957ece1db3f3295c251c93186ac0527d964 Mon Sep 17 00:00:00 2001 From: Michael Tsang Date: Tue, 19 Nov 2024 11:37:22 +0000 Subject: [PATCH 01/60] make all polling updater wait for graph update finish --- .../alert/GtfsRealtimeAlertsUpdater.java | 45 +++++++++---------- .../updater/trip/PollingTripUpdater.java | 5 ++- .../VehicleParkingAvailabilityUpdater.java | 5 ++- .../VehicleParkingUpdater.java | 5 ++- .../PollingVehiclePositionUpdater.java | 5 ++- .../vehicle_rental/VehicleRentalUpdater.java | 5 ++- 6 files changed, 36 insertions(+), 34 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java index b71dad6a656..0e7ab35cb13 100644 --- a/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java @@ -2,6 +2,7 @@ import com.google.transit.realtime.GtfsRealtime.FeedMessage; import java.net.URI; +import java.util.concurrent.ExecutionException; import org.opentripplanner.framework.io.OtpHttpClient; import org.opentripplanner.framework.io.OtpHttpClientFactory; import org.opentripplanner.routing.impl.TransitAlertServiceImpl; @@ -63,32 +64,28 @@ public String toString() { } @Override - protected void runPolling() { - try { - final FeedMessage feed = otpHttpClient.getAndMap( - URI.create(url), - this.headers.asMap(), - FeedMessage.PARSER::parseFrom - ); + protected void runPolling() throws InterruptedException, ExecutionException { + final FeedMessage feed = otpHttpClient.getAndMap( + URI.create(url), + this.headers.asMap(), + FeedMessage.PARSER::parseFrom + ); - long feedTimestamp = feed.getHeader().getTimestamp(); - if (feedTimestamp == lastTimestamp) { - LOG.debug("Ignoring feed with a timestamp that has not been updated from {}", url); - return; - } - if (feedTimestamp < lastTimestamp) { - LOG.info("Ignoring feed with older than previous timestamp from {}", url); - return; - } + long feedTimestamp = feed.getHeader().getTimestamp(); + if (feedTimestamp == lastTimestamp) { + LOG.debug("Ignoring feed with a timestamp that has not been updated from {}", url); + return; + } + if (feedTimestamp < lastTimestamp) { + LOG.info("Ignoring feed with older than previous timestamp from {}", url); + return; + } - // Handle update in graph writer runnable - saveResultOnGraph.execute(context -> - updateHandler.update(feed, context.gtfsRealtimeFuzzyTripMatcher()) - ); + // Handle update in graph writer runnable + saveResultOnGraph + .execute(context -> updateHandler.update(feed, context.gtfsRealtimeFuzzyTripMatcher())) + .get(); - lastTimestamp = feedTimestamp; - } catch (Exception e) { - LOG.error("Error reading gtfs-realtime feed from " + url, e); - } + lastTimestamp = feedTimestamp; } } diff --git a/application/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdater.java b/application/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdater.java index c725c8b1088..42f24031839 100644 --- a/application/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdater.java @@ -2,6 +2,7 @@ import com.google.transit.realtime.GtfsRealtime.TripUpdate; import java.util.List; +import java.util.concurrent.ExecutionException; import java.util.function.Consumer; import org.opentripplanner.updater.spi.PollingGraphUpdater; import org.opentripplanner.updater.spi.UpdateResult; @@ -73,7 +74,7 @@ public void setup(WriteToGraphCallback writeToGraphCallback) { * applies those updates to the graph. */ @Override - public void runPolling() { + public void runPolling() throws InterruptedException, ExecutionException { // Get update lists from update source List updates = updateSource.getUpdates(); var incrementality = updateSource.incrementalityOfLastUpdates(); @@ -89,7 +90,7 @@ public void runPolling() { feedId, recordMetrics ); - saveResultOnGraph.execute(runnable); + saveResultOnGraph.execute(runnable).get(); } } diff --git a/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdater.java index b23f46522c3..bc5217f7534 100644 --- a/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdater.java @@ -2,6 +2,7 @@ import java.util.List; import java.util.Map; +import java.util.concurrent.ExecutionException; import java.util.function.Function; import java.util.stream.Collectors; import org.opentripplanner.routing.vehicle_parking.VehicleParking; @@ -49,12 +50,12 @@ public void setup(WriteToGraphCallback writeToGraphCallback) { } @Override - protected void runPolling() { + protected void runPolling() throws InterruptedException, ExecutionException { if (source.update()) { var updates = source.getUpdates(); var graphWriterRunnable = new AvailabilityUpdater(updates); - saveResultOnGraph.execute(graphWriterRunnable); + saveResultOnGraph.execute(graphWriterRunnable).get(); } } diff --git a/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdater.java index 830429151b4..60a7b306052 100644 --- a/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdater.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.ExecutionException; import java.util.function.Function; import java.util.stream.Collectors; import org.opentripplanner.routing.graph.Graph; @@ -69,7 +70,7 @@ public void setup(WriteToGraphCallback writeToGraphCallback) { } @Override - protected void runPolling() { + protected void runPolling() throws InterruptedException, ExecutionException { LOG.debug("Updating vehicle parkings from {}", source); if (!source.update()) { LOG.debug("No updates"); @@ -81,7 +82,7 @@ protected void runPolling() { VehicleParkingGraphWriterRunnable graphWriterRunnable = new VehicleParkingGraphWriterRunnable( vehicleParkings ); - saveResultOnGraph.execute(graphWriterRunnable); + saveResultOnGraph.execute(graphWriterRunnable).get(); } private class VehicleParkingGraphWriterRunnable implements GraphWriterRunnable { diff --git a/application/src/main/java/org/opentripplanner/updater/vehicle_position/PollingVehiclePositionUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_position/PollingVehiclePositionUpdater.java index 4c487ac997b..a4d36f1d1c3 100644 --- a/application/src/main/java/org/opentripplanner/updater/vehicle_position/PollingVehiclePositionUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_position/PollingVehiclePositionUpdater.java @@ -3,6 +3,7 @@ import com.google.transit.realtime.GtfsRealtime.VehiclePosition; import java.util.List; import java.util.Set; +import java.util.concurrent.ExecutionException; import org.opentripplanner.service.realtimevehicles.RealtimeVehicleRepository; import org.opentripplanner.service.realtimevehicles.model.RealtimeVehicle; import org.opentripplanner.standalone.config.routerconfig.updaters.VehiclePositionsUpdaterConfig; @@ -64,7 +65,7 @@ public void setup(WriteToGraphCallback writeToGraphCallback) { * applies those updates to the graph. */ @Override - public void runPolling() { + public void runPolling() throws InterruptedException, ExecutionException { // Get update lists from update source List updates = vehiclePositionSource.getPositions(); @@ -77,7 +78,7 @@ public void runPolling() { fuzzyTripMatching, updates ); - saveResultOnGraph.execute(runnable); + saveResultOnGraph.execute(runnable).get(); } } diff --git a/application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java index 24686edce6c..c8030e5492a 100644 --- a/application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java @@ -8,6 +8,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; import java.util.stream.Stream; import org.opentripplanner.routing.linking.DisposableEdgeCollection; @@ -124,7 +125,7 @@ public String getConfigRef() { } @Override - protected void runPolling() { + protected void runPolling() throws InterruptedException, ExecutionException { LOG.debug("Updating vehicle rental stations from {}", nameForLogging); if (!source.update()) { LOG.debug("No updates from {}", nameForLogging); @@ -138,7 +139,7 @@ protected void runPolling() { stations, geofencingZones ); - saveResultOnGraph.execute(graphWriterRunnable); + saveResultOnGraph.execute(graphWriterRunnable).get(); } private class VehicleRentalGraphWriterRunnable implements GraphWriterRunnable { From 901f96a362c4bc6f818948213f883373dcb8319d Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 20 Nov 2024 14:43:40 +0100 Subject: [PATCH 02/60] Add SIRI light --- .../config/routerconfig/UpdatersConfig.java | 9 ++ .../updaters/SiriETLightUpdaterConfig.java | 41 +++++++++ .../updater/UpdatersParameters.java | 3 + .../configure/UpdaterConfigurator.java | 19 +++- .../SiriETLightHttpTripUpdateSource.java | 89 +++++++++++++++++++ .../updater/SiriETLightUpdaterParameters.java | 30 +++++++ .../updater/siri/updater/SiriETUpdater.java | 14 ++- .../siri/updater/SiriETUpdaterParameters.java | 5 +- .../siri/updater/SiriLightHttpLoader.java | 55 ++++++++++++ 9 files changed, 257 insertions(+), 8 deletions(-) create mode 100644 application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLightUpdaterConfig.java create mode 100644 application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETLightHttpTripUpdateSource.java create mode 100644 application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETLightUpdaterParameters.java create mode 100644 application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLightHttpLoader.java diff --git a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java index ac69b43e275..a3092a35b55 100644 --- a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java @@ -8,6 +8,7 @@ import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.SIRI_AZURE_ET_UPDATER; import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.SIRI_AZURE_SX_UPDATER; import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.SIRI_ET_GOOGLE_PUBSUB_UPDATER; +import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.SIRI_ET_LIGHT; import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.SIRI_ET_UPDATER; import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.SIRI_SX_UPDATER; import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.STOP_TIME_UPDATER; @@ -30,6 +31,7 @@ import org.opentripplanner.standalone.config.routerconfig.updaters.MqttGtfsRealtimeUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.PollingTripUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.SiriETGooglePubsubUpdaterConfig; +import org.opentripplanner.standalone.config.routerconfig.updaters.SiriETLightUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.SiriETUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.SiriSXUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.VehicleParkingUpdaterConfig; @@ -41,6 +43,7 @@ import org.opentripplanner.updater.TimetableSnapshotSourceParameters; import org.opentripplanner.updater.UpdatersParameters; import org.opentripplanner.updater.alert.GtfsRealtimeAlertsUpdaterParameters; +import org.opentripplanner.updater.siri.updater.SiriETLightUpdaterParameters; import org.opentripplanner.updater.siri.updater.SiriETUpdaterParameters; import org.opentripplanner.updater.siri.updater.SiriSXUpdaterParameters; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdaterParameters; @@ -182,6 +185,11 @@ public List getSiriSXUpdaterParameters() { return getParameters(SIRI_SX_UPDATER); } + @Override + public List getSiriETLightUpdaterParameters() { + return getParameters(SIRI_ET_LIGHT); + } + @Override public List getMqttGtfsRealtimeUpdaterParameters() { return getParameters(MQTT_GTFS_RT_UPDATER); @@ -218,6 +226,7 @@ public enum Type { REAL_TIME_ALERTS(GtfsRealtimeAlertsUpdaterConfig::create), VEHICLE_POSITIONS(VehiclePositionsUpdaterConfig::create), SIRI_ET_UPDATER(SiriETUpdaterConfig::create), + SIRI_ET_LIGHT(SiriETLightUpdaterConfig::create), SIRI_ET_GOOGLE_PUBSUB_UPDATER(SiriETGooglePubsubUpdaterConfig::create), SIRI_SX_UPDATER(SiriSXUpdaterConfig::create), SIRI_AZURE_ET_UPDATER(SiriAzureETUpdaterConfig::create), diff --git a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLightUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLightUpdaterConfig.java new file mode 100644 index 00000000000..c6152e7131f --- /dev/null +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLightUpdaterConfig.java @@ -0,0 +1,41 @@ +package org.opentripplanner.standalone.config.routerconfig.updaters; + +import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_0; +import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_3; +import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_7; + +import java.time.Duration; +import org.opentripplanner.standalone.config.framework.json.NodeAdapter; +import org.opentripplanner.updater.siri.updater.SiriETLightUpdaterParameters; + +public class SiriETLightUpdaterConfig { + + public static SiriETLightUpdaterParameters create(String configRef, NodeAdapter c) { + return new SiriETLightUpdaterParameters( + configRef, + c.of("feedId").since(V2_7).summary("The ID of the feed to apply the updates to.").asString(), + c + .of("url") + .since(V2_7) + .summary("The URL to send the HTTP requests to.") + .description(SiriSXUpdaterConfig.URL_DESCRIPTION) + .asUri(), + c + .of("frequency") + .since(V2_0) + .summary("How often the updates should be retrieved.") + .asDuration(Duration.ofMinutes(1)), + c + .of("timeout") + .since(V2_7) + .summary("The HTTP timeout to download the updates.") + .asDuration(Duration.ofSeconds(15)), + c + .of("fuzzyTripMatching") + .since(V2_7) + .summary("If the fuzzy trip matcher should be used to match trips.") + .asBoolean(false), + HttpHeadersConfig.headers(c, V2_3) + ); + } +} diff --git a/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java b/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java index 312fa3e2fbc..9db4de7f7b0 100644 --- a/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java @@ -5,6 +5,7 @@ import org.opentripplanner.ext.siri.updater.azure.SiriAzureSXUpdaterParameters; import org.opentripplanner.ext.vehiclerentalservicedirectory.api.VehicleRentalServiceDirectoryFetcherParameters; import org.opentripplanner.updater.alert.GtfsRealtimeAlertsUpdaterParameters; +import org.opentripplanner.updater.siri.updater.SiriETLightUpdaterParameters; import org.opentripplanner.updater.siri.updater.SiriETUpdaterParameters; import org.opentripplanner.updater.siri.updater.SiriSXUpdaterParameters; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdaterParameters; @@ -33,6 +34,8 @@ public interface UpdatersParameters { List getSiriSXUpdaterParameters(); + List getSiriETLightUpdaterParameters(); + List getMqttGtfsRealtimeUpdaterParameters(); List getVehicleParkingUpdaterParameters(); diff --git a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java index 1106d621873..a9a092a33ab 100644 --- a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java +++ b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java @@ -20,6 +20,8 @@ import org.opentripplanner.updater.UpdatersParameters; import org.opentripplanner.updater.alert.GtfsRealtimeAlertsUpdater; import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; +import org.opentripplanner.updater.siri.updater.SiriETHttpTripUpdateSource; +import org.opentripplanner.updater.siri.updater.SiriETLightHttpTripUpdateSource; import org.opentripplanner.updater.siri.updater.SiriETUpdater; import org.opentripplanner.updater.siri.updater.SiriSXUpdater; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdater; @@ -182,7 +184,22 @@ private List createUpdatersFromConfig() { updaters.add(new PollingVehiclePositionUpdater(configItem, realtimeVehicleRepository)); } for (var configItem : updatersParameters.getSiriETUpdaterParameters()) { - updaters.add(new SiriETUpdater(configItem, provideSiriTimetableSnapshot())); + updaters.add( + new SiriETUpdater( + configItem, + provideSiriTimetableSnapshot(), + new SiriETHttpTripUpdateSource(configItem.sourceParameters()) + ) + ); + } + for (var configItem : updatersParameters.getSiriETLightUpdaterParameters()) { + updaters.add( + new SiriETUpdater( + configItem, + provideSiriTimetableSnapshot(), + new SiriETLightHttpTripUpdateSource(configItem.sourceParameters()) + ) + ); } for (var configItem : updatersParameters.getSiriETGooglePubsubUpdaterParameters()) { updaters.add(new SiriETGooglePubsubUpdater(configItem, provideSiriTimetableSnapshot())); diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETLightHttpTripUpdateSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETLightHttpTripUpdateSource.java new file mode 100644 index 00000000000..b16742ddeec --- /dev/null +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETLightHttpTripUpdateSource.java @@ -0,0 +1,89 @@ +package org.opentripplanner.updater.siri.updater; + +import static org.opentripplanner.updater.trip.UpdateIncrementality.FULL_DATASET; + +import java.net.URI; +import java.time.Duration; +import java.util.Optional; +import org.opentripplanner.framework.io.OtpHttpClientException; +import org.opentripplanner.updater.spi.HttpHeaders; +import org.opentripplanner.updater.trip.UpdateIncrementality; +import org.opentripplanner.utils.tostring.ToStringBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import uk.org.siri.siri20.Siri; + +public class SiriETLightHttpTripUpdateSource implements EstimatedTimetableSource { + + private static final Logger LOG = LoggerFactory.getLogger(SiriETLightHttpTripUpdateSource.class); + private static final String DUMMY_REQUESTOR_REF = "OTP"; + + private final Parameters parameters; + + private final SiriLoader siriLoader; + + public SiriETLightHttpTripUpdateSource(Parameters parameters) { + this.parameters = parameters; + + this.siriLoader = createLoader(parameters); + } + + @Override + public Optional getUpdates() { + try { + var siri = siriLoader.fetchETFeed(DUMMY_REQUESTOR_REF); + if (siri.map(Siri::getServiceDelivery).isEmpty()) { + return Optional.empty(); + } + return siri; + } catch (OtpHttpClientException e) { + LOG.warn("Could not get SIRI-ET data from {}", parameters.uri(), e); + } catch (Exception e) { + LOG.warn("Failed to parse SIRI-ET feed from {}", parameters.uri(), e); + } + return Optional.empty(); + } + + @Override + public UpdateIncrementality incrementalityOfLastUpdates() { + return FULL_DATASET; + } + + @Override + public String getFeedId() { + return this.parameters.feedId(); + } + + public String toString() { + return ToStringBuilder + .of(this.getClass()) + .addStr("feedId", parameters.feedId()) + .addStr("uri", parameters.toString()) + .toString(); + } + + private static SiriLoader createLoader(Parameters parameters) { + // Load real-time updates from a file. + if (SiriFileLoader.matchesUrl(parameters.uri().toString())) { + return new SiriFileLoader(parameters.uri().toString()); + } + // Fallback to default loader + else { + return new SiriLightHttpLoader( + parameters.uri(), + parameters.timeout(), + parameters.httpRequestHeaders() + ); + } + } + + public interface Parameters { + URI uri(); + + String feedId(); + + Duration timeout(); + + HttpHeaders httpRequestHeaders(); + } +} diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETLightUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETLightUpdaterParameters.java new file mode 100644 index 00000000000..f49212aab74 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETLightUpdaterParameters.java @@ -0,0 +1,30 @@ +package org.opentripplanner.updater.siri.updater; + +import java.net.URI; +import java.time.Duration; +import org.opentripplanner.updater.spi.HttpHeaders; + +public record SiriETLightUpdaterParameters( + String configRef, + String feedId, + URI uri, + Duration frequency, + Duration timeout, + boolean fuzzyTripMatching, + HttpHeaders httpRequestHeaders +) + implements SiriETUpdater.SiriUpdaterParameters, SiriETLightHttpTripUpdateSource.Parameters { + public SiriETLightHttpTripUpdateSource.Parameters sourceParameters() { + return this; + } + + @Override + public String url() { + return uri.toString(); + } + + @Override + public boolean blockReadinessUntilInitialized() { + return false; + } +} diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java index 087bf28e875..2025d394026 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java @@ -4,9 +4,11 @@ import java.util.function.Consumer; import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; import org.opentripplanner.updater.spi.PollingGraphUpdater; +import org.opentripplanner.updater.spi.PollingGraphUpdaterParameters; import org.opentripplanner.updater.spi.ResultLogger; import org.opentripplanner.updater.spi.UpdateResult; import org.opentripplanner.updater.spi.WriteToGraphCallback; +import org.opentripplanner.updater.trip.UrlUpdaterParameters; import org.opentripplanner.updater.trip.metrics.TripUpdateMetrics; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,14 +40,15 @@ public class SiriETUpdater extends PollingGraphUpdater { private final Consumer recordMetrics; public SiriETUpdater( - SiriETUpdaterParameters config, - SiriTimetableSnapshotSource timetableSnapshotSource + SiriUpdaterParameters config, + SiriTimetableSnapshotSource timetableSnapshotSource, + EstimatedTimetableSource source ) { super(config); // Create update streamer from preferences this.feedId = config.feedId(); - this.updateSource = new SiriETHttpTripUpdateSource(config.sourceParameters()); + this.updateSource = source; this.blockReadinessUntilInitialized = config.blockReadinessUntilInitialized(); @@ -101,4 +104,9 @@ public String toString() { String s = (updateSource == null) ? "NONE" : updateSource.toString(); return "Polling SIRI ET updater with update source = " + s; } + + interface SiriUpdaterParameters extends UrlUpdaterParameters, PollingGraphUpdaterParameters { + boolean blockReadinessUntilInitialized(); + boolean fuzzyTripMatching(); + } } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java index dc479c034e1..ced2d90d456 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java @@ -2,8 +2,6 @@ import java.time.Duration; import org.opentripplanner.updater.spi.HttpHeaders; -import org.opentripplanner.updater.spi.PollingGraphUpdaterParameters; -import org.opentripplanner.updater.trip.UrlUpdaterParameters; public record SiriETUpdaterParameters( String configRef, @@ -18,8 +16,7 @@ public record SiriETUpdaterParameters( HttpHeaders httpRequestHeaders, boolean producerMetrics ) - implements - PollingGraphUpdaterParameters, UrlUpdaterParameters, SiriETHttpTripUpdateSource.Parameters { + implements SiriETUpdater.SiriUpdaterParameters, SiriETHttpTripUpdateSource.Parameters { public SiriETHttpTripUpdateSource.Parameters sourceParameters() { return this; } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLightHttpLoader.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLightHttpLoader.java new file mode 100644 index 00000000000..ca8a38dbcb0 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLightHttpLoader.java @@ -0,0 +1,55 @@ +package org.opentripplanner.updater.siri.updater; + +import java.net.URI; +import java.time.Duration; +import java.util.Optional; +import org.opentripplanner.framework.io.OtpHttpClient; +import org.opentripplanner.framework.io.OtpHttpClientFactory; +import org.opentripplanner.updater.spi.HttpHeaders; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import uk.org.siri.siri20.Siri; + +/** + * Load real-time updates from SIRI-SX and SIRI-ET feeds over HTTP. + */ +public class SiriLightHttpLoader implements SiriLoader { + + private static final Logger LOG = LoggerFactory.getLogger(SiriHttpLoader.class); + private final HttpHeaders headers; + private final URI uri; + private final Duration timeout; + private final OtpHttpClient otpHttpClient; + + public SiriLightHttpLoader(URI uri, Duration timeout, HttpHeaders headers) { + this.uri = uri; + this.timeout = timeout; + this.headers = HttpHeaders.of().acceptApplicationXML().add(headers).build(); + this.otpHttpClient = new OtpHttpClientFactory(timeout, timeout).create(LOG); + } + + /** + * Send a HTTP GET request and unmarshal the response as JAXB. + */ + @Override + public Optional fetchSXFeed(String ignored) { + return fetchFeed(); + } + + /** + * Send a HTTP GET service request and unmarshal the response as JAXB. + */ + @Override + public Optional fetchETFeed(String ignored) { + return fetchFeed(); + } + + private Optional fetchFeed() { + return otpHttpClient.getAndMap( + uri, + timeout, + headers.asMap(), + is -> Optional.of(SiriHelper.unmarshal(is)) + ); + } +} From 1b824ac72b9bc9b886fb14dd65364be02bc195ea Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Tue, 26 Nov 2024 15:42:09 +0100 Subject: [PATCH 03/60] Update logger name --- .../updater/siri/updater/SiriLightHttpLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLightHttpLoader.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLightHttpLoader.java index ca8a38dbcb0..f3e86d24e5b 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLightHttpLoader.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLightHttpLoader.java @@ -15,7 +15,7 @@ */ public class SiriLightHttpLoader implements SiriLoader { - private static final Logger LOG = LoggerFactory.getLogger(SiriHttpLoader.class); + private static final Logger LOG = LoggerFactory.getLogger(SiriLightHttpLoader.class); private final HttpHeaders headers; private final URI uri; private final Duration timeout; From 9eed5be0e3d205663dc585e8696ed2c51b6b8028 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Tue, 26 Nov 2024 18:05:50 +0100 Subject: [PATCH 04/60] Improve documentation --- .../config/routerconfig/UpdatersConfig.java | 2 +- .../updaters/SiriETLightUpdaterConfig.java | 8 +- .../updater/UpdatersParameters.java | 2 +- .../configure/UpdaterConfigurator.java | 2 +- .../updater/siri/updater/SiriETUpdater.java | 7 -- .../siri/updater/SiriETUpdaterParameters.java | 2 +- .../siri/updater/SiriUpdaterParameters.java | 10 ++ .../SiriETLightHttpTripUpdateSource.java | 5 +- .../SiriETLightUpdaterParameters.java | 5 +- .../{ => light}/SiriLightHttpLoader.java | 7 +- .../generate/doc/SiriConfigDocTest.java | 6 +- .../generate/doc/UpdaterConfigDocTest.java | 3 +- .../standalone/config/router-config.json | 6 ++ doc/templates/sandbox/siri/SiriUpdater.md | 42 ++++---- doc/user/RouterConfiguration.md | 6 ++ doc/user/sandbox/siri/SiriUpdater.md | 98 +++++++++++++++---- 16 files changed, 154 insertions(+), 57 deletions(-) create mode 100644 application/src/main/java/org/opentripplanner/updater/siri/updater/SiriUpdaterParameters.java rename application/src/main/java/org/opentripplanner/updater/siri/updater/{ => light}/SiriETLightHttpTripUpdateSource.java (90%) rename application/src/main/java/org/opentripplanner/updater/siri/updater/{ => light}/SiriETLightUpdaterParameters.java (72%) rename application/src/main/java/org/opentripplanner/updater/siri/updater/{ => light}/SiriLightHttpLoader.java (86%) diff --git a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java index a3092a35b55..27868cc182c 100644 --- a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java @@ -43,10 +43,10 @@ import org.opentripplanner.updater.TimetableSnapshotSourceParameters; import org.opentripplanner.updater.UpdatersParameters; import org.opentripplanner.updater.alert.GtfsRealtimeAlertsUpdaterParameters; -import org.opentripplanner.updater.siri.updater.SiriETLightUpdaterParameters; import org.opentripplanner.updater.siri.updater.SiriETUpdaterParameters; import org.opentripplanner.updater.siri.updater.SiriSXUpdaterParameters; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdaterParameters; +import org.opentripplanner.updater.siri.updater.light.SiriETLightUpdaterParameters; import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdaterParameters; import org.opentripplanner.updater.trip.PollingTripUpdaterParameters; import org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters; diff --git a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLightUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLightUpdaterConfig.java index c6152e7131f..3fa40a5f030 100644 --- a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLightUpdaterConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLightUpdaterConfig.java @@ -1,12 +1,10 @@ package org.opentripplanner.standalone.config.routerconfig.updaters; -import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_0; -import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_3; import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_7; import java.time.Duration; import org.opentripplanner.standalone.config.framework.json.NodeAdapter; -import org.opentripplanner.updater.siri.updater.SiriETLightUpdaterParameters; +import org.opentripplanner.updater.siri.updater.light.SiriETLightUpdaterParameters; public class SiriETLightUpdaterConfig { @@ -22,7 +20,7 @@ public static SiriETLightUpdaterParameters create(String configRef, NodeAdapter .asUri(), c .of("frequency") - .since(V2_0) + .since(V2_7) .summary("How often the updates should be retrieved.") .asDuration(Duration.ofMinutes(1)), c @@ -35,7 +33,7 @@ public static SiriETLightUpdaterParameters create(String configRef, NodeAdapter .since(V2_7) .summary("If the fuzzy trip matcher should be used to match trips.") .asBoolean(false), - HttpHeadersConfig.headers(c, V2_3) + HttpHeadersConfig.headers(c, V2_7) ); } } diff --git a/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java b/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java index 9db4de7f7b0..e98c730df47 100644 --- a/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java @@ -5,10 +5,10 @@ import org.opentripplanner.ext.siri.updater.azure.SiriAzureSXUpdaterParameters; import org.opentripplanner.ext.vehiclerentalservicedirectory.api.VehicleRentalServiceDirectoryFetcherParameters; import org.opentripplanner.updater.alert.GtfsRealtimeAlertsUpdaterParameters; -import org.opentripplanner.updater.siri.updater.SiriETLightUpdaterParameters; import org.opentripplanner.updater.siri.updater.SiriETUpdaterParameters; import org.opentripplanner.updater.siri.updater.SiriSXUpdaterParameters; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdaterParameters; +import org.opentripplanner.updater.siri.updater.light.SiriETLightUpdaterParameters; import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdaterParameters; import org.opentripplanner.updater.trip.PollingTripUpdaterParameters; import org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters; diff --git a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java index a9a092a33ab..2c7aa32a7b3 100644 --- a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java +++ b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java @@ -21,10 +21,10 @@ import org.opentripplanner.updater.alert.GtfsRealtimeAlertsUpdater; import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; import org.opentripplanner.updater.siri.updater.SiriETHttpTripUpdateSource; -import org.opentripplanner.updater.siri.updater.SiriETLightHttpTripUpdateSource; import org.opentripplanner.updater.siri.updater.SiriETUpdater; import org.opentripplanner.updater.siri.updater.SiriSXUpdater; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdater; +import org.opentripplanner.updater.siri.updater.light.SiriETLightHttpTripUpdateSource; import org.opentripplanner.updater.spi.GraphUpdater; import org.opentripplanner.updater.spi.TimetableSnapshotFlush; import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdater; diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java index 2025d394026..66dc8d9be09 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java @@ -4,11 +4,9 @@ import java.util.function.Consumer; import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; import org.opentripplanner.updater.spi.PollingGraphUpdater; -import org.opentripplanner.updater.spi.PollingGraphUpdaterParameters; import org.opentripplanner.updater.spi.ResultLogger; import org.opentripplanner.updater.spi.UpdateResult; import org.opentripplanner.updater.spi.WriteToGraphCallback; -import org.opentripplanner.updater.trip.UrlUpdaterParameters; import org.opentripplanner.updater.trip.metrics.TripUpdateMetrics; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -104,9 +102,4 @@ public String toString() { String s = (updateSource == null) ? "NONE" : updateSource.toString(); return "Polling SIRI ET updater with update source = " + s; } - - interface SiriUpdaterParameters extends UrlUpdaterParameters, PollingGraphUpdaterParameters { - boolean blockReadinessUntilInitialized(); - boolean fuzzyTripMatching(); - } } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java index ced2d90d456..395e7930f17 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java @@ -16,7 +16,7 @@ public record SiriETUpdaterParameters( HttpHeaders httpRequestHeaders, boolean producerMetrics ) - implements SiriETUpdater.SiriUpdaterParameters, SiriETHttpTripUpdateSource.Parameters { + implements SiriUpdaterParameters, SiriETHttpTripUpdateSource.Parameters { public SiriETHttpTripUpdateSource.Parameters sourceParameters() { return this; } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriUpdaterParameters.java new file mode 100644 index 00000000000..0d9b8ea79bb --- /dev/null +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriUpdaterParameters.java @@ -0,0 +1,10 @@ +package org.opentripplanner.updater.siri.updater; + +import org.opentripplanner.updater.spi.PollingGraphUpdaterParameters; +import org.opentripplanner.updater.trip.UrlUpdaterParameters; + +public interface SiriUpdaterParameters extends UrlUpdaterParameters, PollingGraphUpdaterParameters { + boolean blockReadinessUntilInitialized(); + + boolean fuzzyTripMatching(); +} diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETLightHttpTripUpdateSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java similarity index 90% rename from application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETLightHttpTripUpdateSource.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java index b16742ddeec..ad072cb56c1 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETLightHttpTripUpdateSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java @@ -1,4 +1,4 @@ -package org.opentripplanner.updater.siri.updater; +package org.opentripplanner.updater.siri.updater.light; import static org.opentripplanner.updater.trip.UpdateIncrementality.FULL_DATASET; @@ -6,6 +6,9 @@ import java.time.Duration; import java.util.Optional; import org.opentripplanner.framework.io.OtpHttpClientException; +import org.opentripplanner.updater.siri.updater.EstimatedTimetableSource; +import org.opentripplanner.updater.siri.updater.SiriFileLoader; +import org.opentripplanner.updater.siri.updater.SiriLoader; import org.opentripplanner.updater.spi.HttpHeaders; import org.opentripplanner.updater.trip.UpdateIncrementality; import org.opentripplanner.utils.tostring.ToStringBuilder; diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETLightUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightUpdaterParameters.java similarity index 72% rename from application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETLightUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightUpdaterParameters.java index f49212aab74..26fe959bc8c 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETLightUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightUpdaterParameters.java @@ -1,7 +1,8 @@ -package org.opentripplanner.updater.siri.updater; +package org.opentripplanner.updater.siri.updater.light; import java.net.URI; import java.time.Duration; +import org.opentripplanner.updater.siri.updater.SiriUpdaterParameters; import org.opentripplanner.updater.spi.HttpHeaders; public record SiriETLightUpdaterParameters( @@ -13,7 +14,7 @@ public record SiriETLightUpdaterParameters( boolean fuzzyTripMatching, HttpHeaders httpRequestHeaders ) - implements SiriETUpdater.SiriUpdaterParameters, SiriETLightHttpTripUpdateSource.Parameters { + implements SiriUpdaterParameters, SiriETLightHttpTripUpdateSource.Parameters { public SiriETLightHttpTripUpdateSource.Parameters sourceParameters() { return this; } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLightHttpLoader.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriLightHttpLoader.java similarity index 86% rename from application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLightHttpLoader.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriLightHttpLoader.java index f3e86d24e5b..45be81d74e2 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLightHttpLoader.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriLightHttpLoader.java @@ -1,17 +1,20 @@ -package org.opentripplanner.updater.siri.updater; +package org.opentripplanner.updater.siri.updater.light; import java.net.URI; import java.time.Duration; import java.util.Optional; import org.opentripplanner.framework.io.OtpHttpClient; import org.opentripplanner.framework.io.OtpHttpClientFactory; +import org.opentripplanner.updater.siri.updater.SiriHelper; +import org.opentripplanner.updater.siri.updater.SiriLoader; import org.opentripplanner.updater.spi.HttpHeaders; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import uk.org.siri.siri20.Siri; /** - * Load real-time updates from SIRI-SX and SIRI-ET feeds over HTTP. + * Load real-time updates from SIRI-SX and SIRI-ET feeds over HTTP via a single request + * that contains all updates. */ public class SiriLightHttpLoader implements SiriLoader { diff --git a/application/src/test/java/org/opentripplanner/generate/doc/SiriConfigDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/SiriConfigDocTest.java index b53c5370b53..17dac32c82c 100644 --- a/application/src/test/java/org/opentripplanner/generate/doc/SiriConfigDocTest.java +++ b/application/src/test/java/org/opentripplanner/generate/doc/SiriConfigDocTest.java @@ -29,7 +29,11 @@ public class SiriConfigDocTest { private static final File OUT_FILE = new File(USER_DOC_PATH, "sandbox/siri/SiriUpdater.md"); private static final String ROUTER_CONFIG_PATH = "standalone/config/" + ROUTER_CONFIG_FILENAME; - private static final Set INCLUDE_UPDATERS = Set.of("siri-et-updater", "siri-sx-updater"); + private static final Set INCLUDE_UPDATERS = Set.of( + "siri-et-updater", + "siri-et-light", + "siri-sx-updater" + ); private static final SkipNodes SKIP_NODES = SkipNodes.of().build(); public static final ObjectMapper mapper = new ObjectMapper(); diff --git a/application/src/test/java/org/opentripplanner/generate/doc/UpdaterConfigDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/UpdaterConfigDocTest.java index 234d4c68b33..989eee18cf5 100644 --- a/application/src/test/java/org/opentripplanner/generate/doc/UpdaterConfigDocTest.java +++ b/application/src/test/java/org/opentripplanner/generate/doc/UpdaterConfigDocTest.java @@ -35,7 +35,8 @@ public class UpdaterConfigDocTest { "vehicle-parking", "siri-et-updater", "siri-et-google-pubsub-updater", - "siri-sx-updater" + "siri-sx-updater", + "siri-et-light" ); private static final SkipNodes SKIP_NODES = SkipNodes.of().build(); public static final ObjectMapper mapper = new ObjectMapper(); diff --git a/application/src/test/resources/standalone/config/router-config.json b/application/src/test/resources/standalone/config/router-config.json index 4b6cf30f45d..8b5fde4bd00 100644 --- a/application/src/test/resources/standalone/config/router-config.json +++ b/application/src/test/resources/standalone/config/router-config.json @@ -431,6 +431,12 @@ "feedId": "parking", "sourceType": "siri-fm", "url": "https://transmodel.api.opendatahub.com/siri-lite/fm/parking" + }, + { + "type": "siri-et-light", + "feedId": "sta", + "url": "https://example.com/siri-lite/estimated-timetable/xml", + "fuzzyTripMatching": true } ], "rideHailingServices": [ diff --git a/doc/templates/sandbox/siri/SiriUpdater.md b/doc/templates/sandbox/siri/SiriUpdater.md index f695d304475..f1f77620444 100644 --- a/doc/templates/sandbox/siri/SiriUpdater.md +++ b/doc/templates/sandbox/siri/SiriUpdater.md @@ -1,35 +1,43 @@ -# Siri Updater +# SIRI Updater -Support for consuming SIRI ET and SX messages. The updater is developed to support the Nordic -SIRI profile which is a subset of the SIRI specification. +Support for consuming SIRI ET and SX messages via HTTPS. The updaters aim to support the [Nordic +and EPIP SIRI profiles](../../features-explained/Netex-Siri-Compatibility.md) which +are subsets of the SIRI specification. + +For more documentation about the Norwegian profile and data, go to +the [Entur Real-Time Data](https://developer.entur.org/pages-real-time-intro) documentation and +the [Norwegian SIRI profile](https://enturas.atlassian.net/wiki/spaces/PUBLIC/pages/637370420/Norwegian+SIRI+profile). ## Contact Info - Lasse Tyrihjell, Entur, Norway - -## Documentation - -This updater consumes SIRI real time information. It is developed by Entur and supports the Nordic -Profile for SIRI. It should be possible to develop it further to support a broader set of the SIRI -specification. - -For more documentation goto -the [Entur Real-Time Data](https://developer.entur.org/pages-real-time-intro) documentation and -the [Norwegian SIRI profile](https://enturas.atlassian.net/wiki/spaces/PUBLIC/pages/637370420/Norwegian+SIRI+profile) -. +- Leonard Ehrenfried, Germany ## Configuration -To enable the SIRI updater you need to add it to the updaters section of the `router-config.json`. +To enable the SIRI updater you need to add it to the `updaters` section of the `router-config.json`. -### Siri-ET via HTTPS +### SIRI-ET Request/Response via HTTPS -### Siri-SX via HTTPS +### SIRI-SX Request/Response via HTTPS +### SIRI-ET Light via HTTPS + +SIRI Light is [not very well](https://nextcloud.leonard.io/s/2tdYdmYBGtLQMfi/download?path=&files=Proposition-Profil-SIRI-Lite-initial-v1-3%20en.pdf) +[specified](https://normes.transport.data.gouv.fr/normes/siri/profil-france/#protocoles-d%C3%A9change-des-donn%C3%A9es-siri), +but this updater supports the following definition: + +Fetching XML-formatted SIRI messages as single GET request rather than the more common request/response +flow. This means that the XML feed must contain all updates for all trips, just like it is the case +for GTFS-RT TripUpdates. + + + + ## Changelog - Initial version of SIRI updater (October 2019) diff --git a/doc/user/RouterConfiguration.md b/doc/user/RouterConfiguration.md index 6dbd1174397..6bf00fb6629 100644 --- a/doc/user/RouterConfiguration.md +++ b/doc/user/RouterConfiguration.md @@ -875,6 +875,12 @@ Used to group requests when monitoring OTP. "feedId" : "parking", "sourceType" : "siri-fm", "url" : "https://transmodel.api.opendatahub.com/siri-lite/fm/parking" + }, + { + "type" : "siri-et-light", + "feedId" : "sta", + "url" : "https://example.com/siri-lite/estimated-timetable/xml", + "fuzzyTripMatching" : true } ], "rideHailingServices" : [ diff --git a/doc/user/sandbox/siri/SiriUpdater.md b/doc/user/sandbox/siri/SiriUpdater.md index 28f2f9a85db..db8465fa998 100644 --- a/doc/user/sandbox/siri/SiriUpdater.md +++ b/doc/user/sandbox/siri/SiriUpdater.md @@ -1,28 +1,23 @@ -# Siri Updater +# SIRI Updater -Support for consuming SIRI ET and SX messages. The updater is developed to support the Nordic -SIRI profile which is a subset of the SIRI specification. +Support for consuming SIRI ET and SX messages via HTTPS. The updaters aim to support the [Nordic +and EPIP SIRI profiles](../../features-explained/Netex-Siri-Compatibility.md) which +are subsets of the SIRI specification. + +For more documentation about the Norwegian profile and data, go to +the [Entur Real-Time Data](https://developer.entur.org/pages-real-time-intro) documentation and +the [Norwegian SIRI profile](https://enturas.atlassian.net/wiki/spaces/PUBLIC/pages/637370420/Norwegian+SIRI+profile). ## Contact Info - Lasse Tyrihjell, Entur, Norway - -## Documentation - -This updater consumes SIRI real time information. It is developed by Entur and supports the Nordic -Profile for SIRI. It should be possible to develop it further to support a broader set of the SIRI -specification. - -For more documentation goto -the [Entur Real-Time Data](https://developer.entur.org/pages-real-time-intro) documentation and -the [Norwegian SIRI profile](https://enturas.atlassian.net/wiki/spaces/PUBLIC/pages/637370420/Norwegian+SIRI+profile) -. +- Leonard Ehrenfried, Germany ## Configuration -To enable the SIRI updater you need to add it to the updaters section of the `router-config.json`. +To enable the SIRI updater you need to add it to the `updaters` section of the `router-config.json`. -### Siri-ET via HTTPS +### SIRI-ET Request/Response via HTTPS @@ -89,7 +84,7 @@ HTTP headers to add to the request. Any header key, value can be inserted. -### Siri-SX via HTTPS +### SIRI-SX Request/Response via HTTPS @@ -166,6 +161,75 @@ HTTP headers to add to the request. Any header key, value can be inserted. +### SIRI-ET Light via HTTPS + +SIRI Light is [not very well](https://nextcloud.leonard.io/s/2tdYdmYBGtLQMfi/download?path=&files=Proposition-Profil-SIRI-Lite-initial-v1-3%20en.pdf) +[specified](https://normes.transport.data.gouv.fr/normes/siri/profil-france/#protocoles-d%C3%A9change-des-donn%C3%A9es-siri), +but this updater supports the following definition: + +Fetching XML-formatted SIRI messages as single GET request rather than the more common request/response +flow. This means that the XML feed must contain all updates for all trips, just like it is the case +for GTFS-RT TripUpdates. + + + + +| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | +|----------------------------|:---------------:|----------------------------------------------------------------------------|:----------:|---------------|:-----:| +| type = "siri-et-light" | `enum` | The type of the updater. | *Required* | | 1.5 | +| feedId | `string` | The ID of the feed to apply the updates to. | *Required* | | 2.7 | +| frequency | `duration` | How often the updates should be retrieved. | *Optional* | `"PT1M"` | 2.7 | +| fuzzyTripMatching | `boolean` | If the fuzzy trip matcher should be used to match trips. | *Optional* | `false` | 2.7 | +| timeout | `duration` | The HTTP timeout to download the updates. | *Optional* | `"PT15S"` | 2.7 | +| [url](#u__15__url) | `uri` | The URL to send the HTTP requests to. | *Required* | | 2.7 | +| [headers](#u__15__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.7 | + + +##### Parameter details + +

url

+ +**Since version:** `2.7` ∙ **Type:** `uri` ∙ **Cardinality:** `Required` +**Path:** /updaters/[15] + +The URL to send the HTTP requests to. + +Use the file protocol to set a directory for reading updates from a directory. The file +loader will look for xml files: '*.xml' in the configured directory. The files are +renamed by the loader when processed: + +    _a.xml_   ➞   _a.xml.inProgress_   ➞   _a.xml.ok_   or   _a.xml.failed_ + + + +

headers

+ +**Since version:** `2.7` ∙ **Type:** `map of string` ∙ **Cardinality:** `Optional` +**Path:** /updaters/[15] + +HTTP headers to add to the request. Any header key, value can be inserted. + + + +##### Example configuration + +```JSON +// router-config.json +{ + "updaters" : [ + { + "type" : "siri-et-light", + "feedId" : "sta", + "url" : "https://example.com/siri-lite/estimated-timetable/xml", + "fuzzyTripMatching" : true + } + ] +} +``` + + + + ## Changelog - Initial version of SIRI updater (October 2019) From 96b8f1eb49f5964b6bed53085b1d42c3c54d0cfd Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Tue, 26 Nov 2024 23:34:27 +0100 Subject: [PATCH 05/60] Update docs --- doc/templates/sandbox/siri/SiriUpdater.md | 2 +- doc/user/sandbox/siri/SiriUpdater.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/templates/sandbox/siri/SiriUpdater.md b/doc/templates/sandbox/siri/SiriUpdater.md index f1f77620444..8a949f63ce5 100644 --- a/doc/templates/sandbox/siri/SiriUpdater.md +++ b/doc/templates/sandbox/siri/SiriUpdater.md @@ -1,4 +1,4 @@ -# SIRI Updater +# SIRI Updaters Support for consuming SIRI ET and SX messages via HTTPS. The updaters aim to support the [Nordic and EPIP SIRI profiles](../../features-explained/Netex-Siri-Compatibility.md) which diff --git a/doc/user/sandbox/siri/SiriUpdater.md b/doc/user/sandbox/siri/SiriUpdater.md index db8465fa998..0aeef704cdb 100644 --- a/doc/user/sandbox/siri/SiriUpdater.md +++ b/doc/user/sandbox/siri/SiriUpdater.md @@ -1,4 +1,4 @@ -# SIRI Updater +# SIRI Updaters Support for consuming SIRI ET and SX messages via HTTPS. The updaters aim to support the [Nordic and EPIP SIRI profiles](../../features-explained/Netex-Siri-Compatibility.md) which From 8fdebbb105c14770d9ea88dd44fda02553932f8b Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 27 Nov 2024 08:18:05 +0100 Subject: [PATCH 06/60] Make spelling of SIRI consistent across docs --- doc/templates/StopConsolidation.md | 2 +- doc/templates/UpdaterConfig.md | 6 +++--- doc/templates/sandbox/siri/SiriAzureUpdater.md | 10 +++++----- doc/templates/sandbox/siri/SiriGooglePubSubUpdater.md | 4 ++-- doc/user/Changelog.md | 4 ++-- doc/user/UpdaterConfig.md | 6 +++--- doc/user/examples/skanetrafiken/Readme.md | 4 ++-- doc/user/sandbox/StopConsolidation.md | 2 +- doc/user/sandbox/siri/SiriAzureUpdater.md | 10 +++++----- doc/user/sandbox/siri/SiriGooglePubSubUpdater.md | 4 ++-- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/doc/templates/StopConsolidation.md b/doc/templates/StopConsolidation.md index 70866882bd1..ef32a3c29d6 100644 --- a/doc/templates/StopConsolidation.md +++ b/doc/templates/StopConsolidation.md @@ -32,7 +32,7 @@ This has the following consequences - It makes real-time trip updates referencing a stop id much more complicated and in many cases impossible to resolve. - You can only reference a stop by its sequence, which only works in GTFS-RT, not Siri. + You can only reference a stop by its sequence, which only works in GTFS-RT, not SIRI. - Fare calculation and transfers are unlikely to work as expected. diff --git a/doc/templates/UpdaterConfig.md b/doc/templates/UpdaterConfig.md index aab5631e6e2..21db7bdb6a4 100644 --- a/doc/templates/UpdaterConfig.md +++ b/doc/templates/UpdaterConfig.md @@ -82,8 +82,8 @@ GBFS form factors: ## Other updaters in sandboxes - [Vehicle parking](sandbox/VehicleParking.md) -- [Siri over HTTP](sandbox/siri/SiriUpdater.md) -- [Siri over Google Cloud PubSub](sandbox/siri/SiriGooglePubSubUpdater.md) -- [Siri over Azure Message Bus](sandbox/siri/SiriAzureUpdater.md) +- [SIRI over HTTP](sandbox/siri/SiriUpdater.md) +- [SIRI over Google Cloud PubSub](sandbox/siri/SiriGooglePubSubUpdater.md) +- [SIRI over Azure Message Bus](sandbox/siri/SiriAzureUpdater.md) - [VehicleRentalServiceDirectory](sandbox/VehicleRentalServiceDirectory.md) diff --git a/doc/templates/sandbox/siri/SiriAzureUpdater.md b/doc/templates/sandbox/siri/SiriAzureUpdater.md index 85e22e30bda..646484c9aec 100644 --- a/doc/templates/sandbox/siri/SiriAzureUpdater.md +++ b/doc/templates/sandbox/siri/SiriAzureUpdater.md @@ -1,6 +1,6 @@ -# Siri Azure Updater +# SIRI Azure Updater -This is a sandbox extension developed by Skånetrafiken that allows OTP to fetch Siri ET & SX messages +This is a sandbox extension developed by Skånetrafiken that allows OTP to fetch SIRI ET & SX messages through *Azure Service Bus*. It also enables OTP to download historical data from en HTTP endpoint on startup. @@ -17,11 +17,11 @@ Documentation available [here](../../examples/skanetrafiken/Readme.md). To enable the SIRI updater you need to add it to the updaters section of the `router-config.json`. -### Siri Azure ET Updater +### SIRI Azure ET Updater -### Siri Azure SX Updater +### SIRI Azure SX Updater @@ -30,5 +30,5 @@ To enable the SIRI updater you need to add it to the updaters section of the `ro - Initial version (April 2022) - Minor changes in logging (November 2022) - Retry fetch from history endpoint if it failed (February 2023) -- Solve a bug in SiriAzureETUpdater and improve error logging (March 2023) +- Solve a bug in SIRIAzureETUpdater and improve error logging (March 2023) - Add support with federated identity authentication (February 2024) \ No newline at end of file diff --git a/doc/templates/sandbox/siri/SiriGooglePubSubUpdater.md b/doc/templates/sandbox/siri/SiriGooglePubSubUpdater.md index 09fd3996bef..9d3fff5e00d 100644 --- a/doc/templates/sandbox/siri/SiriGooglePubSubUpdater.md +++ b/doc/templates/sandbox/siri/SiriGooglePubSubUpdater.md @@ -1,4 +1,4 @@ -# Siri-ET Google PubSub Updater +# SIRI-ET Google PubSub Updater Support for consuming SIRI-ET messages over a Google Cloud PubSub subscription. Similarly to the SIRI-ET HTTP updater, this updater is developed to support the Nordic SIRI profile @@ -23,7 +23,7 @@ the [Norwegian SIRI profile](https://enturas.atlassian.net/wiki/spaces/PUBLIC/pa To enable the SIRI-ET Google PubSub updater you need to add it to the updaters section of the `router-config.json`. -### Siri-ET via Google PubSub +### SIRI-ET via Google PubSub diff --git a/doc/user/Changelog.md b/doc/user/Changelog.md index 17a54ede4ae..35cf127b114 100644 --- a/doc/user/Changelog.md +++ b/doc/user/Changelog.md @@ -399,7 +399,7 @@ based on merged pull requests. Search GitHub issues and pull requests for smalle - Preserve language in SIRI/GTFS-RT alert messages [#4117](https://github.com/opentripplanner/OpenTripPlanner/pull/4117) - Use board/alight cost only for transits [#4079](https://github.com/opentripplanner/OpenTripPlanner/pull/4079) - Improve SIRI real-time performance by reducing stopPattern duplicates [#4038](https://github.com/opentripplanner/OpenTripPlanner/pull/4038) -- Siri updaters for Azure ServiceBus [#4106](https://github.com/opentripplanner/OpenTripPlanner/pull/4106) +- SIRI updaters for Azure ServiceBus [#4106](https://github.com/opentripplanner/OpenTripPlanner/pull/4106) - Fallback to recorded/expected arrival/departure time if other one is missing in SIRI-ET [#4055](https://github.com/opentripplanner/OpenTripPlanner/pull/4055) - Allow overriding GBFS system_id with configuration [#4147](https://github.com/opentripplanner/OpenTripPlanner/pull/4147) - Fix error with transfer-slack and GTFS minTransferTime [#4120](https://github.com/opentripplanner/OpenTripPlanner/pull/4120) @@ -407,7 +407,7 @@ based on merged pull requests. Search GitHub issues and pull requests for smalle - Don't indicate stop has been updated when NO_DATA is defined [#3962](https://github.com/opentripplanner/OpenTripPlanner/pull/3962) - Implement nearby searches for car and bicycle parking [#4165](https://github.com/opentripplanner/OpenTripPlanner/pull/4165) - Do not link cars to stop vertices in routing [#4166](https://github.com/opentripplanner/OpenTripPlanner/pull/4166) -- Add Siri real-time occupancy info [#4180](https://github.com/opentripplanner/OpenTripPlanner/pull/4180) +- Add SIRI real-time occupancy info [#4180](https://github.com/opentripplanner/OpenTripPlanner/pull/4180) - Add gtfs stop description translations [#4158](https://github.com/opentripplanner/OpenTripPlanner/pull/4158) - Add option to discard min transfer times [#4195](https://github.com/opentripplanner/OpenTripPlanner/pull/4195) - Use negative delay from first stop in a GTFS RT update in previous stop times when required [#4035](https://github.com/opentripplanner/OpenTripPlanner/pull/4035) diff --git a/doc/user/UpdaterConfig.md b/doc/user/UpdaterConfig.md index f61cce12f54..068b61f112e 100644 --- a/doc/user/UpdaterConfig.md +++ b/doc/user/UpdaterConfig.md @@ -427,8 +427,8 @@ This is temporary and will be removed in a future version of OTP. Use this to sp ## Other updaters in sandboxes - [Vehicle parking](sandbox/VehicleParking.md) -- [Siri over HTTP](sandbox/siri/SiriUpdater.md) -- [Siri over Google Cloud PubSub](sandbox/siri/SiriGooglePubSubUpdater.md) -- [Siri over Azure Message Bus](sandbox/siri/SiriAzureUpdater.md) +- [SIRI over HTTP](sandbox/siri/SiriUpdater.md) +- [SIRI over Google Cloud PubSub](sandbox/siri/SiriGooglePubSubUpdater.md) +- [SIRI over Azure Message Bus](sandbox/siri/SiriAzureUpdater.md) - [VehicleRentalServiceDirectory](sandbox/VehicleRentalServiceDirectory.md) diff --git a/doc/user/examples/skanetrafiken/Readme.md b/doc/user/examples/skanetrafiken/Readme.md index a611c839140..acaf212719a 100644 --- a/doc/user/examples/skanetrafiken/Readme.md +++ b/doc/user/examples/skanetrafiken/Readme.md @@ -38,7 +38,7 @@ To reduce graph size, only data for northern part of Denmark is used. ## Real-time The **Azure Service Bus** is used to propagate SIRI SX and ET real-time messages to OTP. -This is solved through Siri Azure updaters that Skånetrafiken had implemented in OTP. There are +This is solved through SIRI Azure updaters that Skånetrafiken had implemented in OTP. There are separate updaters for SIRI SX and ET. Those updaters are used to provide data for Swedish traffic (NeTEx). Right now, there is no connection to any real-time source for danish traffic (GTFS data). @@ -77,7 +77,7 @@ Those two parameters are used to define time boundaries for the messages. Both endpoints generate XML response which is an SIRI object containing SX or ET messages. Messages are -formatted according to Siri Nordic Profile. +formatted according to SIRI Nordic Profile. Since in SIRI ET standard each messages contains all necessary data, Skånetrafikens implementation of the endpoint returns only the last message diff --git a/doc/user/sandbox/StopConsolidation.md b/doc/user/sandbox/StopConsolidation.md index d0e18a9ce30..547f3200296 100644 --- a/doc/user/sandbox/StopConsolidation.md +++ b/doc/user/sandbox/StopConsolidation.md @@ -32,7 +32,7 @@ This has the following consequences - It makes real-time trip updates referencing a stop id much more complicated and in many cases impossible to resolve. - You can only reference a stop by its sequence, which only works in GTFS-RT, not Siri. + You can only reference a stop by its sequence, which only works in GTFS-RT, not SIRI. - Fare calculation and transfers are unlikely to work as expected. diff --git a/doc/user/sandbox/siri/SiriAzureUpdater.md b/doc/user/sandbox/siri/SiriAzureUpdater.md index c8e7f4d9255..5dabd8e6c20 100644 --- a/doc/user/sandbox/siri/SiriAzureUpdater.md +++ b/doc/user/sandbox/siri/SiriAzureUpdater.md @@ -1,6 +1,6 @@ -# Siri Azure Updater +# SIRI Azure Updater -This is a sandbox extension developed by Skånetrafiken that allows OTP to fetch Siri ET & SX messages +This is a sandbox extension developed by Skånetrafiken that allows OTP to fetch SIRI ET & SX messages through *Azure Service Bus*. It also enables OTP to download historical data from en HTTP endpoint on startup. @@ -17,7 +17,7 @@ Documentation available [here](../../examples/skanetrafiken/Readme.md). To enable the SIRI updater you need to add it to the updaters section of the `router-config.json`. -### Siri Azure ET Updater +### SIRI Azure ET Updater @@ -105,7 +105,7 @@ Has to be present for authenticationMethod SharedAccessKey. This should be Prima -### Siri Azure SX Updater +### SIRI Azure SX Updater @@ -198,5 +198,5 @@ Has to be present for authenticationMethod SharedAccessKey. This should be Prima - Initial version (April 2022) - Minor changes in logging (November 2022) - Retry fetch from history endpoint if it failed (February 2023) -- Solve a bug in SiriAzureETUpdater and improve error logging (March 2023) +- Solve a bug in SIRIAzureETUpdater and improve error logging (March 2023) - Add support with federated identity authentication (February 2024) \ No newline at end of file diff --git a/doc/user/sandbox/siri/SiriGooglePubSubUpdater.md b/doc/user/sandbox/siri/SiriGooglePubSubUpdater.md index 5232696ad9b..ed09522b224 100644 --- a/doc/user/sandbox/siri/SiriGooglePubSubUpdater.md +++ b/doc/user/sandbox/siri/SiriGooglePubSubUpdater.md @@ -1,4 +1,4 @@ -# Siri-ET Google PubSub Updater +# SIRI-ET Google PubSub Updater Support for consuming SIRI-ET messages over a Google Cloud PubSub subscription. Similarly to the SIRI-ET HTTP updater, this updater is developed to support the Nordic SIRI profile @@ -23,7 +23,7 @@ the [Norwegian SIRI profile](https://enturas.atlassian.net/wiki/spaces/PUBLIC/pa To enable the SIRI-ET Google PubSub updater you need to add it to the updaters section of the `router-config.json`. -### Siri-ET via Google PubSub +### SIRI-ET via Google PubSub From af138ab72a4b96f7b0f96d188564428d83d953f6 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 27 Nov 2024 08:18:14 +0100 Subject: [PATCH 07/60] Add metrics to SIRI light --- .../updater/configure/UpdaterConfigurator.java | 7 +++++-- .../updater/siri/updater/SiriETUpdater.java | 13 ++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java index 2c7aa32a7b3..544e5a0c4f5 100644 --- a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java +++ b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java @@ -30,6 +30,7 @@ import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdater; import org.opentripplanner.updater.trip.PollingTripUpdater; import org.opentripplanner.updater.trip.TimetableSnapshotSource; +import org.opentripplanner.updater.trip.metrics.TripUpdateMetrics; import org.opentripplanner.updater.vehicle_parking.AvailabilityDatasourceFactory; import org.opentripplanner.updater.vehicle_parking.VehicleParkingAvailabilityUpdater; import org.opentripplanner.updater.vehicle_parking.VehicleParkingDataSourceFactory; @@ -188,7 +189,8 @@ private List createUpdatersFromConfig() { new SiriETUpdater( configItem, provideSiriTimetableSnapshot(), - new SiriETHttpTripUpdateSource(configItem.sourceParameters()) + new SiriETHttpTripUpdateSource(configItem.sourceParameters()), + TripUpdateMetrics.streaming(configItem) ) ); } @@ -197,7 +199,8 @@ private List createUpdatersFromConfig() { new SiriETUpdater( configItem, provideSiriTimetableSnapshot(), - new SiriETLightHttpTripUpdateSource(configItem.sourceParameters()) + new SiriETLightHttpTripUpdateSource(configItem.sourceParameters()), + TripUpdateMetrics.batch(configItem) ) ); } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java index 66dc8d9be09..b11c26471c2 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java @@ -7,7 +7,6 @@ import org.opentripplanner.updater.spi.ResultLogger; import org.opentripplanner.updater.spi.UpdateResult; import org.opentripplanner.updater.spi.WriteToGraphCallback; -import org.opentripplanner.updater.trip.metrics.TripUpdateMetrics; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import uk.org.siri.siri20.EstimatedTimetableDeliveryStructure; @@ -35,15 +34,15 @@ public class SiriETUpdater extends PollingGraphUpdater { private final EstimatedTimetableHandler estimatedTimetableHandler; - private final Consumer recordMetrics; + private final Consumer metricsConsumer; public SiriETUpdater( SiriUpdaterParameters config, SiriTimetableSnapshotSource timetableSnapshotSource, - EstimatedTimetableSource source + EstimatedTimetableSource source, + Consumer metricsConsumer ) { super(config); - // Create update streamer from preferences this.feedId = config.feedId(); this.updateSource = source; @@ -51,7 +50,7 @@ public SiriETUpdater( this.blockReadinessUntilInitialized = config.blockReadinessUntilInitialized(); LOG.info( - "Creating stop time updater (SIRI ET) running every {} seconds : {}", + "Creating SIRI ET updater running every {}: {}", pollingPeriod(), updateSource ); @@ -59,7 +58,7 @@ public SiriETUpdater( estimatedTimetableHandler = new EstimatedTimetableHandler(timetableSnapshotSource, config.fuzzyTripMatching(), feedId); - recordMetrics = TripUpdateMetrics.streaming(config); + this.metricsConsumer = metricsConsumer; } @Override @@ -88,7 +87,7 @@ public void runPolling() { saveResultOnGraph.execute(context -> { var result = estimatedTimetableHandler.applyUpdate(etds, incrementality, context); ResultLogger.logUpdateResult(feedId, "siri-et", result); - recordMetrics.accept(result); + metricsConsumer.accept(result); if (markPrimed) { primed = true; } From 240c70efec84a3fc9239b80c02e4699ff60d743b Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 27 Nov 2024 09:35:35 +0100 Subject: [PATCH 08/60] Add SIRI SX --- .../config/routerconfig/UpdatersConfig.java | 11 ++++- .../updaters/SiriSXLightUpdaterConfig.java | 46 +++++++++++++++++++ .../updater/UpdatersParameters.java | 3 ++ .../configure/UpdaterConfigurator.java | 23 +++++++++- ....java => BaseSiriETUpdaterParameters.java} | 3 +- .../updater/siri/updater/SiriETUpdater.java | 8 +--- .../siri/updater/SiriETUpdaterParameters.java | 2 +- .../updater/siri/updater/SiriHttpLoader.java | 3 +- .../updater/siri/updater/SiriSXUpdater.java | 21 +++++++-- .../siri/updater/SiriSXUpdaterParameters.java | 3 +- .../SiriETLightHttpTripUpdateSource.java | 2 +- .../light/SiriETLightUpdaterParameters.java | 4 +- .../light/SiriSXLightUpdaterParameters.java | 32 +++++++++++++ doc/user/sandbox/siri/SiriUpdater.md | 29 ++++++++---- 14 files changed, 161 insertions(+), 29 deletions(-) create mode 100644 application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXLightUpdaterConfig.java rename application/src/main/java/org/opentripplanner/updater/siri/updater/{SiriUpdaterParameters.java => BaseSiriETUpdaterParameters.java} (70%) create mode 100644 application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLightUpdaterParameters.java diff --git a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java index 27868cc182c..98611bea96e 100644 --- a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java @@ -31,8 +31,8 @@ import org.opentripplanner.standalone.config.routerconfig.updaters.MqttGtfsRealtimeUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.PollingTripUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.SiriETGooglePubsubUpdaterConfig; -import org.opentripplanner.standalone.config.routerconfig.updaters.SiriETLightUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.SiriETUpdaterConfig; +import org.opentripplanner.standalone.config.routerconfig.updaters.SiriSXLightUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.SiriSXUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.VehicleParkingUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.VehiclePositionsUpdaterConfig; @@ -47,6 +47,7 @@ import org.opentripplanner.updater.siri.updater.SiriSXUpdaterParameters; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdaterParameters; import org.opentripplanner.updater.siri.updater.light.SiriETLightUpdaterParameters; +import org.opentripplanner.updater.siri.updater.light.SiriSXLightUpdaterParameters; import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdaterParameters; import org.opentripplanner.updater.trip.PollingTripUpdaterParameters; import org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters; @@ -190,6 +191,11 @@ public List getSiriETLightUpdaterParameters() { return getParameters(SIRI_ET_LIGHT); } + @Override + public List getSiriSXLightUpdaterParameters() { + return getParameters(Type.SIRI_SX_LIGHT); + } + @Override public List getMqttGtfsRealtimeUpdaterParameters() { return getParameters(MQTT_GTFS_RT_UPDATER); @@ -226,7 +232,8 @@ public enum Type { REAL_TIME_ALERTS(GtfsRealtimeAlertsUpdaterConfig::create), VEHICLE_POSITIONS(VehiclePositionsUpdaterConfig::create), SIRI_ET_UPDATER(SiriETUpdaterConfig::create), - SIRI_ET_LIGHT(SiriETLightUpdaterConfig::create), + SIRI_ET_LIGHT(SiriSXLightUpdaterConfig::create), + SIRI_SX_LIGHT(SiriSXLightUpdaterConfig::create), SIRI_ET_GOOGLE_PUBSUB_UPDATER(SiriETGooglePubsubUpdaterConfig::create), SIRI_SX_UPDATER(SiriSXUpdaterConfig::create), SIRI_AZURE_ET_UPDATER(SiriAzureETUpdaterConfig::create), diff --git a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXLightUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXLightUpdaterConfig.java new file mode 100644 index 00000000000..39db86aead5 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXLightUpdaterConfig.java @@ -0,0 +1,46 @@ +package org.opentripplanner.standalone.config.routerconfig.updaters; + +import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_0; +import static org.opentripplanner.standalone.config.framework.json.OtpVersion.V2_7; + +import java.time.Duration; +import org.opentripplanner.standalone.config.framework.json.NodeAdapter; +import org.opentripplanner.updater.siri.updater.light.SiriSXLightUpdaterParameters; + +public class SiriSXLightUpdaterConfig { + + public static SiriSXLightUpdaterParameters create(String configRef, NodeAdapter c) { + return new SiriSXLightUpdaterParameters( + configRef, + c.of("feedId").since(V2_7).summary("The ID of the feed to apply the updates to.").asString(), + c + .of("url") + .since(V2_7) + .summary("The URL to send the HTTP requests to.") + .description(SiriSXUpdaterConfig.URL_DESCRIPTION) + .asUri(), + c + .of("frequency") + .since(V2_7) + .summary("How often the updates should be retrieved.") + .asDuration(Duration.ofMinutes(1)), + c + .of("timeout") + .since(V2_7) + .summary("The HTTP timeout to download the updates.") + .asDuration(Duration.ofSeconds(15)), + c + .of("earlyStart") + .since(V2_0) + .summary("This value is subtracted from the actual validity defined in the message.") + .description( + """ + Normally the planned departure time is used, so setting this to 10s will cause the + SX-message to be included in trip-results 10 seconds before the the planned departure + time.""" + ) + .asDuration(Duration.ZERO), + HttpHeadersConfig.headers(c, V2_7) + ); + } +} diff --git a/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java b/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java index e98c730df47..32a9500236a 100644 --- a/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java @@ -9,6 +9,7 @@ import org.opentripplanner.updater.siri.updater.SiriSXUpdaterParameters; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdaterParameters; import org.opentripplanner.updater.siri.updater.light.SiriETLightUpdaterParameters; +import org.opentripplanner.updater.siri.updater.light.SiriSXLightUpdaterParameters; import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdaterParameters; import org.opentripplanner.updater.trip.PollingTripUpdaterParameters; import org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters; @@ -36,6 +37,8 @@ public interface UpdatersParameters { List getSiriETLightUpdaterParameters(); + List getSiriSXLightUpdaterParameters(); + List getMqttGtfsRealtimeUpdaterParameters(); List getVehicleParkingUpdaterParameters(); diff --git a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java index 544e5a0c4f5..fe0c5af3e4c 100644 --- a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java +++ b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java @@ -22,9 +22,11 @@ import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; import org.opentripplanner.updater.siri.updater.SiriETHttpTripUpdateSource; import org.opentripplanner.updater.siri.updater.SiriETUpdater; +import org.opentripplanner.updater.siri.updater.SiriHttpLoader; import org.opentripplanner.updater.siri.updater.SiriSXUpdater; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdater; import org.opentripplanner.updater.siri.updater.light.SiriETLightHttpTripUpdateSource; +import org.opentripplanner.updater.siri.updater.light.SiriLightHttpLoader; import org.opentripplanner.updater.spi.GraphUpdater; import org.opentripplanner.updater.spi.TimetableSnapshotFlush; import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdater; @@ -208,7 +210,26 @@ private List createUpdatersFromConfig() { updaters.add(new SiriETGooglePubsubUpdater(configItem, provideSiriTimetableSnapshot())); } for (var configItem : updatersParameters.getSiriSXUpdaterParameters()) { - updaters.add(new SiriSXUpdater(configItem, timetableRepository)); + updaters.add( + new SiriSXUpdater( + configItem, + timetableRepository, + new SiriHttpLoader(configItem.url(), configItem.timeout(), configItem.requestHeaders()) + ) + ); + } + for (var configItem : updatersParameters.getSiriSXLightUpdaterParameters()) { + updaters.add( + new SiriSXUpdater( + configItem, + timetableRepository, + new SiriLightHttpLoader( + configItem.uri(), + configItem.timeout(), + configItem.requestHeaders() + ) + ) + ); } for (var configItem : updatersParameters.getMqttGtfsRealtimeUpdaterParameters()) { updaters.add(new MqttGtfsRealtimeUpdater(configItem, provideGtfsTimetableSnapshot())); diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/BaseSiriETUpdaterParameters.java similarity index 70% rename from application/src/main/java/org/opentripplanner/updater/siri/updater/SiriUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/BaseSiriETUpdaterParameters.java index 0d9b8ea79bb..bad6e7583f0 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/BaseSiriETUpdaterParameters.java @@ -3,7 +3,8 @@ import org.opentripplanner.updater.spi.PollingGraphUpdaterParameters; import org.opentripplanner.updater.trip.UrlUpdaterParameters; -public interface SiriUpdaterParameters extends UrlUpdaterParameters, PollingGraphUpdaterParameters { +public interface BaseSiriETUpdaterParameters + extends UrlUpdaterParameters, PollingGraphUpdaterParameters { boolean blockReadinessUntilInitialized(); boolean fuzzyTripMatching(); diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java index b11c26471c2..916e563b0dd 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java @@ -37,7 +37,7 @@ public class SiriETUpdater extends PollingGraphUpdater { private final Consumer metricsConsumer; public SiriETUpdater( - SiriUpdaterParameters config, + BaseSiriETUpdaterParameters config, SiriTimetableSnapshotSource timetableSnapshotSource, EstimatedTimetableSource source, Consumer metricsConsumer @@ -49,11 +49,7 @@ public SiriETUpdater( this.blockReadinessUntilInitialized = config.blockReadinessUntilInitialized(); - LOG.info( - "Creating SIRI ET updater running every {}: {}", - pollingPeriod(), - updateSource - ); + LOG.info("Creating SIRI ET updater running every {}: {}", pollingPeriod(), updateSource); estimatedTimetableHandler = new EstimatedTimetableHandler(timetableSnapshotSource, config.fuzzyTripMatching(), feedId); diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java index 395e7930f17..b04fc3a4116 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java @@ -16,7 +16,7 @@ public record SiriETUpdaterParameters( HttpHeaders httpRequestHeaders, boolean producerMetrics ) - implements SiriUpdaterParameters, SiriETHttpTripUpdateSource.Parameters { + implements BaseSiriETUpdaterParameters, SiriETHttpTripUpdateSource.Parameters { public SiriETHttpTripUpdateSource.Parameters sourceParameters() { return this; } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriHttpLoader.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriHttpLoader.java index 0ad9309e354..29de28efaee 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriHttpLoader.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriHttpLoader.java @@ -11,7 +11,8 @@ import uk.org.siri.siri20.Siri; /** - * Load real-time updates from SIRI-SX and SIRI-ET feeds over HTTP. + * Load real-time updates from SIRI-SX and SIRI-ET feeds over HTTP using the request/response + * flow, which asks the server to only send the latest updates for a given requestor ref. */ public class SiriHttpLoader implements SiriLoader { diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java index 83200db30d3..b8b6e36ecf7 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java @@ -13,7 +13,9 @@ import org.opentripplanner.updater.alert.TransitAlertProvider; import org.opentripplanner.updater.siri.SiriAlertsUpdateHandler; import org.opentripplanner.updater.spi.PollingGraphUpdater; +import org.opentripplanner.updater.spi.PollingGraphUpdaterParameters; import org.opentripplanner.updater.spi.WriteToGraphCallback; +import org.opentripplanner.updater.trip.UrlUpdaterParameters; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import uk.org.siri.siri20.ServiceDelivery; @@ -40,10 +42,14 @@ public class SiriSXUpdater extends PollingGraphUpdater implements TransitAlertPr * Global retry counter used to create a new unique requestorRef after each retry. */ private int retryCount = 0; - private final SiriHttpLoader siriHttpLoader; + private final SiriLoader siriHttpLoader; private final OtpRetry retry; - public SiriSXUpdater(SiriSXUpdaterParameters config, TimetableRepository timetableRepository) { + public SiriSXUpdater( + BaseSiriSXUpdaterParameters config, + TimetableRepository timetableRepository, + SiriLoader siriLoader + ) { super(config); // TODO: add options to choose different patch services this.url = config.url(); @@ -59,7 +65,7 @@ public SiriSXUpdater(SiriSXUpdaterParameters config, TimetableRepository timetab this.transitAlertService = new TransitAlertServiceImpl(timetableRepository); this.updateHandler = new SiriAlertsUpdateHandler(config.feedId(), transitAlertService, config.earlyStart()); - siriHttpLoader = new SiriHttpLoader(url, config.timeout(), config.requestHeaders()); + siriHttpLoader = siriLoader; retry = new OtpRetryBuilder() @@ -200,4 +206,13 @@ private void updateRequestorRef() { retryCount++; requestorRef = originalRequestorRef + "-retry-" + retryCount; } + + public interface BaseSiriSXUpdaterParameters + extends PollingGraphUpdaterParameters, UrlUpdaterParameters { + String requestorRef(); + + boolean blockReadinessUntilInitialized(); + + Duration earlyStart(); + } } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdaterParameters.java index f51584f86f5..c17ee21fffc 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdaterParameters.java @@ -2,7 +2,6 @@ import java.time.Duration; import org.opentripplanner.updater.spi.HttpHeaders; -import org.opentripplanner.updater.spi.PollingGraphUpdaterParameters; public record SiriSXUpdaterParameters( String configRef, @@ -15,4 +14,4 @@ public record SiriSXUpdaterParameters( boolean blockReadinessUntilInitialized, HttpHeaders requestHeaders ) - implements PollingGraphUpdaterParameters {} + implements SiriSXUpdater.BaseSiriSXUpdaterParameters {} diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java index ad072cb56c1..5a30ac1c5df 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java @@ -61,7 +61,7 @@ public String toString() { return ToStringBuilder .of(this.getClass()) .addStr("feedId", parameters.feedId()) - .addStr("uri", parameters.toString()) + .addStr("uri", parameters.uri().toString()) .toString(); } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightUpdaterParameters.java index 26fe959bc8c..07db1ed6f77 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightUpdaterParameters.java @@ -2,7 +2,7 @@ import java.net.URI; import java.time.Duration; -import org.opentripplanner.updater.siri.updater.SiriUpdaterParameters; +import org.opentripplanner.updater.siri.updater.BaseSiriETUpdaterParameters; import org.opentripplanner.updater.spi.HttpHeaders; public record SiriETLightUpdaterParameters( @@ -14,7 +14,7 @@ public record SiriETLightUpdaterParameters( boolean fuzzyTripMatching, HttpHeaders httpRequestHeaders ) - implements SiriUpdaterParameters, SiriETLightHttpTripUpdateSource.Parameters { + implements BaseSiriETUpdaterParameters, SiriETLightHttpTripUpdateSource.Parameters { public SiriETLightHttpTripUpdateSource.Parameters sourceParameters() { return this; } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLightUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLightUpdaterParameters.java new file mode 100644 index 00000000000..553dbd99744 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLightUpdaterParameters.java @@ -0,0 +1,32 @@ +package org.opentripplanner.updater.siri.updater.light; + +import java.net.URI; +import java.time.Duration; +import org.opentripplanner.updater.siri.updater.SiriSXUpdater; +import org.opentripplanner.updater.spi.HttpHeaders; + +public record SiriSXLightUpdaterParameters( + String configRef, + String feedId, + URI uri, + Duration frequency, + Duration earlyStart, + Duration timeout, + HttpHeaders requestHeaders +) + implements SiriSXUpdater.BaseSiriSXUpdaterParameters { + @Override + public String requestorRef() { + return "OpenTripPlanner"; + } + + @Override + public boolean blockReadinessUntilInitialized() { + return false; + } + + @Override + public String url() { + return uri.toString(); + } +} diff --git a/doc/user/sandbox/siri/SiriUpdater.md b/doc/user/sandbox/siri/SiriUpdater.md index 0aeef704cdb..eedd4feb45e 100644 --- a/doc/user/sandbox/siri/SiriUpdater.md +++ b/doc/user/sandbox/siri/SiriUpdater.md @@ -174,19 +174,30 @@ for GTFS-RT TripUpdates. -| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | -|----------------------------|:---------------:|----------------------------------------------------------------------------|:----------:|---------------|:-----:| -| type = "siri-et-light" | `enum` | The type of the updater. | *Required* | | 1.5 | -| feedId | `string` | The ID of the feed to apply the updates to. | *Required* | | 2.7 | -| frequency | `duration` | How often the updates should be retrieved. | *Optional* | `"PT1M"` | 2.7 | -| fuzzyTripMatching | `boolean` | If the fuzzy trip matcher should be used to match trips. | *Optional* | `false` | 2.7 | -| timeout | `duration` | The HTTP timeout to download the updates. | *Optional* | `"PT15S"` | 2.7 | -| [url](#u__15__url) | `uri` | The URL to send the HTTP requests to. | *Required* | | 2.7 | -| [headers](#u__15__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.7 | +| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | +|----------------------------------|:---------------:|----------------------------------------------------------------------------|:----------:|---------------|:-----:| +| type = "siri-et-light" | `enum` | The type of the updater. | *Required* | | 1.5 | +| [earlyStart](#u__15__earlyStart) | `duration` | This value is subtracted from the actual validity defined in the message. | *Optional* | `"PT0S"` | 2.0 | +| feedId | `string` | The ID of the feed to apply the updates to. | *Required* | | 2.7 | +| frequency | `duration` | How often the updates should be retrieved. | *Optional* | `"PT1M"` | 2.7 | +| timeout | `duration` | The HTTP timeout to download the updates. | *Optional* | `"PT15S"` | 2.7 | +| [url](#u__15__url) | `uri` | The URL to send the HTTP requests to. | *Required* | | 2.7 | +| [headers](#u__15__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.7 | ##### Parameter details +

earlyStart

+ +**Since version:** `2.0` ∙ **Type:** `duration` ∙ **Cardinality:** `Optional` ∙ **Default value:** `"PT0S"` +**Path:** /updaters/[15] + +This value is subtracted from the actual validity defined in the message. + +Normally the planned departure time is used, so setting this to 10s will cause the +SX-message to be included in trip-results 10 seconds before the the planned departure +time. +

url

**Since version:** `2.7` ∙ **Type:** `uri` ∙ **Cardinality:** `Required` From 24bcf97e3331923c29a2958b1365102148ec0e2a Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 27 Nov 2024 11:15:15 +0100 Subject: [PATCH 09/60] Add documentation about SIRI SX --- .../updater/siri/updater/SiriSXUpdater.java | 2 +- .../generate/doc/SiriConfigDocTest.java | 3 +- .../standalone/config/router-config.json | 5 ++ doc/templates/sandbox/siri/SiriUpdater.md | 8 ++- .../Netex-Siri-Compatibility.md | 4 +- doc/user/sandbox/siri/SiriUpdater.md | 72 ++++++++++++++++++- 6 files changed, 88 insertions(+), 6 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java index b8b6e36ecf7..827a8fb1ff6 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java @@ -78,7 +78,7 @@ public SiriSXUpdater( .build(); LOG.info( - "Creating real-time alert updater (SIRI SX) running every {} seconds : {}", + "Creating SIRI-SX updater running every {}: {}", pollingPeriod(), url ); diff --git a/application/src/test/java/org/opentripplanner/generate/doc/SiriConfigDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/SiriConfigDocTest.java index 17dac32c82c..4119704ba2b 100644 --- a/application/src/test/java/org/opentripplanner/generate/doc/SiriConfigDocTest.java +++ b/application/src/test/java/org/opentripplanner/generate/doc/SiriConfigDocTest.java @@ -31,8 +31,9 @@ public class SiriConfigDocTest { private static final String ROUTER_CONFIG_PATH = "standalone/config/" + ROUTER_CONFIG_FILENAME; private static final Set INCLUDE_UPDATERS = Set.of( "siri-et-updater", + "siri-sx-updater", "siri-et-light", - "siri-sx-updater" + "siri-sx-light" ); private static final SkipNodes SKIP_NODES = SkipNodes.of().build(); public static final ObjectMapper mapper = new ObjectMapper(); diff --git a/application/src/test/resources/standalone/config/router-config.json b/application/src/test/resources/standalone/config/router-config.json index 8b5fde4bd00..6c27f3e06dd 100644 --- a/application/src/test/resources/standalone/config/router-config.json +++ b/application/src/test/resources/standalone/config/router-config.json @@ -437,6 +437,11 @@ "feedId": "sta", "url": "https://example.com/siri-lite/estimated-timetable/xml", "fuzzyTripMatching": true + }, + { + "type": "siri-sx-light", + "feedId": "sta", + "url": "https://example.com/siri-lite/situation-exchange/xml" } ], "rideHailingServices": [ diff --git a/doc/templates/sandbox/siri/SiriUpdater.md b/doc/templates/sandbox/siri/SiriUpdater.md index 8a949f63ce5..a9ef179c7c6 100644 --- a/doc/templates/sandbox/siri/SiriUpdater.md +++ b/doc/templates/sandbox/siri/SiriUpdater.md @@ -25,7 +25,7 @@ To enable the SIRI updater you need to add it to the `updaters` section of the ` -### SIRI-ET Light via HTTPS +### SIRI-ET Light SIRI Light is [not very well](https://nextcloud.leonard.io/s/2tdYdmYBGtLQMfi/download?path=&files=Proposition-Profil-SIRI-Lite-initial-v1-3%20en.pdf) [specified](https://normes.transport.data.gouv.fr/normes/siri/profil-france/#protocoles-d%C3%A9change-des-donn%C3%A9es-siri), @@ -37,6 +37,12 @@ for GTFS-RT TripUpdates. +### SIRI-SX Light + +This updater follows the same definition of SIRI light + + + ## Changelog diff --git a/doc/user/features-explained/Netex-Siri-Compatibility.md b/doc/user/features-explained/Netex-Siri-Compatibility.md index 731011be8e0..10c64f6a5c0 100644 --- a/doc/user/features-explained/Netex-Siri-Compatibility.md +++ b/doc/user/features-explained/Netex-Siri-Compatibility.md @@ -12,7 +12,7 @@ Different countries are currently using different incompatible "profiles" of NeT underway to converge on a single European standard profile. This is based in large part on the Nordic profile used by Entur. -The Nordic profile is the only profile that has been thoroughly tested in production in OTP and is +The Nordic profile is the only one that has been thoroughly tested in production in OTP and is used in Norway, Finland and Sweden. ### EPIP @@ -22,7 +22,7 @@ is an attempt to unify other country profiles and support in OTP is adequate, bu to tell how much of EPIP is supported since it is a very large profile. The current status of the support is tracked on [Github](https://github.com/opentripplanner/OpenTripPlanner/issues/3640). -Sometimes it is difficult to tell if a file conforms to EPIP so to find out, you can run the following +Sometimes it is not easy to figure out if a file conforms to EPIP so to find out, you can run the following commands: ``` diff --git a/doc/user/sandbox/siri/SiriUpdater.md b/doc/user/sandbox/siri/SiriUpdater.md index eedd4feb45e..0ce0af57b55 100644 --- a/doc/user/sandbox/siri/SiriUpdater.md +++ b/doc/user/sandbox/siri/SiriUpdater.md @@ -161,7 +161,7 @@ HTTP headers to add to the request. Any header key, value can be inserted. -### SIRI-ET Light via HTTPS +### SIRI-ET Light SIRI Light is [not very well](https://nextcloud.leonard.io/s/2tdYdmYBGtLQMfi/download?path=&files=Proposition-Profil-SIRI-Lite-initial-v1-3%20en.pdf) [specified](https://normes.transport.data.gouv.fr/normes/siri/profil-france/#protocoles-d%C3%A9change-des-donn%C3%A9es-siri), @@ -240,6 +240,76 @@ HTTP headers to add to the request. Any header key, value can be inserted. +### SIRI-SX Light + + + + +| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | +|----------------------------------|:---------------:|----------------------------------------------------------------------------|:----------:|---------------|:-----:| +| type = "siri-sx-light" | `enum` | The type of the updater. | *Required* | | 1.5 | +| [earlyStart](#u__16__earlyStart) | `duration` | This value is subtracted from the actual validity defined in the message. | *Optional* | `"PT0S"` | 2.0 | +| feedId | `string` | The ID of the feed to apply the updates to. | *Required* | | 2.7 | +| frequency | `duration` | How often the updates should be retrieved. | *Optional* | `"PT1M"` | 2.7 | +| timeout | `duration` | The HTTP timeout to download the updates. | *Optional* | `"PT15S"` | 2.7 | +| [url](#u__16__url) | `uri` | The URL to send the HTTP requests to. | *Required* | | 2.7 | +| [headers](#u__16__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.7 | + + +##### Parameter details + +

earlyStart

+ +**Since version:** `2.0` ∙ **Type:** `duration` ∙ **Cardinality:** `Optional` ∙ **Default value:** `"PT0S"` +**Path:** /updaters/[16] + +This value is subtracted from the actual validity defined in the message. + +Normally the planned departure time is used, so setting this to 10s will cause the +SX-message to be included in trip-results 10 seconds before the the planned departure +time. + +

url

+ +**Since version:** `2.7` ∙ **Type:** `uri` ∙ **Cardinality:** `Required` +**Path:** /updaters/[16] + +The URL to send the HTTP requests to. + +Use the file protocol to set a directory for reading updates from a directory. The file +loader will look for xml files: '*.xml' in the configured directory. The files are +renamed by the loader when processed: + +    _a.xml_   ➞   _a.xml.inProgress_   ➞   _a.xml.ok_   or   _a.xml.failed_ + + + +

headers

+ +**Since version:** `2.7` ∙ **Type:** `map of string` ∙ **Cardinality:** `Optional` +**Path:** /updaters/[16] + +HTTP headers to add to the request. Any header key, value can be inserted. + + + +##### Example configuration + +```JSON +// router-config.json +{ + "updaters" : [ + { + "type" : "siri-sx-light", + "feedId" : "sta", + "url" : "https://example.com/siri-lite/situation-exchange/xml" + } + ] +} +``` + + + ## Changelog From 464ca30284f3f41dc3645be752c5c3de4ca4abc0 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 27 Nov 2024 11:24:05 +0100 Subject: [PATCH 10/60] Move config interfaces into updaters --- .../siri/updater/BaseSiriETUpdaterParameters.java | 11 ----------- .../updater/siri/updater/SiriETUpdater.java | 11 ++++++++++- .../updater/siri/updater/SiriETUpdaterParameters.java | 2 +- .../updater/siri/updater/SiriSXUpdater.java | 4 ++-- .../updater/siri/updater/SiriSXUpdaterParameters.java | 2 +- .../light/SiriETLightHttpTripUpdateSource.java | 8 +++++++- .../updater/light/SiriETLightUpdaterParameters.java | 4 ++-- .../updater/light/SiriSXLightUpdaterParameters.java | 2 +- 8 files changed, 24 insertions(+), 20 deletions(-) delete mode 100644 application/src/main/java/org/opentripplanner/updater/siri/updater/BaseSiriETUpdaterParameters.java diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/BaseSiriETUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/BaseSiriETUpdaterParameters.java deleted file mode 100644 index bad6e7583f0..00000000000 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/BaseSiriETUpdaterParameters.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.opentripplanner.updater.siri.updater; - -import org.opentripplanner.updater.spi.PollingGraphUpdaterParameters; -import org.opentripplanner.updater.trip.UrlUpdaterParameters; - -public interface BaseSiriETUpdaterParameters - extends UrlUpdaterParameters, PollingGraphUpdaterParameters { - boolean blockReadinessUntilInitialized(); - - boolean fuzzyTripMatching(); -} diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java index 916e563b0dd..7b4d64da324 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java @@ -4,9 +4,11 @@ import java.util.function.Consumer; import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; import org.opentripplanner.updater.spi.PollingGraphUpdater; +import org.opentripplanner.updater.spi.PollingGraphUpdaterParameters; import org.opentripplanner.updater.spi.ResultLogger; import org.opentripplanner.updater.spi.UpdateResult; import org.opentripplanner.updater.spi.WriteToGraphCallback; +import org.opentripplanner.updater.trip.UrlUpdaterParameters; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import uk.org.siri.siri20.EstimatedTimetableDeliveryStructure; @@ -37,7 +39,7 @@ public class SiriETUpdater extends PollingGraphUpdater { private final Consumer metricsConsumer; public SiriETUpdater( - BaseSiriETUpdaterParameters config, + SiriETUpdaterParameters config, SiriTimetableSnapshotSource timetableSnapshotSource, EstimatedTimetableSource source, Consumer metricsConsumer @@ -97,4 +99,11 @@ public String toString() { String s = (updateSource == null) ? "NONE" : updateSource.toString(); return "Polling SIRI ET updater with update source = " + s; } + + public interface SiriETUpdaterParameters + extends UrlUpdaterParameters, PollingGraphUpdaterParameters { + boolean blockReadinessUntilInitialized(); + + boolean fuzzyTripMatching(); + } } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java index b04fc3a4116..a3477e3854e 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java @@ -16,7 +16,7 @@ public record SiriETUpdaterParameters( HttpHeaders httpRequestHeaders, boolean producerMetrics ) - implements BaseSiriETUpdaterParameters, SiriETHttpTripUpdateSource.Parameters { + implements SiriETUpdater.SiriETUpdaterParameters, SiriETHttpTripUpdateSource.Parameters { public SiriETHttpTripUpdateSource.Parameters sourceParameters() { return this; } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java index 827a8fb1ff6..64ef9720426 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java @@ -46,7 +46,7 @@ public class SiriSXUpdater extends PollingGraphUpdater implements TransitAlertPr private final OtpRetry retry; public SiriSXUpdater( - BaseSiriSXUpdaterParameters config, + SiriSXUpdaterParameters config, TimetableRepository timetableRepository, SiriLoader siriLoader ) { @@ -207,7 +207,7 @@ private void updateRequestorRef() { requestorRef = originalRequestorRef + "-retry-" + retryCount; } - public interface BaseSiriSXUpdaterParameters + public interface SiriSXUpdaterParameters extends PollingGraphUpdaterParameters, UrlUpdaterParameters { String requestorRef(); diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdaterParameters.java index c17ee21fffc..539e1333fa8 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdaterParameters.java @@ -14,4 +14,4 @@ public record SiriSXUpdaterParameters( boolean blockReadinessUntilInitialized, HttpHeaders requestHeaders ) - implements SiriSXUpdater.BaseSiriSXUpdaterParameters {} + implements SiriSXUpdater.SiriSXUpdaterParameters {} diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java index 5a30ac1c5df..896a5b6cdea 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java @@ -16,10 +16,16 @@ import org.slf4j.LoggerFactory; import uk.org.siri.siri20.Siri; +/** + * SIRI Light downloads periodically all messages as a single GET request. + */ public class SiriETLightHttpTripUpdateSource implements EstimatedTimetableSource { private static final Logger LOG = LoggerFactory.getLogger(SiriETLightHttpTripUpdateSource.class); - private static final String DUMMY_REQUESTOR_REF = "OTP"; + /** + * The framework code requires a requestor ref but in SIRI Light this is not used. + */ + private static final String DUMMY_REQUESTOR_REF = "OpenTripPlanner"; private final Parameters parameters; diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightUpdaterParameters.java index 07db1ed6f77..d4aa6fcaa37 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightUpdaterParameters.java @@ -2,7 +2,7 @@ import java.net.URI; import java.time.Duration; -import org.opentripplanner.updater.siri.updater.BaseSiriETUpdaterParameters; +import org.opentripplanner.updater.siri.updater.SiriETUpdater; import org.opentripplanner.updater.spi.HttpHeaders; public record SiriETLightUpdaterParameters( @@ -14,7 +14,7 @@ public record SiriETLightUpdaterParameters( boolean fuzzyTripMatching, HttpHeaders httpRequestHeaders ) - implements BaseSiriETUpdaterParameters, SiriETLightHttpTripUpdateSource.Parameters { + implements SiriETUpdater.SiriETUpdaterParameters, SiriETLightHttpTripUpdateSource.Parameters { public SiriETLightHttpTripUpdateSource.Parameters sourceParameters() { return this; } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLightUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLightUpdaterParameters.java index 553dbd99744..540fee7b919 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLightUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLightUpdaterParameters.java @@ -14,7 +14,7 @@ public record SiriSXLightUpdaterParameters( Duration timeout, HttpHeaders requestHeaders ) - implements SiriSXUpdater.BaseSiriSXUpdaterParameters { + implements SiriSXUpdater.SiriSXUpdaterParameters { @Override public String requestorRef() { return "OpenTripPlanner"; From 01241535fb465675ac3da0299f86d92953e5d266 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 27 Nov 2024 12:02:06 +0100 Subject: [PATCH 11/60] Small cleanup of the SIRI code --- .../config/routerconfig/UpdatersConfig.java | 3 ++- .../updater/EstimatedTimetableSource.java | 2 -- .../updater/SiriETHttpTripUpdateSource.java | 13 ++---------- .../updater/siri/updater/SiriETUpdater.java | 9 ++++++-- .../updater/siri/updater/SiriSXUpdater.java | 21 ++++++++++--------- .../SiriETLightHttpTripUpdateSource.java | 5 ----- .../sandbox/siri/SiriAzureUpdater.md | 2 +- 7 files changed, 23 insertions(+), 32 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java index 98611bea96e..0e3658f0ca8 100644 --- a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java @@ -31,6 +31,7 @@ import org.opentripplanner.standalone.config.routerconfig.updaters.MqttGtfsRealtimeUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.PollingTripUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.SiriETGooglePubsubUpdaterConfig; +import org.opentripplanner.standalone.config.routerconfig.updaters.SiriETLightUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.SiriETUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.SiriSXLightUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.SiriSXUpdaterConfig; @@ -232,7 +233,7 @@ public enum Type { REAL_TIME_ALERTS(GtfsRealtimeAlertsUpdaterConfig::create), VEHICLE_POSITIONS(VehiclePositionsUpdaterConfig::create), SIRI_ET_UPDATER(SiriETUpdaterConfig::create), - SIRI_ET_LIGHT(SiriSXLightUpdaterConfig::create), + SIRI_ET_LIGHT(SiriETLightUpdaterConfig::create), SIRI_SX_LIGHT(SiriSXLightUpdaterConfig::create), SIRI_ET_GOOGLE_PUBSUB_UPDATER(SiriETGooglePubsubUpdaterConfig::create), SIRI_SX_UPDATER(SiriSXUpdaterConfig::create), diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/EstimatedTimetableSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/EstimatedTimetableSource.java index f8a1b549c96..3636fd2b96f 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/EstimatedTimetableSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/EstimatedTimetableSource.java @@ -23,6 +23,4 @@ public interface EstimatedTimetableSource { * {@link UpdateIncrementality} */ UpdateIncrementality incrementalityOfLastUpdates(); - - String getFeedId(); } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETHttpTripUpdateSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETHttpTripUpdateSource.java index fec6e2885a7..c16ede42ac3 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETHttpTripUpdateSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETHttpTripUpdateSource.java @@ -11,6 +11,7 @@ import org.opentripplanner.framework.io.OtpHttpClientException; import org.opentripplanner.updater.spi.HttpHeaders; import org.opentripplanner.updater.trip.UpdateIncrementality; +import org.opentripplanner.utils.tostring.ToStringBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import uk.org.siri.siri20.Siri; @@ -19,11 +20,6 @@ public class SiriETHttpTripUpdateSource implements EstimatedTimetableSource { private static final Logger LOG = LoggerFactory.getLogger(SiriETHttpTripUpdateSource.class); - /** - * Feed id that is used to match trip ids in the TripUpdates - */ - private final String feedId; - private final String url; private final SiriLoader siriLoader; @@ -36,7 +32,6 @@ public class SiriETHttpTripUpdateSource implements EstimatedTimetableSource { private ZonedDateTime lastTimestamp = ZonedDateTime.now().minusMonths(1); public SiriETHttpTripUpdateSource(Parameters parameters) { - this.feedId = parameters.feedId(); this.url = parameters.url(); this.requestorRef = @@ -82,12 +77,8 @@ public UpdateIncrementality incrementalityOfLastUpdates() { } @Override - public String getFeedId() { - return this.feedId; - } - public String toString() { - return "SiriETHttpTripUpdateSource(" + url + ")"; + return ToStringBuilder.of(this.getClass()).addStr("url", url).toString(); } private static SiriLoader createLoader(String url, Parameters parameters) { diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java index 7b4d64da324..f1d3941cf46 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java @@ -9,6 +9,7 @@ import org.opentripplanner.updater.spi.UpdateResult; import org.opentripplanner.updater.spi.WriteToGraphCallback; import org.opentripplanner.updater.trip.UrlUpdaterParameters; +import org.opentripplanner.utils.tostring.ToStringBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import uk.org.siri.siri20.EstimatedTimetableDeliveryStructure; @@ -95,9 +96,13 @@ public void runPolling() { } while (moreData); } + @Override public String toString() { - String s = (updateSource == null) ? "NONE" : updateSource.toString(); - return "Polling SIRI ET updater with update source = " + s; + return ToStringBuilder + .of(this.getClass()) + .addStr("source", updateSource.toString()) + .addDuration("frequency", pollingPeriod()) + .toString(); } public interface SiriETUpdaterParameters diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java index 64ef9720426..253338161fb 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java @@ -16,6 +16,7 @@ import org.opentripplanner.updater.spi.PollingGraphUpdaterParameters; import org.opentripplanner.updater.spi.WriteToGraphCallback; import org.opentripplanner.updater.trip.UrlUpdaterParameters; +import org.opentripplanner.utils.tostring.ToStringBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import uk.org.siri.siri20.ServiceDelivery; @@ -51,7 +52,6 @@ public SiriSXUpdater( SiriLoader siriLoader ) { super(config); - // TODO: add options to choose different patch services this.url = config.url(); this.requestorRef = config.requestorRef(); @@ -77,11 +77,7 @@ public SiriSXUpdater( .withOnRetry(this::updateRequestorRef) .build(); - LOG.info( - "Creating SIRI-SX updater running every {}: {}", - pollingPeriod(), - url - ); + LOG.info("Creating SIRI-SX updater running every {}: {}", pollingPeriod(), url); } @Override @@ -93,15 +89,20 @@ public TransitAlertService getTransitAlertService() { return transitAlertService; } - public String toString() { - return "SiriSXUpdater (" + url + ")"; - } - @Override protected void runPolling() throws InterruptedException { retry.execute(this::updateSiri); } + @Override + public String toString() { + return ToStringBuilder + .of(this.getClass()) + .addStr("url", url) + .addDuration("frequency", pollingPeriod()) + .toString(); + } + /** * This part of the update process has been factored out to allow repeated retries of the HTTP * fetching operation in case the connection fails or some other disruption happens. diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java index 896a5b6cdea..f60ee8e1c35 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java @@ -58,11 +58,6 @@ public UpdateIncrementality incrementalityOfLastUpdates() { return FULL_DATASET; } - @Override - public String getFeedId() { - return this.parameters.feedId(); - } - public String toString() { return ToStringBuilder .of(this.getClass()) diff --git a/doc/templates/sandbox/siri/SiriAzureUpdater.md b/doc/templates/sandbox/siri/SiriAzureUpdater.md index 646484c9aec..5e9e1065519 100644 --- a/doc/templates/sandbox/siri/SiriAzureUpdater.md +++ b/doc/templates/sandbox/siri/SiriAzureUpdater.md @@ -30,5 +30,5 @@ To enable the SIRI updater you need to add it to the updaters section of the `ro - Initial version (April 2022) - Minor changes in logging (November 2022) - Retry fetch from history endpoint if it failed (February 2023) -- Solve a bug in SIRIAzureETUpdater and improve error logging (March 2023) +- Solve a bug in SiriAzureETUpdater and improve error logging (March 2023) - Add support with federated identity authentication (February 2024) \ No newline at end of file From 30e12f986f5f2a3318041f17770d631b80ddc9b3 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 27 Nov 2024 13:56:05 +0100 Subject: [PATCH 12/60] Add test and example --- .../light/SiriLightHttpLoaderTest.java | 33 +++ .../updater/siri/updater/light/siri-sx.xml | 243 ++++++++++++++++++ doc/templates/sandbox/siri/SiriUpdater.md | 3 +- doc/user/RouterConfiguration.md | 5 + doc/user/sandbox/siri/SiriAzureUpdater.md | 2 +- doc/user/sandbox/siri/SiriUpdater.md | 32 +-- 6 files changed, 296 insertions(+), 22 deletions(-) create mode 100644 application/src/test/java/org/opentripplanner/updater/siri/updater/light/SiriLightHttpLoaderTest.java create mode 100644 application/src/test/resources/org/opentripplanner/updater/siri/updater/light/siri-sx.xml diff --git a/application/src/test/java/org/opentripplanner/updater/siri/updater/light/SiriLightHttpLoaderTest.java b/application/src/test/java/org/opentripplanner/updater/siri/updater/light/SiriLightHttpLoaderTest.java new file mode 100644 index 00000000000..3886d90309a --- /dev/null +++ b/application/src/test/java/org/opentripplanner/updater/siri/updater/light/SiriLightHttpLoaderTest.java @@ -0,0 +1,33 @@ +package org.opentripplanner.updater.siri.updater.light; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.time.Duration; +import java.util.List; +import org.junit.jupiter.api.Test; +import org.opentripplanner.test.support.ResourceLoader; +import org.opentripplanner.updater.spi.HttpHeaders; +import uk.org.siri.siri20.NaturalLanguageStringStructure; + +class SiriLightHttpLoaderTest { + + private static final Duration ONE_MIN = Duration.ofMinutes(1); + + @Test + void test() { + var uri = ResourceLoader.of(this).uri("siri-sx.xml"); + var loader = new SiriLightHttpLoader(uri, ONE_MIN, HttpHeaders.empty()); + var siri = loader.fetchETFeed("OTP"); + var delivery = siri.get().getServiceDelivery().getSituationExchangeDeliveries().getFirst(); + var element = delivery.getSituations().getPtSituationElements().getFirst(); + assertEquals( + List.of( + "Hindernis auf Strecke", + "Obstacle on the route", + "Ostacolo sul percorso", + "Ostacul su la via" + ), + element.getReasonNames().stream().map(NaturalLanguageStringStructure::getValue).toList() + ); + } +} diff --git a/application/src/test/resources/org/opentripplanner/updater/siri/updater/light/siri-sx.xml b/application/src/test/resources/org/opentripplanner/updater/siri/updater/light/siri-sx.xml new file mode 100644 index 00000000000..be63b158bc6 --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/updater/siri/updater/light/siri-sx.xml @@ -0,0 +1,243 @@ + + + + 2024-11-27T11:48:04.308988Z + DDIP-M + + 2024-11-27T11:48:04.308988Z + + + 2024-10-04T13:11:34.547+02:00 + STA + 2024-3443167 + 6 + + directReport + + published + + 2024-10-04T13:08:00+02:00 + 2024-11-30T13:08:00+01:00 + + + 2024-10-04T00:00:00+02:00 + 2024-11-30T23:59:00+01:00 + + routeBlockage + Hindernis auf Strecke + Obstacle on the route + Ostacolo sul percorso + Ostacul su la via + 3 + line + de + Straßen-/Streckenhindernis + The busroute: 120 obstacle on the track + 120 Linea 120 . Ostacolo su strada/pista + + + + + it:apb:Line:80120_.24a + 120 + + 28554 + Salorno, Autostazione + + + + + + + + + 2024-10-04T13:08:00+02:00 + 2024-11-30T13:08:00+01:00 + + tripCancellation + normal + + + + + it:apb:Line:80120_.24a + 120 + + 28554 + Salorno, Autostazione + + + + + + + + + + + + line + + + + + it:apb:Line:80120_.24a + 120 + + 28554 + Salorno, Autostazione + + + + + + + + + published + 2024-3443167 + 2024-10-04T13:11:34.547+02:00 + 6 + ControlCenter + STA + general + 3 + + L + + Straßen-/Streckenhindernis + + The busroute: 120 obstacle on the + track + + 120 Linea 120 . Ostacolo su + strada/pista + + + + Hindernis auf Strecke + Obstacle on the route + Ostacolo sul percorso + Ostacul su la via + + + Freitext + Free text + Testo libero + + + + Umsteigen auf andere + Linie + + Change to another line + + Cambiare linea + + + + Dauer der Beeinträchtigung bis + vsl. 2024-11-30 13:08:00 + + + + + + M + + Straßen-/Streckenhindernis + + The busroute: 120 obstacle on the + track + + 120 Linea 120 . Ostacolo su + strada/pista + + + + Hindernis auf Strecke + Obstacle on the route + Ostacolo sul percorso + Ostacul su la via + + + Freitext + Free text + Testo libero + + + + Umsteigen auf andere + Linie + + Change to another line + + Cambiare linea + + + + Dauer der Beeinträchtigung bis + vsl. 2024-11-30 13:08:00 + + + + + + S + + Straßen-/Streckenhindernis + + The busroute: 120 obstacle on the + track + + 120 Linea 120 . Ostacolo su + strada/pista + + + + Hindernis auf Strecke + Obstacle on the route + Ostacolo sul percorso + Ostacul su la via + + + Aufgrund Stand: 04.10.2024 - + 30.11.2024 ; 13:08 + + Due to Update: 04.10.2024 ; + 13:08 + + A causa di Aggiornamento: + 04.10.2024 ; 13:08 + + + + Freitext + Free text + Testo libero + + + + Umsteigen auf andere + Linie + + Change to another line + + Cambiare linea + + + + Dauer der Beeinträchtigung bis + vsl. 2024-11-30 13:08:00 + + + + + + + + + + + + \ No newline at end of file diff --git a/doc/templates/sandbox/siri/SiriUpdater.md b/doc/templates/sandbox/siri/SiriUpdater.md index a9ef179c7c6..d1999e04f7d 100644 --- a/doc/templates/sandbox/siri/SiriUpdater.md +++ b/doc/templates/sandbox/siri/SiriUpdater.md @@ -39,7 +39,8 @@ for GTFS-RT TripUpdates. ### SIRI-SX Light -This updater follows the same definition of SIRI light +This updater follows the same definition of SIRI Light as the SIRI-ET one: it downloads the entire +feed in a single HTTP GET request. diff --git a/doc/user/RouterConfiguration.md b/doc/user/RouterConfiguration.md index 6bf00fb6629..d72cdab3d6f 100644 --- a/doc/user/RouterConfiguration.md +++ b/doc/user/RouterConfiguration.md @@ -881,6 +881,11 @@ Used to group requests when monitoring OTP. "feedId" : "sta", "url" : "https://example.com/siri-lite/estimated-timetable/xml", "fuzzyTripMatching" : true + }, + { + "type" : "siri-sx-light", + "feedId" : "sta", + "url" : "https://example.com/siri-lite/situation-exchange/xml" } ], "rideHailingServices" : [ diff --git a/doc/user/sandbox/siri/SiriAzureUpdater.md b/doc/user/sandbox/siri/SiriAzureUpdater.md index 5dabd8e6c20..76018ffbc7c 100644 --- a/doc/user/sandbox/siri/SiriAzureUpdater.md +++ b/doc/user/sandbox/siri/SiriAzureUpdater.md @@ -198,5 +198,5 @@ Has to be present for authenticationMethod SharedAccessKey. This should be Prima - Initial version (April 2022) - Minor changes in logging (November 2022) - Retry fetch from history endpoint if it failed (February 2023) -- Solve a bug in SIRIAzureETUpdater and improve error logging (March 2023) +- Solve a bug in SiriAzureETUpdater and improve error logging (March 2023) - Add support with federated identity authentication (February 2024) \ No newline at end of file diff --git a/doc/user/sandbox/siri/SiriUpdater.md b/doc/user/sandbox/siri/SiriUpdater.md index 0ce0af57b55..5cc2221289c 100644 --- a/doc/user/sandbox/siri/SiriUpdater.md +++ b/doc/user/sandbox/siri/SiriUpdater.md @@ -174,30 +174,19 @@ for GTFS-RT TripUpdates. -| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | -|----------------------------------|:---------------:|----------------------------------------------------------------------------|:----------:|---------------|:-----:| -| type = "siri-et-light" | `enum` | The type of the updater. | *Required* | | 1.5 | -| [earlyStart](#u__15__earlyStart) | `duration` | This value is subtracted from the actual validity defined in the message. | *Optional* | `"PT0S"` | 2.0 | -| feedId | `string` | The ID of the feed to apply the updates to. | *Required* | | 2.7 | -| frequency | `duration` | How often the updates should be retrieved. | *Optional* | `"PT1M"` | 2.7 | -| timeout | `duration` | The HTTP timeout to download the updates. | *Optional* | `"PT15S"` | 2.7 | -| [url](#u__15__url) | `uri` | The URL to send the HTTP requests to. | *Required* | | 2.7 | -| [headers](#u__15__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.7 | +| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | +|----------------------------|:---------------:|----------------------------------------------------------------------------|:----------:|---------------|:-----:| +| type = "siri-et-light" | `enum` | The type of the updater. | *Required* | | 1.5 | +| feedId | `string` | The ID of the feed to apply the updates to. | *Required* | | 2.7 | +| frequency | `duration` | How often the updates should be retrieved. | *Optional* | `"PT1M"` | 2.7 | +| fuzzyTripMatching | `boolean` | If the fuzzy trip matcher should be used to match trips. | *Optional* | `false` | 2.7 | +| timeout | `duration` | The HTTP timeout to download the updates. | *Optional* | `"PT15S"` | 2.7 | +| [url](#u__15__url) | `uri` | The URL to send the HTTP requests to. | *Required* | | 2.7 | +| [headers](#u__15__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.7 | ##### Parameter details -

earlyStart

- -**Since version:** `2.0` ∙ **Type:** `duration` ∙ **Cardinality:** `Optional` ∙ **Default value:** `"PT0S"` -**Path:** /updaters/[15] - -This value is subtracted from the actual validity defined in the message. - -Normally the planned departure time is used, so setting this to 10s will cause the -SX-message to be included in trip-results 10 seconds before the the planned departure -time. -

url

**Since version:** `2.7` ∙ **Type:** `uri` ∙ **Cardinality:** `Required` @@ -242,6 +231,9 @@ HTTP headers to add to the request. Any header key, value can be inserted. ### SIRI-SX Light +This updater follows the same definition of SIRI Light as the SIRI-ET one: it downloads the entire +feed in a single HTTP GET request. + From 6703d620019153a9e1ab729e5774b6c4085d69fe Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 27 Nov 2024 14:04:34 +0100 Subject: [PATCH 13/60] Skip updater in main docs --- .../org/opentripplanner/generate/doc/UpdaterConfigDocTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/src/test/java/org/opentripplanner/generate/doc/UpdaterConfigDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/UpdaterConfigDocTest.java index 989eee18cf5..29097941d01 100644 --- a/application/src/test/java/org/opentripplanner/generate/doc/UpdaterConfigDocTest.java +++ b/application/src/test/java/org/opentripplanner/generate/doc/UpdaterConfigDocTest.java @@ -36,7 +36,8 @@ public class UpdaterConfigDocTest { "siri-et-updater", "siri-et-google-pubsub-updater", "siri-sx-updater", - "siri-et-light" + "siri-et-light", + "siri-sx-light" ); private static final SkipNodes SKIP_NODES = SkipNodes.of().build(); public static final ObjectMapper mapper = new ObjectMapper(); From 86a447fa6ef965e502e23e2384b36a8dedda5e7b Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 4 Dec 2024 10:18:32 +0100 Subject: [PATCH 14/60] Change spelling from 'Light' to 'Lite' --- .../config/routerconfig/UpdatersConfig.java | 23 +++++++++--------- ...nfig.java => SiriETLiteUpdaterConfig.java} | 8 +++---- ...nfig.java => SiriSXLiteUpdaterConfig.java} | 8 +++---- .../updater/UpdatersParameters.java | 8 +++---- .../configure/UpdaterConfigurator.java | 8 +++---- ...va => SiriETLiteHttpTripUpdateSource.java} | 8 +++---- ....java => SiriETLiteUpdaterParameters.java} | 6 ++--- ...ttpLoader.java => SiriLiteHttpLoader.java} | 6 ++--- ....java => SiriSXLiteUpdaterParameters.java} | 2 +- .../generate/doc/SiriConfigDocTest.java | 4 ++-- .../generate/doc/UpdaterConfigDocTest.java | 4 ++-- ...rTest.java => SiriLiteHttpLoaderTest.java} | 4 ++-- .../standalone/config/router-config.json | 4 ++-- doc/templates/sandbox/siri/SiriUpdater.md | 12 +++++----- doc/user/RouterConfiguration.md | 4 ++-- doc/user/sandbox/siri/SiriUpdater.md | 24 +++++++++---------- 16 files changed, 67 insertions(+), 66 deletions(-) rename application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/{SiriETLightUpdaterConfig.java => SiriETLiteUpdaterConfig.java} (81%) rename application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/{SiriSXLightUpdaterConfig.java => SiriSXLiteUpdaterConfig.java} (85%) rename application/src/main/java/org/opentripplanner/updater/siri/updater/light/{SiriETLightHttpTripUpdateSource.java => SiriETLiteHttpTripUpdateSource.java} (92%) rename application/src/main/java/org/opentripplanner/updater/siri/updater/light/{SiriETLightUpdaterParameters.java => SiriETLiteUpdaterParameters.java} (72%) rename application/src/main/java/org/opentripplanner/updater/siri/updater/light/{SiriLightHttpLoader.java => SiriLiteHttpLoader.java} (90%) rename application/src/main/java/org/opentripplanner/updater/siri/updater/light/{SiriSXLightUpdaterParameters.java => SiriSXLiteUpdaterParameters.java} (93%) rename application/src/test/java/org/opentripplanner/updater/siri/updater/light/{SiriLightHttpLoaderTest.java => SiriLiteHttpLoaderTest.java} (90%) diff --git a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java index 0e3658f0ca8..1ee1d8bbf09 100644 --- a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java @@ -8,8 +8,9 @@ import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.SIRI_AZURE_ET_UPDATER; import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.SIRI_AZURE_SX_UPDATER; import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.SIRI_ET_GOOGLE_PUBSUB_UPDATER; -import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.SIRI_ET_LIGHT; +import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.SIRI_ET_LITE; import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.SIRI_ET_UPDATER; +import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.SIRI_SX_LITE; import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.SIRI_SX_UPDATER; import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.STOP_TIME_UPDATER; import static org.opentripplanner.standalone.config.routerconfig.UpdatersConfig.Type.VEHICLE_PARKING; @@ -31,9 +32,9 @@ import org.opentripplanner.standalone.config.routerconfig.updaters.MqttGtfsRealtimeUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.PollingTripUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.SiriETGooglePubsubUpdaterConfig; -import org.opentripplanner.standalone.config.routerconfig.updaters.SiriETLightUpdaterConfig; +import org.opentripplanner.standalone.config.routerconfig.updaters.SiriETLiteUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.SiriETUpdaterConfig; -import org.opentripplanner.standalone.config.routerconfig.updaters.SiriSXLightUpdaterConfig; +import org.opentripplanner.standalone.config.routerconfig.updaters.SiriSXLiteUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.SiriSXUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.VehicleParkingUpdaterConfig; import org.opentripplanner.standalone.config.routerconfig.updaters.VehiclePositionsUpdaterConfig; @@ -47,8 +48,8 @@ import org.opentripplanner.updater.siri.updater.SiriETUpdaterParameters; import org.opentripplanner.updater.siri.updater.SiriSXUpdaterParameters; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdaterParameters; -import org.opentripplanner.updater.siri.updater.light.SiriETLightUpdaterParameters; -import org.opentripplanner.updater.siri.updater.light.SiriSXLightUpdaterParameters; +import org.opentripplanner.updater.siri.updater.light.SiriETLiteUpdaterParameters; +import org.opentripplanner.updater.siri.updater.light.SiriSXLiteUpdaterParameters; import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdaterParameters; import org.opentripplanner.updater.trip.PollingTripUpdaterParameters; import org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters; @@ -188,13 +189,13 @@ public List getSiriSXUpdaterParameters() { } @Override - public List getSiriETLightUpdaterParameters() { - return getParameters(SIRI_ET_LIGHT); + public List getSiriETLightUpdaterParameters() { + return getParameters(SIRI_ET_LITE); } @Override - public List getSiriSXLightUpdaterParameters() { - return getParameters(Type.SIRI_SX_LIGHT); + public List getSiriSXLightUpdaterParameters() { + return getParameters(SIRI_SX_LITE); } @Override @@ -233,10 +234,10 @@ public enum Type { REAL_TIME_ALERTS(GtfsRealtimeAlertsUpdaterConfig::create), VEHICLE_POSITIONS(VehiclePositionsUpdaterConfig::create), SIRI_ET_UPDATER(SiriETUpdaterConfig::create), - SIRI_ET_LIGHT(SiriETLightUpdaterConfig::create), - SIRI_SX_LIGHT(SiriSXLightUpdaterConfig::create), + SIRI_ET_LITE(SiriETLiteUpdaterConfig::create), SIRI_ET_GOOGLE_PUBSUB_UPDATER(SiriETGooglePubsubUpdaterConfig::create), SIRI_SX_UPDATER(SiriSXUpdaterConfig::create), + SIRI_SX_LITE(SiriSXLiteUpdaterConfig::create), SIRI_AZURE_ET_UPDATER(SiriAzureETUpdaterConfig::create), SIRI_AZURE_SX_UPDATER(SiriAzureSXUpdaterConfig::create); diff --git a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLightUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLiteUpdaterConfig.java similarity index 81% rename from application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLightUpdaterConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLiteUpdaterConfig.java index 3fa40a5f030..0311cf0dd37 100644 --- a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLightUpdaterConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLiteUpdaterConfig.java @@ -4,12 +4,12 @@ import java.time.Duration; import org.opentripplanner.standalone.config.framework.json.NodeAdapter; -import org.opentripplanner.updater.siri.updater.light.SiriETLightUpdaterParameters; +import org.opentripplanner.updater.siri.updater.light.SiriETLiteUpdaterParameters; -public class SiriETLightUpdaterConfig { +public class SiriETLiteUpdaterConfig { - public static SiriETLightUpdaterParameters create(String configRef, NodeAdapter c) { - return new SiriETLightUpdaterParameters( + public static SiriETLiteUpdaterParameters create(String configRef, NodeAdapter c) { + return new SiriETLiteUpdaterParameters( configRef, c.of("feedId").since(V2_7).summary("The ID of the feed to apply the updates to.").asString(), c diff --git a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXLightUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXLiteUpdaterConfig.java similarity index 85% rename from application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXLightUpdaterConfig.java rename to application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXLiteUpdaterConfig.java index 39db86aead5..fbc9d1971c4 100644 --- a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXLightUpdaterConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXLiteUpdaterConfig.java @@ -5,12 +5,12 @@ import java.time.Duration; import org.opentripplanner.standalone.config.framework.json.NodeAdapter; -import org.opentripplanner.updater.siri.updater.light.SiriSXLightUpdaterParameters; +import org.opentripplanner.updater.siri.updater.light.SiriSXLiteUpdaterParameters; -public class SiriSXLightUpdaterConfig { +public class SiriSXLiteUpdaterConfig { - public static SiriSXLightUpdaterParameters create(String configRef, NodeAdapter c) { - return new SiriSXLightUpdaterParameters( + public static SiriSXLiteUpdaterParameters create(String configRef, NodeAdapter c) { + return new SiriSXLiteUpdaterParameters( configRef, c.of("feedId").since(V2_7).summary("The ID of the feed to apply the updates to.").asString(), c diff --git a/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java b/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java index 32a9500236a..c960175ff6e 100644 --- a/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java @@ -8,8 +8,8 @@ import org.opentripplanner.updater.siri.updater.SiriETUpdaterParameters; import org.opentripplanner.updater.siri.updater.SiriSXUpdaterParameters; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdaterParameters; -import org.opentripplanner.updater.siri.updater.light.SiriETLightUpdaterParameters; -import org.opentripplanner.updater.siri.updater.light.SiriSXLightUpdaterParameters; +import org.opentripplanner.updater.siri.updater.light.SiriETLiteUpdaterParameters; +import org.opentripplanner.updater.siri.updater.light.SiriSXLiteUpdaterParameters; import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdaterParameters; import org.opentripplanner.updater.trip.PollingTripUpdaterParameters; import org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters; @@ -35,9 +35,9 @@ public interface UpdatersParameters { List getSiriSXUpdaterParameters(); - List getSiriETLightUpdaterParameters(); + List getSiriETLightUpdaterParameters(); - List getSiriSXLightUpdaterParameters(); + List getSiriSXLightUpdaterParameters(); List getMqttGtfsRealtimeUpdaterParameters(); diff --git a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java index fe0c5af3e4c..c9323d4fc59 100644 --- a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java +++ b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java @@ -25,8 +25,8 @@ import org.opentripplanner.updater.siri.updater.SiriHttpLoader; import org.opentripplanner.updater.siri.updater.SiriSXUpdater; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdater; -import org.opentripplanner.updater.siri.updater.light.SiriETLightHttpTripUpdateSource; -import org.opentripplanner.updater.siri.updater.light.SiriLightHttpLoader; +import org.opentripplanner.updater.siri.updater.light.SiriETLiteHttpTripUpdateSource; +import org.opentripplanner.updater.siri.updater.light.SiriLiteHttpLoader; import org.opentripplanner.updater.spi.GraphUpdater; import org.opentripplanner.updater.spi.TimetableSnapshotFlush; import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdater; @@ -201,7 +201,7 @@ private List createUpdatersFromConfig() { new SiriETUpdater( configItem, provideSiriTimetableSnapshot(), - new SiriETLightHttpTripUpdateSource(configItem.sourceParameters()), + new SiriETLiteHttpTripUpdateSource(configItem.sourceParameters()), TripUpdateMetrics.batch(configItem) ) ); @@ -223,7 +223,7 @@ private List createUpdatersFromConfig() { new SiriSXUpdater( configItem, timetableRepository, - new SiriLightHttpLoader( + new SiriLiteHttpLoader( configItem.uri(), configItem.timeout(), configItem.requestHeaders() diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLiteHttpTripUpdateSource.java similarity index 92% rename from application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLiteHttpTripUpdateSource.java index f60ee8e1c35..1c05a873303 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightHttpTripUpdateSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLiteHttpTripUpdateSource.java @@ -19,9 +19,9 @@ /** * SIRI Light downloads periodically all messages as a single GET request. */ -public class SiriETLightHttpTripUpdateSource implements EstimatedTimetableSource { +public class SiriETLiteHttpTripUpdateSource implements EstimatedTimetableSource { - private static final Logger LOG = LoggerFactory.getLogger(SiriETLightHttpTripUpdateSource.class); + private static final Logger LOG = LoggerFactory.getLogger(SiriETLiteHttpTripUpdateSource.class); /** * The framework code requires a requestor ref but in SIRI Light this is not used. */ @@ -31,7 +31,7 @@ public class SiriETLightHttpTripUpdateSource implements EstimatedTimetableSource private final SiriLoader siriLoader; - public SiriETLightHttpTripUpdateSource(Parameters parameters) { + public SiriETLiteHttpTripUpdateSource(Parameters parameters) { this.parameters = parameters; this.siriLoader = createLoader(parameters); @@ -73,7 +73,7 @@ private static SiriLoader createLoader(Parameters parameters) { } // Fallback to default loader else { - return new SiriLightHttpLoader( + return new SiriLiteHttpLoader( parameters.uri(), parameters.timeout(), parameters.httpRequestHeaders() diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLiteUpdaterParameters.java similarity index 72% rename from application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLiteUpdaterParameters.java index d4aa6fcaa37..6c62e37798f 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLightUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLiteUpdaterParameters.java @@ -5,7 +5,7 @@ import org.opentripplanner.updater.siri.updater.SiriETUpdater; import org.opentripplanner.updater.spi.HttpHeaders; -public record SiriETLightUpdaterParameters( +public record SiriETLiteUpdaterParameters( String configRef, String feedId, URI uri, @@ -14,8 +14,8 @@ public record SiriETLightUpdaterParameters( boolean fuzzyTripMatching, HttpHeaders httpRequestHeaders ) - implements SiriETUpdater.SiriETUpdaterParameters, SiriETLightHttpTripUpdateSource.Parameters { - public SiriETLightHttpTripUpdateSource.Parameters sourceParameters() { + implements SiriETUpdater.SiriETUpdaterParameters, SiriETLiteHttpTripUpdateSource.Parameters { + public SiriETLiteHttpTripUpdateSource.Parameters sourceParameters() { return this; } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriLightHttpLoader.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriLiteHttpLoader.java similarity index 90% rename from application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriLightHttpLoader.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriLiteHttpLoader.java index 45be81d74e2..1737847ce7f 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriLightHttpLoader.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriLiteHttpLoader.java @@ -16,15 +16,15 @@ * Load real-time updates from SIRI-SX and SIRI-ET feeds over HTTP via a single request * that contains all updates. */ -public class SiriLightHttpLoader implements SiriLoader { +public class SiriLiteHttpLoader implements SiriLoader { - private static final Logger LOG = LoggerFactory.getLogger(SiriLightHttpLoader.class); + private static final Logger LOG = LoggerFactory.getLogger(SiriLiteHttpLoader.class); private final HttpHeaders headers; private final URI uri; private final Duration timeout; private final OtpHttpClient otpHttpClient; - public SiriLightHttpLoader(URI uri, Duration timeout, HttpHeaders headers) { + public SiriLiteHttpLoader(URI uri, Duration timeout, HttpHeaders headers) { this.uri = uri; this.timeout = timeout; this.headers = HttpHeaders.of().acceptApplicationXML().add(headers).build(); diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLightUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLiteUpdaterParameters.java similarity index 93% rename from application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLightUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLiteUpdaterParameters.java index 540fee7b919..6c4b666952f 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLightUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLiteUpdaterParameters.java @@ -5,7 +5,7 @@ import org.opentripplanner.updater.siri.updater.SiriSXUpdater; import org.opentripplanner.updater.spi.HttpHeaders; -public record SiriSXLightUpdaterParameters( +public record SiriSXLiteUpdaterParameters( String configRef, String feedId, URI uri, diff --git a/application/src/test/java/org/opentripplanner/generate/doc/SiriConfigDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/SiriConfigDocTest.java index 4119704ba2b..5b65ca228c9 100644 --- a/application/src/test/java/org/opentripplanner/generate/doc/SiriConfigDocTest.java +++ b/application/src/test/java/org/opentripplanner/generate/doc/SiriConfigDocTest.java @@ -32,8 +32,8 @@ public class SiriConfigDocTest { private static final Set INCLUDE_UPDATERS = Set.of( "siri-et-updater", "siri-sx-updater", - "siri-et-light", - "siri-sx-light" + "siri-et-lite", + "siri-sx-lite" ); private static final SkipNodes SKIP_NODES = SkipNodes.of().build(); public static final ObjectMapper mapper = new ObjectMapper(); diff --git a/application/src/test/java/org/opentripplanner/generate/doc/UpdaterConfigDocTest.java b/application/src/test/java/org/opentripplanner/generate/doc/UpdaterConfigDocTest.java index 29097941d01..b88b0a38e80 100644 --- a/application/src/test/java/org/opentripplanner/generate/doc/UpdaterConfigDocTest.java +++ b/application/src/test/java/org/opentripplanner/generate/doc/UpdaterConfigDocTest.java @@ -36,8 +36,8 @@ public class UpdaterConfigDocTest { "siri-et-updater", "siri-et-google-pubsub-updater", "siri-sx-updater", - "siri-et-light", - "siri-sx-light" + "siri-et-lite", + "siri-sx-lite" ); private static final SkipNodes SKIP_NODES = SkipNodes.of().build(); public static final ObjectMapper mapper = new ObjectMapper(); diff --git a/application/src/test/java/org/opentripplanner/updater/siri/updater/light/SiriLightHttpLoaderTest.java b/application/src/test/java/org/opentripplanner/updater/siri/updater/light/SiriLiteHttpLoaderTest.java similarity index 90% rename from application/src/test/java/org/opentripplanner/updater/siri/updater/light/SiriLightHttpLoaderTest.java rename to application/src/test/java/org/opentripplanner/updater/siri/updater/light/SiriLiteHttpLoaderTest.java index 3886d90309a..adef9f242a5 100644 --- a/application/src/test/java/org/opentripplanner/updater/siri/updater/light/SiriLightHttpLoaderTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/updater/light/SiriLiteHttpLoaderTest.java @@ -9,14 +9,14 @@ import org.opentripplanner.updater.spi.HttpHeaders; import uk.org.siri.siri20.NaturalLanguageStringStructure; -class SiriLightHttpLoaderTest { +class SiriLiteHttpLoaderTest { private static final Duration ONE_MIN = Duration.ofMinutes(1); @Test void test() { var uri = ResourceLoader.of(this).uri("siri-sx.xml"); - var loader = new SiriLightHttpLoader(uri, ONE_MIN, HttpHeaders.empty()); + var loader = new SiriLiteHttpLoader(uri, ONE_MIN, HttpHeaders.empty()); var siri = loader.fetchETFeed("OTP"); var delivery = siri.get().getServiceDelivery().getSituationExchangeDeliveries().getFirst(); var element = delivery.getSituations().getPtSituationElements().getFirst(); diff --git a/application/src/test/resources/standalone/config/router-config.json b/application/src/test/resources/standalone/config/router-config.json index 6c27f3e06dd..e4ea29dfd9e 100644 --- a/application/src/test/resources/standalone/config/router-config.json +++ b/application/src/test/resources/standalone/config/router-config.json @@ -433,13 +433,13 @@ "url": "https://transmodel.api.opendatahub.com/siri-lite/fm/parking" }, { - "type": "siri-et-light", + "type": "siri-et-lite", "feedId": "sta", "url": "https://example.com/siri-lite/estimated-timetable/xml", "fuzzyTripMatching": true }, { - "type": "siri-sx-light", + "type": "siri-sx-lite", "feedId": "sta", "url": "https://example.com/siri-lite/situation-exchange/xml" } diff --git a/doc/templates/sandbox/siri/SiriUpdater.md b/doc/templates/sandbox/siri/SiriUpdater.md index d1999e04f7d..bed90ded3a3 100644 --- a/doc/templates/sandbox/siri/SiriUpdater.md +++ b/doc/templates/sandbox/siri/SiriUpdater.md @@ -25,9 +25,9 @@ To enable the SIRI updater you need to add it to the `updaters` section of the ` -### SIRI-ET Light +### SIRI-ET Lite -SIRI Light is [not very well](https://nextcloud.leonard.io/s/2tdYdmYBGtLQMfi/download?path=&files=Proposition-Profil-SIRI-Lite-initial-v1-3%20en.pdf) +SIRI Lite is [not very well](https://nextcloud.leonard.io/s/2tdYdmYBGtLQMfi/download?path=&files=Proposition-Profil-SIRI-Lite-initial-v1-3%20en.pdf) [specified](https://normes.transport.data.gouv.fr/normes/siri/profil-france/#protocoles-d%C3%A9change-des-donn%C3%A9es-siri), but this updater supports the following definition: @@ -35,14 +35,14 @@ Fetching XML-formatted SIRI messages as single GET request rather than the more flow. This means that the XML feed must contain all updates for all trips, just like it is the case for GTFS-RT TripUpdates. - + -### SIRI-SX Light +### SIRI-SX Lite -This updater follows the same definition of SIRI Light as the SIRI-ET one: it downloads the entire +This updater follows the same definition of SIRI Lite as the SIRI-ET one: it downloads the entire feed in a single HTTP GET request. - + ## Changelog diff --git a/doc/user/RouterConfiguration.md b/doc/user/RouterConfiguration.md index d72cdab3d6f..9b6bbf685c4 100644 --- a/doc/user/RouterConfiguration.md +++ b/doc/user/RouterConfiguration.md @@ -877,13 +877,13 @@ Used to group requests when monitoring OTP. "url" : "https://transmodel.api.opendatahub.com/siri-lite/fm/parking" }, { - "type" : "siri-et-light", + "type" : "siri-et-lite", "feedId" : "sta", "url" : "https://example.com/siri-lite/estimated-timetable/xml", "fuzzyTripMatching" : true }, { - "type" : "siri-sx-light", + "type" : "siri-sx-lite", "feedId" : "sta", "url" : "https://example.com/siri-lite/situation-exchange/xml" } diff --git a/doc/user/sandbox/siri/SiriUpdater.md b/doc/user/sandbox/siri/SiriUpdater.md index 5cc2221289c..a6f7781e293 100644 --- a/doc/user/sandbox/siri/SiriUpdater.md +++ b/doc/user/sandbox/siri/SiriUpdater.md @@ -161,9 +161,9 @@ HTTP headers to add to the request. Any header key, value can be inserted. -### SIRI-ET Light +### SIRI-ET Lite -SIRI Light is [not very well](https://nextcloud.leonard.io/s/2tdYdmYBGtLQMfi/download?path=&files=Proposition-Profil-SIRI-Lite-initial-v1-3%20en.pdf) +SIRI Lite is [not very well](https://nextcloud.leonard.io/s/2tdYdmYBGtLQMfi/download?path=&files=Proposition-Profil-SIRI-Lite-initial-v1-3%20en.pdf) [specified](https://normes.transport.data.gouv.fr/normes/siri/profil-france/#protocoles-d%C3%A9change-des-donn%C3%A9es-siri), but this updater supports the following definition: @@ -171,12 +171,12 @@ Fetching XML-formatted SIRI messages as single GET request rather than the more flow. This means that the XML feed must contain all updates for all trips, just like it is the case for GTFS-RT TripUpdates. - + | Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | |----------------------------|:---------------:|----------------------------------------------------------------------------|:----------:|---------------|:-----:| -| type = "siri-et-light" | `enum` | The type of the updater. | *Required* | | 1.5 | +| type = "siri-et-lite" | `enum` | The type of the updater. | *Required* | | 1.5 | | feedId | `string` | The ID of the feed to apply the updates to. | *Required* | | 2.7 | | frequency | `duration` | How often the updates should be retrieved. | *Optional* | `"PT1M"` | 2.7 | | fuzzyTripMatching | `boolean` | If the fuzzy trip matcher should be used to match trips. | *Optional* | `false` | 2.7 | @@ -218,7 +218,7 @@ HTTP headers to add to the request. Any header key, value can be inserted. { "updaters" : [ { - "type" : "siri-et-light", + "type" : "siri-et-lite", "feedId" : "sta", "url" : "https://example.com/siri-lite/estimated-timetable/xml", "fuzzyTripMatching" : true @@ -227,19 +227,19 @@ HTTP headers to add to the request. Any header key, value can be inserted. } ``` - + -### SIRI-SX Light +### SIRI-SX Lite -This updater follows the same definition of SIRI Light as the SIRI-ET one: it downloads the entire +This updater follows the same definition of SIRI Lite as the SIRI-ET one: it downloads the entire feed in a single HTTP GET request. - + | Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | |----------------------------------|:---------------:|----------------------------------------------------------------------------|:----------:|---------------|:-----:| -| type = "siri-sx-light" | `enum` | The type of the updater. | *Required* | | 1.5 | +| type = "siri-sx-lite" | `enum` | The type of the updater. | *Required* | | 1.5 | | [earlyStart](#u__16__earlyStart) | `duration` | This value is subtracted from the actual validity defined in the message. | *Optional* | `"PT0S"` | 2.0 | | feedId | `string` | The ID of the feed to apply the updates to. | *Required* | | 2.7 | | frequency | `duration` | How often the updates should be retrieved. | *Optional* | `"PT1M"` | 2.7 | @@ -292,7 +292,7 @@ HTTP headers to add to the request. Any header key, value can be inserted. { "updaters" : [ { - "type" : "siri-sx-light", + "type" : "siri-sx-lite", "feedId" : "sta", "url" : "https://example.com/siri-lite/situation-exchange/xml" } @@ -300,7 +300,7 @@ HTTP headers to add to the request. Any header key, value can be inserted. } ``` - + ## Changelog From f7e30ec948771b4d7d8d1385915ee87565bbd0db Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 4 Dec 2024 11:36:30 +0100 Subject: [PATCH 15/60] Change package name --- .../standalone/config/routerconfig/UpdatersConfig.java | 4 ++-- .../config/routerconfig/updaters/SiriETLiteUpdaterConfig.java | 2 +- .../config/routerconfig/updaters/SiriSXLiteUpdaterConfig.java | 2 +- .../java/org/opentripplanner/updater/UpdatersParameters.java | 4 ++-- .../updater/configure/UpdaterConfigurator.java | 4 ++-- .../{light => lite}/SiriETLiteHttpTripUpdateSource.java | 2 +- .../updater/{light => lite}/SiriETLiteUpdaterParameters.java | 2 +- .../siri/updater/{light => lite}/SiriLiteHttpLoader.java | 2 +- .../updater/{light => lite}/SiriSXLiteUpdaterParameters.java | 2 +- .../siri/updater/{light => lite}/SiriLiteHttpLoaderTest.java | 2 +- .../updater/siri/updater/{light => lite}/siri-sx.xml | 0 11 files changed, 13 insertions(+), 13 deletions(-) rename application/src/main/java/org/opentripplanner/updater/siri/updater/{light => lite}/SiriETLiteHttpTripUpdateSource.java (97%) rename application/src/main/java/org/opentripplanner/updater/siri/updater/{light => lite}/SiriETLiteUpdaterParameters.java (92%) rename application/src/main/java/org/opentripplanner/updater/siri/updater/{light => lite}/SiriLiteHttpLoader.java (96%) rename application/src/main/java/org/opentripplanner/updater/siri/updater/{light => lite}/SiriSXLiteUpdaterParameters.java (91%) rename application/src/test/java/org/opentripplanner/updater/siri/updater/{light => lite}/SiriLiteHttpLoaderTest.java (95%) rename application/src/test/resources/org/opentripplanner/updater/siri/updater/{light => lite}/siri-sx.xml (100%) diff --git a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java index 1ee1d8bbf09..c2773dbcd46 100644 --- a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java @@ -48,8 +48,8 @@ import org.opentripplanner.updater.siri.updater.SiriETUpdaterParameters; import org.opentripplanner.updater.siri.updater.SiriSXUpdaterParameters; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdaterParameters; -import org.opentripplanner.updater.siri.updater.light.SiriETLiteUpdaterParameters; -import org.opentripplanner.updater.siri.updater.light.SiriSXLiteUpdaterParameters; +import org.opentripplanner.updater.siri.updater.lite.SiriETLiteUpdaterParameters; +import org.opentripplanner.updater.siri.updater.lite.SiriSXLiteUpdaterParameters; import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdaterParameters; import org.opentripplanner.updater.trip.PollingTripUpdaterParameters; import org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters; diff --git a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLiteUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLiteUpdaterConfig.java index 0311cf0dd37..b26bdd2a727 100644 --- a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLiteUpdaterConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriETLiteUpdaterConfig.java @@ -4,7 +4,7 @@ import java.time.Duration; import org.opentripplanner.standalone.config.framework.json.NodeAdapter; -import org.opentripplanner.updater.siri.updater.light.SiriETLiteUpdaterParameters; +import org.opentripplanner.updater.siri.updater.lite.SiriETLiteUpdaterParameters; public class SiriETLiteUpdaterConfig { diff --git a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXLiteUpdaterConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXLiteUpdaterConfig.java index fbc9d1971c4..27c1bcba0be 100644 --- a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXLiteUpdaterConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/updaters/SiriSXLiteUpdaterConfig.java @@ -5,7 +5,7 @@ import java.time.Duration; import org.opentripplanner.standalone.config.framework.json.NodeAdapter; -import org.opentripplanner.updater.siri.updater.light.SiriSXLiteUpdaterParameters; +import org.opentripplanner.updater.siri.updater.lite.SiriSXLiteUpdaterParameters; public class SiriSXLiteUpdaterConfig { diff --git a/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java b/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java index c960175ff6e..cfe0a12c8cc 100644 --- a/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java @@ -8,8 +8,8 @@ import org.opentripplanner.updater.siri.updater.SiriETUpdaterParameters; import org.opentripplanner.updater.siri.updater.SiriSXUpdaterParameters; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdaterParameters; -import org.opentripplanner.updater.siri.updater.light.SiriETLiteUpdaterParameters; -import org.opentripplanner.updater.siri.updater.light.SiriSXLiteUpdaterParameters; +import org.opentripplanner.updater.siri.updater.lite.SiriETLiteUpdaterParameters; +import org.opentripplanner.updater.siri.updater.lite.SiriSXLiteUpdaterParameters; import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdaterParameters; import org.opentripplanner.updater.trip.PollingTripUpdaterParameters; import org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters; diff --git a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java index c9323d4fc59..283197585fe 100644 --- a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java +++ b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java @@ -25,8 +25,8 @@ import org.opentripplanner.updater.siri.updater.SiriHttpLoader; import org.opentripplanner.updater.siri.updater.SiriSXUpdater; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdater; -import org.opentripplanner.updater.siri.updater.light.SiriETLiteHttpTripUpdateSource; -import org.opentripplanner.updater.siri.updater.light.SiriLiteHttpLoader; +import org.opentripplanner.updater.siri.updater.lite.SiriETLiteHttpTripUpdateSource; +import org.opentripplanner.updater.siri.updater.lite.SiriLiteHttpLoader; import org.opentripplanner.updater.spi.GraphUpdater; import org.opentripplanner.updater.spi.TimetableSnapshotFlush; import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdater; diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLiteHttpTripUpdateSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteHttpTripUpdateSource.java similarity index 97% rename from application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLiteHttpTripUpdateSource.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteHttpTripUpdateSource.java index 1c05a873303..92428b85aad 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLiteHttpTripUpdateSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteHttpTripUpdateSource.java @@ -1,4 +1,4 @@ -package org.opentripplanner.updater.siri.updater.light; +package org.opentripplanner.updater.siri.updater.lite; import static org.opentripplanner.updater.trip.UpdateIncrementality.FULL_DATASET; diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLiteUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteUpdaterParameters.java similarity index 92% rename from application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLiteUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteUpdaterParameters.java index 6c62e37798f..9dd1e31a2b5 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriETLiteUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteUpdaterParameters.java @@ -1,4 +1,4 @@ -package org.opentripplanner.updater.siri.updater.light; +package org.opentripplanner.updater.siri.updater.lite; import java.net.URI; import java.time.Duration; diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriLiteHttpLoader.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriLiteHttpLoader.java similarity index 96% rename from application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriLiteHttpLoader.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriLiteHttpLoader.java index 1737847ce7f..c9b35be7b19 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriLiteHttpLoader.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriLiteHttpLoader.java @@ -1,4 +1,4 @@ -package org.opentripplanner.updater.siri.updater.light; +package org.opentripplanner.updater.siri.updater.lite; import java.net.URI; import java.time.Duration; diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLiteUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriSXLiteUpdaterParameters.java similarity index 91% rename from application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLiteUpdaterParameters.java rename to application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriSXLiteUpdaterParameters.java index 6c4b666952f..e2f6a7a63eb 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/light/SiriSXLiteUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriSXLiteUpdaterParameters.java @@ -1,4 +1,4 @@ -package org.opentripplanner.updater.siri.updater.light; +package org.opentripplanner.updater.siri.updater.lite; import java.net.URI; import java.time.Duration; diff --git a/application/src/test/java/org/opentripplanner/updater/siri/updater/light/SiriLiteHttpLoaderTest.java b/application/src/test/java/org/opentripplanner/updater/siri/updater/lite/SiriLiteHttpLoaderTest.java similarity index 95% rename from application/src/test/java/org/opentripplanner/updater/siri/updater/light/SiriLiteHttpLoaderTest.java rename to application/src/test/java/org/opentripplanner/updater/siri/updater/lite/SiriLiteHttpLoaderTest.java index adef9f242a5..c05e248747a 100644 --- a/application/src/test/java/org/opentripplanner/updater/siri/updater/light/SiriLiteHttpLoaderTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/updater/lite/SiriLiteHttpLoaderTest.java @@ -1,4 +1,4 @@ -package org.opentripplanner.updater.siri.updater.light; +package org.opentripplanner.updater.siri.updater.lite; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/application/src/test/resources/org/opentripplanner/updater/siri/updater/light/siri-sx.xml b/application/src/test/resources/org/opentripplanner/updater/siri/updater/lite/siri-sx.xml similarity index 100% rename from application/src/test/resources/org/opentripplanner/updater/siri/updater/light/siri-sx.xml rename to application/src/test/resources/org/opentripplanner/updater/siri/updater/lite/siri-sx.xml From ee0e79d06e21ed96d93db861e8f7494f1512ee25 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 4 Dec 2024 11:37:14 +0100 Subject: [PATCH 16/60] More spelling correction --- .../standalone/config/routerconfig/UpdatersConfig.java | 4 ++-- .../java/org/opentripplanner/updater/UpdatersParameters.java | 4 ++-- .../updater/configure/UpdaterConfigurator.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java index c2773dbcd46..a71d5ee40f8 100644 --- a/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java +++ b/application/src/main/java/org/opentripplanner/standalone/config/routerconfig/UpdatersConfig.java @@ -189,12 +189,12 @@ public List getSiriSXUpdaterParameters() { } @Override - public List getSiriETLightUpdaterParameters() { + public List getSiriETLiteUpdaterParameters() { return getParameters(SIRI_ET_LITE); } @Override - public List getSiriSXLightUpdaterParameters() { + public List getSiriSXLiteUpdaterParameters() { return getParameters(SIRI_SX_LITE); } diff --git a/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java b/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java index cfe0a12c8cc..cb613580495 100644 --- a/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/UpdatersParameters.java @@ -35,9 +35,9 @@ public interface UpdatersParameters { List getSiriSXUpdaterParameters(); - List getSiriETLightUpdaterParameters(); + List getSiriETLiteUpdaterParameters(); - List getSiriSXLightUpdaterParameters(); + List getSiriSXLiteUpdaterParameters(); List getMqttGtfsRealtimeUpdaterParameters(); diff --git a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java index 283197585fe..6c628d11a0e 100644 --- a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java +++ b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java @@ -196,7 +196,7 @@ private List createUpdatersFromConfig() { ) ); } - for (var configItem : updatersParameters.getSiriETLightUpdaterParameters()) { + for (var configItem : updatersParameters.getSiriETLiteUpdaterParameters()) { updaters.add( new SiriETUpdater( configItem, @@ -218,7 +218,7 @@ private List createUpdatersFromConfig() { ) ); } - for (var configItem : updatersParameters.getSiriSXLightUpdaterParameters()) { + for (var configItem : updatersParameters.getSiriSXLiteUpdaterParameters()) { updaters.add( new SiriSXUpdater( configItem, From be21d1a08e10a765be1f24692f2f86d8430be811 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Mon, 9 Dec 2024 12:55:40 +0100 Subject: [PATCH 17/60] Fix spelling of 'Lite' Co-authored-by: Henrik Abrahamsson <127481124+habrahamsson-skanetrafiken@users.noreply.github.com> --- .../siri/updater/lite/SiriETLiteHttpTripUpdateSource.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteHttpTripUpdateSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteHttpTripUpdateSource.java index 92428b85aad..d6eef736a33 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteHttpTripUpdateSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteHttpTripUpdateSource.java @@ -17,13 +17,13 @@ import uk.org.siri.siri20.Siri; /** - * SIRI Light downloads periodically all messages as a single GET request. + * SIRI Lite downloads periodically all messages as a single GET request. */ public class SiriETLiteHttpTripUpdateSource implements EstimatedTimetableSource { private static final Logger LOG = LoggerFactory.getLogger(SiriETLiteHttpTripUpdateSource.class); /** - * The framework code requires a requestor ref but in SIRI Light this is not used. + * The framework code requires a requestor ref but in SIRI Lite this is not used. */ private static final String DUMMY_REQUESTOR_REF = "OpenTripPlanner"; From 6e17055eff27179f637a5f2cb6e11b868713e099 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 11 Dec 2024 17:59:09 +0100 Subject: [PATCH 18/60] Update application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java Co-authored-by: Thomas Gran --- .../org/opentripplanner/updater/siri/updater/SiriETUpdater.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java index f1d3941cf46..7dfd596dd21 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java @@ -99,7 +99,7 @@ public void runPolling() { @Override public String toString() { return ToStringBuilder - .of(this.getClass()) + .of(SiriETUpdater.class) .addStr("source", updateSource.toString()) .addDuration("frequency", pollingPeriod()) .toString(); From 497422364d0d128fc94085a724ede853c1bffa25 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 11 Dec 2024 18:00:49 +0100 Subject: [PATCH 19/60] Update application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETHttpTripUpdateSource.java Co-authored-by: Thomas Gran --- .../updater/siri/updater/SiriETHttpTripUpdateSource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETHttpTripUpdateSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETHttpTripUpdateSource.java index c16ede42ac3..886b338f470 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETHttpTripUpdateSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETHttpTripUpdateSource.java @@ -78,7 +78,7 @@ public UpdateIncrementality incrementalityOfLastUpdates() { @Override public String toString() { - return ToStringBuilder.of(this.getClass()).addStr("url", url).toString(); + return ToStringBuilder.of(SiriETHttpTripUpdateSource.class).addStr("url", url).toString(); } private static SiriLoader createLoader(String url, Parameters parameters) { From ed76a4da3ca1ed9ee1c548829f3ed7e92dbdd897 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 11 Dec 2024 18:01:30 +0100 Subject: [PATCH 20/60] Don't use getClass() --- .../org/opentripplanner/updater/siri/updater/SiriSXUpdater.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java index 253338161fb..d4ad863c207 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java @@ -97,7 +97,7 @@ protected void runPolling() throws InterruptedException { @Override public String toString() { return ToStringBuilder - .of(this.getClass()) + .of(SiriSXUpdater.class) .addStr("url", url) .addDuration("frequency", pollingPeriod()) .toString(); From 3b06b85bb1df699b5ecb4170a8b9765c880c892a Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 11 Dec 2024 18:07:45 +0100 Subject: [PATCH 21/60] Use shorter name for parameters --- .../opentripplanner/updater/siri/updater/SiriETUpdater.java | 5 ++--- .../updater/siri/updater/SiriETUpdaterParameters.java | 2 +- .../siri/updater/lite/SiriETLiteUpdaterParameters.java | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java index 7dfd596dd21..f9a982fb468 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java @@ -40,7 +40,7 @@ public class SiriETUpdater extends PollingGraphUpdater { private final Consumer metricsConsumer; public SiriETUpdater( - SiriETUpdaterParameters config, + Parameters config, SiriTimetableSnapshotSource timetableSnapshotSource, EstimatedTimetableSource source, Consumer metricsConsumer @@ -105,8 +105,7 @@ public String toString() { .toString(); } - public interface SiriETUpdaterParameters - extends UrlUpdaterParameters, PollingGraphUpdaterParameters { + public interface Parameters extends UrlUpdaterParameters, PollingGraphUpdaterParameters { boolean blockReadinessUntilInitialized(); boolean fuzzyTripMatching(); diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java index a3477e3854e..71217225da1 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdaterParameters.java @@ -16,7 +16,7 @@ public record SiriETUpdaterParameters( HttpHeaders httpRequestHeaders, boolean producerMetrics ) - implements SiriETUpdater.SiriETUpdaterParameters, SiriETHttpTripUpdateSource.Parameters { + implements SiriETUpdater.Parameters, SiriETHttpTripUpdateSource.Parameters { public SiriETHttpTripUpdateSource.Parameters sourceParameters() { return this; } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteUpdaterParameters.java index 9dd1e31a2b5..1eed702e625 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteUpdaterParameters.java @@ -14,7 +14,7 @@ public record SiriETLiteUpdaterParameters( boolean fuzzyTripMatching, HttpHeaders httpRequestHeaders ) - implements SiriETUpdater.SiriETUpdaterParameters, SiriETLiteHttpTripUpdateSource.Parameters { + implements SiriETUpdater.Parameters, SiriETLiteHttpTripUpdateSource.Parameters { public SiriETLiteHttpTripUpdateSource.Parameters sourceParameters() { return this; } From 71fae3dfc4742e4e2e1d1e425014515c1852a7fb Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 11 Dec 2024 18:10:37 +0100 Subject: [PATCH 22/60] Use shorter name for SIRI-SX --- .../opentripplanner/updater/siri/updater/SiriSXUpdater.java | 5 ++--- .../updater/siri/updater/SiriSXUpdaterParameters.java | 2 +- .../siri/updater/lite/SiriSXLiteUpdaterParameters.java | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java index d4ad863c207..edfdf0d878d 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java @@ -47,7 +47,7 @@ public class SiriSXUpdater extends PollingGraphUpdater implements TransitAlertPr private final OtpRetry retry; public SiriSXUpdater( - SiriSXUpdaterParameters config, + Parameters config, TimetableRepository timetableRepository, SiriLoader siriLoader ) { @@ -208,8 +208,7 @@ private void updateRequestorRef() { requestorRef = originalRequestorRef + "-retry-" + retryCount; } - public interface SiriSXUpdaterParameters - extends PollingGraphUpdaterParameters, UrlUpdaterParameters { + public interface Parameters extends PollingGraphUpdaterParameters, UrlUpdaterParameters { String requestorRef(); boolean blockReadinessUntilInitialized(); diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdaterParameters.java index 539e1333fa8..d1796557658 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdaterParameters.java @@ -14,4 +14,4 @@ public record SiriSXUpdaterParameters( boolean blockReadinessUntilInitialized, HttpHeaders requestHeaders ) - implements SiriSXUpdater.SiriSXUpdaterParameters {} + implements SiriSXUpdater.Parameters {} diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriSXLiteUpdaterParameters.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriSXLiteUpdaterParameters.java index e2f6a7a63eb..5c48ca3e04b 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriSXLiteUpdaterParameters.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriSXLiteUpdaterParameters.java @@ -14,7 +14,7 @@ public record SiriSXLiteUpdaterParameters( Duration timeout, HttpHeaders requestHeaders ) - implements SiriSXUpdater.SiriSXUpdaterParameters { + implements SiriSXUpdater.Parameters { @Override public String requestorRef() { return "OpenTripPlanner"; From 790bdc63f7f227811865bb51bbec2a2df760c663 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 11 Dec 2024 21:40:34 +0100 Subject: [PATCH 23/60] Build SIRI loader in factory, inject into source --- .../configure/UpdaterConfigurator.java | 11 ++++-- .../updater/SiriETHttpTripUpdateSource.java | 20 ++--------- .../updater/siri/updater/SiriETUpdater.java | 4 +++ .../siri/updater/SiriLoaderFactory.java | 34 +++++++++++++++++++ .../lite/SiriETLiteHttpTripUpdateSource.java | 21 ++---------- 5 files changed, 51 insertions(+), 39 deletions(-) create mode 100644 application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLoaderFactory.java diff --git a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java index 6c628d11a0e..82902f447d3 100644 --- a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java +++ b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java @@ -23,6 +23,7 @@ import org.opentripplanner.updater.siri.updater.SiriETHttpTripUpdateSource; import org.opentripplanner.updater.siri.updater.SiriETUpdater; import org.opentripplanner.updater.siri.updater.SiriHttpLoader; +import org.opentripplanner.updater.siri.updater.SiriLoaderFactory; import org.opentripplanner.updater.siri.updater.SiriSXUpdater; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdater; import org.opentripplanner.updater.siri.updater.lite.SiriETLiteHttpTripUpdateSource; @@ -191,7 +192,10 @@ private List createUpdatersFromConfig() { new SiriETUpdater( configItem, provideSiriTimetableSnapshot(), - new SiriETHttpTripUpdateSource(configItem.sourceParameters()), + new SiriETHttpTripUpdateSource( + configItem.sourceParameters(), + SiriLoaderFactory.createLoader(configItem) + ), TripUpdateMetrics.streaming(configItem) ) ); @@ -201,7 +205,10 @@ private List createUpdatersFromConfig() { new SiriETUpdater( configItem, provideSiriTimetableSnapshot(), - new SiriETLiteHttpTripUpdateSource(configItem.sourceParameters()), + new SiriETLiteHttpTripUpdateSource( + configItem.sourceParameters(), + SiriLoaderFactory.createLoader(configItem) + ), TripUpdateMetrics.batch(configItem) ) ); diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETHttpTripUpdateSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETHttpTripUpdateSource.java index 886b338f470..9d0373e1a16 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETHttpTripUpdateSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETHttpTripUpdateSource.java @@ -31,7 +31,7 @@ public class SiriETHttpTripUpdateSource implements EstimatedTimetableSource { private UpdateIncrementality updateIncrementality = FULL_DATASET; private ZonedDateTime lastTimestamp = ZonedDateTime.now().minusMonths(1); - public SiriETHttpTripUpdateSource(Parameters parameters) { + public SiriETHttpTripUpdateSource(Parameters parameters, SiriLoader siriLoader) { this.url = parameters.url(); this.requestorRef = @@ -39,7 +39,7 @@ public SiriETHttpTripUpdateSource(Parameters parameters) { ? "otp-" + UUID.randomUUID() : parameters.requestorRef(); - this.siriLoader = createLoader(url, parameters); + this.siriLoader = siriLoader; } @Override @@ -81,22 +81,6 @@ public String toString() { return ToStringBuilder.of(SiriETHttpTripUpdateSource.class).addStr("url", url).toString(); } - private static SiriLoader createLoader(String url, Parameters parameters) { - // Load real-time updates from a file. - if (SiriFileLoader.matchesUrl(url)) { - return new SiriFileLoader(url); - } - // Fallback to default loader - else { - return new SiriHttpLoader( - url, - parameters.timeout(), - parameters.httpRequestHeaders(), - parameters.previewInterval() - ); - } - } - public interface Parameters { String url(); diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java index f9a982fb468..e4b946bf21d 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java @@ -3,6 +3,8 @@ import java.util.List; import java.util.function.Consumer; import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; +import org.opentripplanner.updater.siri.updater.lite.SiriETLiteHttpTripUpdateSource; +import org.opentripplanner.updater.siri.updater.lite.SiriETLiteUpdaterParameters; import org.opentripplanner.updater.spi.PollingGraphUpdater; import org.opentripplanner.updater.spi.PollingGraphUpdaterParameters; import org.opentripplanner.updater.spi.ResultLogger; @@ -106,6 +108,8 @@ public String toString() { } public interface Parameters extends UrlUpdaterParameters, PollingGraphUpdaterParameters { + String url(); + boolean blockReadinessUntilInitialized(); boolean fuzzyTripMatching(); diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLoaderFactory.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLoaderFactory.java new file mode 100644 index 00000000000..b9b43d9341e --- /dev/null +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLoaderFactory.java @@ -0,0 +1,34 @@ +package org.opentripplanner.updater.siri.updater; + +import org.opentripplanner.updater.siri.updater.lite.SiriETLiteUpdaterParameters; +import org.opentripplanner.updater.siri.updater.lite.SiriLiteHttpLoader; + +/** + * Constructs a SiriLoader from the parameters of the updater. + */ +public class SiriLoaderFactory { + + public static SiriLoader createLoader(SiriETUpdater.Parameters parameters) { + // Load real-time updates from a file. + if (SiriFileLoader.matchesUrl(parameters.url())) { + return new SiriFileLoader(parameters.url()); + } + // Fallback to default loader + else { + return switch (parameters) { + case SiriETUpdaterParameters p -> new SiriHttpLoader( + p.url(), + p.timeout(), + p.httpRequestHeaders(), + p.previewInterval() + ); + case SiriETLiteUpdaterParameters p -> new SiriLiteHttpLoader( + p.uri(), + p.timeout(), + p.httpRequestHeaders() + ); + default -> throw new IllegalArgumentException("Unexpected value: " + parameters); + }; + } + } +} diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteHttpTripUpdateSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteHttpTripUpdateSource.java index d6eef736a33..7a1e8c988f2 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteHttpTripUpdateSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteHttpTripUpdateSource.java @@ -7,7 +7,6 @@ import java.util.Optional; import org.opentripplanner.framework.io.OtpHttpClientException; import org.opentripplanner.updater.siri.updater.EstimatedTimetableSource; -import org.opentripplanner.updater.siri.updater.SiriFileLoader; import org.opentripplanner.updater.siri.updater.SiriLoader; import org.opentripplanner.updater.spi.HttpHeaders; import org.opentripplanner.updater.trip.UpdateIncrementality; @@ -31,10 +30,9 @@ public class SiriETLiteHttpTripUpdateSource implements EstimatedTimetableSource private final SiriLoader siriLoader; - public SiriETLiteHttpTripUpdateSource(Parameters parameters) { + public SiriETLiteHttpTripUpdateSource(Parameters parameters, SiriLoader siriLoader) { this.parameters = parameters; - - this.siriLoader = createLoader(parameters); + this.siriLoader = siriLoader; } @Override @@ -66,21 +64,6 @@ public String toString() { .toString(); } - private static SiriLoader createLoader(Parameters parameters) { - // Load real-time updates from a file. - if (SiriFileLoader.matchesUrl(parameters.uri().toString())) { - return new SiriFileLoader(parameters.uri().toString()); - } - // Fallback to default loader - else { - return new SiriLiteHttpLoader( - parameters.uri(), - parameters.timeout(), - parameters.httpRequestHeaders() - ); - } - } - public interface Parameters { URI uri(); From ec9e7246e72aee18a91ecad61f560a46d53ba2a8 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 11 Dec 2024 21:53:45 +0100 Subject: [PATCH 24/60] Fix spelling of SIRI-ET --- .../org/opentripplanner/updater/siri/updater/SiriETUpdater.java | 2 +- .../siri/updater/lite/SiriETLiteHttpTripUpdateSource.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java index e4b946bf21d..db60b34f55a 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java @@ -54,7 +54,7 @@ public SiriETUpdater( this.blockReadinessUntilInitialized = config.blockReadinessUntilInitialized(); - LOG.info("Creating SIRI ET updater running every {}: {}", pollingPeriod(), updateSource); + LOG.info("Creating SIRI-ET updater running every {}: {}", pollingPeriod(), updateSource); estimatedTimetableHandler = new EstimatedTimetableHandler(timetableSnapshotSource, config.fuzzyTripMatching(), feedId); diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteHttpTripUpdateSource.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteHttpTripUpdateSource.java index 7a1e8c988f2..30801a64c7f 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteHttpTripUpdateSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/lite/SiriETLiteHttpTripUpdateSource.java @@ -16,7 +16,7 @@ import uk.org.siri.siri20.Siri; /** - * SIRI Lite downloads periodically all messages as a single GET request. + * SIRI Lite periodically downloads all messages as a single GET request. */ public class SiriETLiteHttpTripUpdateSource implements EstimatedTimetableSource { From 0944921250cfc2a36d422a24c9af341865162ad0 Mon Sep 17 00:00:00 2001 From: Michael Tsang Date: Thu, 12 Dec 2024 10:41:40 +0000 Subject: [PATCH 25/60] extract future handling logic to a new method --- .../updater/alert/GtfsRealtimeAlertsUpdater.java | 8 +++++--- .../opentripplanner/updater/spi/PollingGraphUpdater.java | 7 +++++++ .../opentripplanner/updater/trip/PollingTripUpdater.java | 2 +- .../VehicleParkingAvailabilityUpdater.java | 2 +- .../updater/vehicle_parking/VehicleParkingUpdater.java | 2 +- .../vehicle_position/PollingVehiclePositionUpdater.java | 2 +- .../updater/vehicle_rental/VehicleRentalUpdater.java | 2 +- 7 files changed, 17 insertions(+), 8 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java index 0e7ab35cb13..bd20d8ddcc3 100644 --- a/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java @@ -82,9 +82,11 @@ protected void runPolling() throws InterruptedException, ExecutionException { } // Handle update in graph writer runnable - saveResultOnGraph - .execute(context -> updateHandler.update(feed, context.gtfsRealtimeFuzzyTripMatcher())) - .get(); + processGraphUpdaterResult( + saveResultOnGraph.execute(context -> + updateHandler.update(feed, context.gtfsRealtimeFuzzyTripMatcher()) + ) + ); lastTimestamp = feedTimestamp; } diff --git a/application/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdater.java b/application/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdater.java index e0859371de8..21eb60c2737 100644 --- a/application/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdater.java @@ -2,6 +2,8 @@ import java.time.Duration; import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -100,4 +102,9 @@ public String getConfigRef() { * with pauses in between. The length of the pause is defined in the preference frequency. */ protected abstract void runPolling() throws Exception; + + protected void processGraphUpdaterResult(Future result) + throws ExecutionException, InterruptedException { + result.get(); + } } diff --git a/application/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdater.java b/application/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdater.java index 42f24031839..1f88044d51a 100644 --- a/application/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdater.java @@ -90,7 +90,7 @@ public void runPolling() throws InterruptedException, ExecutionException { feedId, recordMetrics ); - saveResultOnGraph.execute(runnable).get(); + processGraphUpdaterResult(saveResultOnGraph.execute(runnable)); } } diff --git a/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdater.java index 64f8ca81763..c65ff7bc4c1 100644 --- a/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdater.java @@ -55,7 +55,7 @@ protected void runPolling() throws InterruptedException, ExecutionException { var updates = source.getUpdates(); var graphWriterRunnable = new AvailabilityUpdater(updates); - saveResultOnGraph.execute(graphWriterRunnable).get(); + processGraphUpdaterResult(saveResultOnGraph.execute(graphWriterRunnable)); } } diff --git a/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdater.java index 4116486ee2d..ea356200f3b 100644 --- a/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdater.java @@ -82,7 +82,7 @@ protected void runPolling() throws InterruptedException, ExecutionException { VehicleParkingGraphWriterRunnable graphWriterRunnable = new VehicleParkingGraphWriterRunnable( vehicleParkings ); - saveResultOnGraph.execute(graphWriterRunnable).get(); + processGraphUpdaterResult(saveResultOnGraph.execute(graphWriterRunnable)); } private class VehicleParkingGraphWriterRunnable implements GraphWriterRunnable { diff --git a/application/src/main/java/org/opentripplanner/updater/vehicle_position/PollingVehiclePositionUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_position/PollingVehiclePositionUpdater.java index a4d36f1d1c3..c787989c5d2 100644 --- a/application/src/main/java/org/opentripplanner/updater/vehicle_position/PollingVehiclePositionUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_position/PollingVehiclePositionUpdater.java @@ -78,7 +78,7 @@ public void runPolling() throws InterruptedException, ExecutionException { fuzzyTripMatching, updates ); - saveResultOnGraph.execute(runnable).get(); + processGraphUpdaterResult(saveResultOnGraph.execute(runnable)); } } diff --git a/application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java index c8030e5492a..efcf9812feb 100644 --- a/application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java @@ -139,7 +139,7 @@ protected void runPolling() throws InterruptedException, ExecutionException { stations, geofencingZones ); - saveResultOnGraph.execute(graphWriterRunnable).get(); + processGraphUpdaterResult(saveResultOnGraph.execute(graphWriterRunnable)); } private class VehicleRentalGraphWriterRunnable implements GraphWriterRunnable { From 4df65a19cc68d495e5aedfecea0b134b798c39eb Mon Sep 17 00:00:00 2001 From: Michael Tsang Date: Thu, 12 Dec 2024 10:55:00 +0000 Subject: [PATCH 26/60] add feature flag --- .../opentripplanner/framework/application/OTPFeature.java | 6 ++++++ doc/user/Configuration.md | 1 + 2 files changed, 7 insertions(+) diff --git a/application/src/main/java/org/opentripplanner/framework/application/OTPFeature.java b/application/src/main/java/org/opentripplanner/framework/application/OTPFeature.java index 6631287613b..add5d690e2e 100644 --- a/application/src/main/java/org/opentripplanner/framework/application/OTPFeature.java +++ b/application/src/main/java/org/opentripplanner/framework/application/OTPFeature.java @@ -97,6 +97,12 @@ public enum OTPFeature { false, "Whether the @async annotation in the GraphQL schema should lead to the fetch being executed asynchronously. This allows batch or alias queries to run in parallel at the cost of consuming extra threads." ), + WaitForGraphUpdateInPollingUpdaters( + true, + false, + "Make all polling updaters wait for graph updates to complete before finishing. " + + "If this is not enabled, the updaters will finish after submitting the task to update the graph." + ), Co2Emissions(false, true, "Enable the emissions sandbox module."), DataOverlay( false, diff --git a/doc/user/Configuration.md b/doc/user/Configuration.md index f80966b8cb3..1d65c2af939 100644 --- a/doc/user/Configuration.md +++ b/doc/user/Configuration.md @@ -238,6 +238,7 @@ Here is a list of all features which can be toggled on/off and their default val | `TransmodelGraphQlApi` | Enable the [Transmodel (NeTEx) GraphQL API](apis/TransmodelApi.md). | ✓️ | ✓️ | | `ActuatorAPI` | Endpoint for actuators (service health status). | | ✓️ | | `AsyncGraphQLFetchers` | Whether the @async annotation in the GraphQL schema should lead to the fetch being executed asynchronously. This allows batch or alias queries to run in parallel at the cost of consuming extra threads. | | | +| `WaitForGraphUpdateInPollingUpdaters` | Make all polling updaters wait for graph updates to complete before finishing. If this is not enabled, the updaters will finish after submitting the task to update the graph. | ✓️ | | | `Co2Emissions` | Enable the emissions sandbox module. | | ✓️ | | `DataOverlay` | Enable usage of data overlay when calculating costs for the street network. | | ✓️ | | `FaresV2` | Enable import of GTFS-Fares v2 data. | | ✓️ | From d8a34ddcfe80dabfba1c08a47f95adaa900d643d Mon Sep 17 00:00:00 2001 From: Michael Tsang Date: Thu, 12 Dec 2024 12:50:06 +0000 Subject: [PATCH 27/60] refactor update graph logic to PollingGraphUpdater --- .../updater/alert/GtfsRealtimeAlertsUpdater.java | 12 +----------- .../updater/siri/updater/SiriETUpdater.java | 9 --------- .../updater/siri/updater/SiriSXUpdater.java | 9 +-------- .../updater/spi/PollingGraphUpdater.java | 15 ++++++++++++--- .../updater/trip/PollingTripUpdater.java | 12 +----------- .../VehicleParkingAvailabilityUpdater.java | 10 +--------- .../vehicle_parking/VehicleParkingUpdater.java | 9 +-------- .../PollingVehiclePositionUpdater.java | 12 +----------- .../vehicle_rental/VehicleRentalUpdater.java | 10 +--------- 9 files changed, 19 insertions(+), 79 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java index bd20d8ddcc3..b217c60a05b 100644 --- a/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java @@ -27,7 +27,6 @@ public class GtfsRealtimeAlertsUpdater extends PollingGraphUpdater implements Tr private final TransitAlertService transitAlertService; private final HttpHeaders headers; private final OtpHttpClient otpHttpClient; - private WriteToGraphCallback saveResultOnGraph; private Long lastTimestamp = Long.MIN_VALUE; public GtfsRealtimeAlertsUpdater( @@ -49,11 +48,6 @@ public GtfsRealtimeAlertsUpdater( LOG.info("Creating real-time alert updater running every {}: {}", pollingPeriod(), url); } - @Override - public void setup(WriteToGraphCallback writeToGraphCallback) { - this.saveResultOnGraph = writeToGraphCallback; - } - public TransitAlertService getTransitAlertService() { return transitAlertService; } @@ -82,11 +76,7 @@ protected void runPolling() throws InterruptedException, ExecutionException { } // Handle update in graph writer runnable - processGraphUpdaterResult( - saveResultOnGraph.execute(context -> - updateHandler.update(feed, context.gtfsRealtimeFuzzyTripMatcher()) - ) - ); + updateGraph(context -> updateHandler.update(feed, context.gtfsRealtimeFuzzyTripMatcher())); lastTimestamp = feedTimestamp; } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java index 087bf28e875..38efa18c177 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java @@ -28,10 +28,6 @@ public class SiriETUpdater extends PollingGraphUpdater { * Feed id that is used for the trip ids in the TripUpdates */ private final String feedId; - /** - * Parent update manager. Is used to execute graph writer runnables. - */ - protected WriteToGraphCallback saveResultOnGraph; private final EstimatedTimetableHandler estimatedTimetableHandler; @@ -61,11 +57,6 @@ public SiriETUpdater( recordMetrics = TripUpdateMetrics.streaming(config); } - @Override - public void setup(WriteToGraphCallback writeToGraphCallback) { - this.saveResultOnGraph = writeToGraphCallback; - } - /** * Repeatedly makes blocking calls to an UpdateStreamer to retrieve new stop time updates, and * applies those updates to the graph. diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java index 83200db30d3..8311a385e9c 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java @@ -13,7 +13,6 @@ import org.opentripplanner.updater.alert.TransitAlertProvider; import org.opentripplanner.updater.siri.SiriAlertsUpdateHandler; import org.opentripplanner.updater.spi.PollingGraphUpdater; -import org.opentripplanner.updater.spi.WriteToGraphCallback; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import uk.org.siri.siri20.ServiceDelivery; @@ -33,7 +32,6 @@ public class SiriSXUpdater extends PollingGraphUpdater implements TransitAlertPr // TODO RT_AB: Document why SiriAlertsUpdateHandler is a separate instance that persists across // many graph update operations. private final SiriAlertsUpdateHandler updateHandler; - private WriteToGraphCallback writeToGraphCallback; private ZonedDateTime lastTimestamp = ZonedDateTime.now().minusWeeks(1); private String requestorRef; /** @@ -78,11 +76,6 @@ public SiriSXUpdater(SiriSXUpdaterParameters config, TimetableRepository timetab ); } - @Override - public void setup(WriteToGraphCallback writeToGraphCallback) { - this.writeToGraphCallback = writeToGraphCallback; - } - public TransitAlertService getTransitAlertService() { return transitAlertService; } @@ -141,7 +134,7 @@ private void updateSiri() { // All that said, out of all the update types, Alerts (and SIRI SX) are probably the ones // that would be most tolerant of non-versioned application-wide storage since they don't // participate in routing and are tacked on to already-completed routing responses. - writeToGraphCallback.execute(context -> { + saveResultOnGraph.execute(context -> { updateHandler.update(serviceDelivery, context); if (markPrimed) { primed = true; diff --git a/application/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdater.java b/application/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdater.java index 21eb60c2737..0525406505e 100644 --- a/application/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdater.java @@ -3,7 +3,7 @@ import java.time.Duration; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; +import org.opentripplanner.updater.GraphWriterRunnable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,6 +36,10 @@ public abstract class PollingGraphUpdater implements GraphUpdater { * removed that. */ protected volatile boolean primed; + /** + * Parent update manager. Is used to execute graph writer runnables. + */ + protected WriteToGraphCallback saveResultOnGraph; /** Shared configuration code for all polling graph updaters. */ protected PollingGraphUpdater(PollingGraphUpdaterParameters config) { @@ -97,14 +101,19 @@ public String getConfigRef() { return configRef; } + @Override + public final void setup(WriteToGraphCallback writeToGraphCallback) { + this.saveResultOnGraph = writeToGraphCallback; + } + /** * Mirrors GraphUpdater.run method. Only difference is that runPolling will be run multiple times * with pauses in between. The length of the pause is defined in the preference frequency. */ protected abstract void runPolling() throws Exception; - protected void processGraphUpdaterResult(Future result) + protected final void updateGraph(GraphWriterRunnable task) throws ExecutionException, InterruptedException { - result.get(); + saveResultOnGraph.execute(task).get(); } } diff --git a/application/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdater.java b/application/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdater.java index 1f88044d51a..8331bf19d3b 100644 --- a/application/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/trip/PollingTripUpdater.java @@ -6,7 +6,6 @@ import java.util.function.Consumer; import org.opentripplanner.updater.spi.PollingGraphUpdater; import org.opentripplanner.updater.spi.UpdateResult; -import org.opentripplanner.updater.spi.WriteToGraphCallback; import org.opentripplanner.updater.trip.metrics.BatchTripUpdateMetrics; import org.opentripplanner.utils.tostring.ToStringBuilder; import org.slf4j.Logger; @@ -34,10 +33,6 @@ public class PollingTripUpdater extends PollingGraphUpdater { private final BackwardsDelayPropagationType backwardsDelayPropagationType; private final Consumer recordMetrics; - /** - * Parent update manager. Is used to execute graph writer runnables. - */ - private WriteToGraphCallback saveResultOnGraph; /** * Set only if we should attempt to match the trip_id from other data in TripDescriptor */ @@ -64,11 +59,6 @@ public PollingTripUpdater( ); } - @Override - public void setup(WriteToGraphCallback writeToGraphCallback) { - this.saveResultOnGraph = writeToGraphCallback; - } - /** * Repeatedly makes blocking calls to an UpdateStreamer to retrieve new stop time updates, and * applies those updates to the graph. @@ -90,7 +80,7 @@ public void runPolling() throws InterruptedException, ExecutionException { feedId, recordMetrics ); - processGraphUpdaterResult(saveResultOnGraph.execute(runnable)); + updateGraph(runnable); } } diff --git a/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdater.java index c65ff7bc4c1..29e820ff952 100644 --- a/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdater.java @@ -13,7 +13,6 @@ import org.opentripplanner.updater.RealTimeUpdateContext; import org.opentripplanner.updater.spi.DataSource; import org.opentripplanner.updater.spi.PollingGraphUpdater; -import org.opentripplanner.updater.spi.WriteToGraphCallback; import org.opentripplanner.utils.tostring.ToStringBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,8 +27,6 @@ public class VehicleParkingAvailabilityUpdater extends PollingGraphUpdater { VehicleParkingAvailabilityUpdater.class ); private final DataSource source; - private WriteToGraphCallback saveResultOnGraph; - private final VehicleParkingRepository repository; public VehicleParkingAvailabilityUpdater( @@ -44,18 +41,13 @@ public VehicleParkingAvailabilityUpdater( LOG.info("Creating vehicle-parking updater running every {}: {}", pollingPeriod(), source); } - @Override - public void setup(WriteToGraphCallback writeToGraphCallback) { - this.saveResultOnGraph = writeToGraphCallback; - } - @Override protected void runPolling() throws InterruptedException, ExecutionException { if (source.update()) { var updates = source.getUpdates(); var graphWriterRunnable = new AvailabilityUpdater(updates); - processGraphUpdaterResult(saveResultOnGraph.execute(graphWriterRunnable)); + updateGraph(graphWriterRunnable); } } diff --git a/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdater.java index ea356200f3b..5513e224f57 100644 --- a/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdater.java @@ -27,7 +27,6 @@ import org.opentripplanner.updater.RealTimeUpdateContext; import org.opentripplanner.updater.spi.DataSource; import org.opentripplanner.updater.spi.PollingGraphUpdater; -import org.opentripplanner.updater.spi.WriteToGraphCallback; import org.opentripplanner.utils.tostring.ToStringBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -43,7 +42,6 @@ public class VehicleParkingUpdater extends PollingGraphUpdater { private final Map> tempEdgesByPark = new HashMap<>(); private final DataSource source; private final List oldVehicleParkings = new ArrayList<>(); - private WriteToGraphCallback saveResultOnGraph; private final VertexLinker linker; private final VehicleParkingRepository parkingRepository; @@ -64,11 +62,6 @@ public VehicleParkingUpdater( LOG.info("Creating vehicle-parking updater running every {}: {}", pollingPeriod(), source); } - @Override - public void setup(WriteToGraphCallback writeToGraphCallback) { - this.saveResultOnGraph = writeToGraphCallback; - } - @Override protected void runPolling() throws InterruptedException, ExecutionException { LOG.debug("Updating vehicle parkings from {}", source); @@ -82,7 +75,7 @@ protected void runPolling() throws InterruptedException, ExecutionException { VehicleParkingGraphWriterRunnable graphWriterRunnable = new VehicleParkingGraphWriterRunnable( vehicleParkings ); - processGraphUpdaterResult(saveResultOnGraph.execute(graphWriterRunnable)); + updateGraph(graphWriterRunnable); } private class VehicleParkingGraphWriterRunnable implements GraphWriterRunnable { diff --git a/application/src/main/java/org/opentripplanner/updater/vehicle_position/PollingVehiclePositionUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_position/PollingVehiclePositionUpdater.java index c787989c5d2..f53d3010e59 100644 --- a/application/src/main/java/org/opentripplanner/updater/vehicle_position/PollingVehiclePositionUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_position/PollingVehiclePositionUpdater.java @@ -8,7 +8,6 @@ import org.opentripplanner.service.realtimevehicles.model.RealtimeVehicle; import org.opentripplanner.standalone.config.routerconfig.updaters.VehiclePositionsUpdaterConfig; import org.opentripplanner.updater.spi.PollingGraphUpdater; -import org.opentripplanner.updater.spi.WriteToGraphCallback; import org.opentripplanner.utils.tostring.ToStringBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,10 +27,6 @@ public class PollingVehiclePositionUpdater extends PollingGraphUpdater { private final GtfsRealtimeHttpVehiclePositionSource vehiclePositionSource; private final Set vehiclePositionFeatures; - /** - * Parent update manager. Is used to execute graph writer runnables. - */ - private WriteToGraphCallback saveResultOnGraph; private final String feedId; private final RealtimeVehicleRepository realtimeVehicleRepository; private final boolean fuzzyTripMatching; @@ -55,11 +50,6 @@ public PollingVehiclePositionUpdater( ); } - @Override - public void setup(WriteToGraphCallback writeToGraphCallback) { - this.saveResultOnGraph = writeToGraphCallback; - } - /** * Repeatedly makes blocking calls to an UpdateStreamer to retrieve new stop time updates, and * applies those updates to the graph. @@ -78,7 +68,7 @@ public void runPolling() throws InterruptedException, ExecutionException { fuzzyTripMatching, updates ); - processGraphUpdaterResult(saveResultOnGraph.execute(runnable)); + updateGraph(runnable); } } diff --git a/application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java index efcf9812feb..8419d004138 100644 --- a/application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdater.java @@ -31,7 +31,6 @@ import org.opentripplanner.updater.RealTimeUpdateContext; import org.opentripplanner.updater.spi.PollingGraphUpdater; import org.opentripplanner.updater.spi.UpdaterConstructionException; -import org.opentripplanner.updater.spi.WriteToGraphCallback; import org.opentripplanner.updater.vehicle_rental.datasources.VehicleRentalDatasource; import org.opentripplanner.utils.lang.ObjectUtils; import org.opentripplanner.utils.logging.Throttle; @@ -54,8 +53,6 @@ public class VehicleRentalUpdater extends PollingGraphUpdater { private final VehicleRentalDatasource source; private final String nameForLogging; - private WriteToGraphCallback saveResultOnGraph; - private Map latestModifiedEdges = Map.of(); private Set latestAppliedGeofencingZones = Set.of(); private final Map verticesByStation = new HashMap<>(); @@ -109,11 +106,6 @@ public VehicleRentalUpdater( } } - @Override - public void setup(WriteToGraphCallback writeToGraphCallback) { - this.saveResultOnGraph = writeToGraphCallback; - } - @Override public String toString() { return ToStringBuilder.of(VehicleRentalUpdater.class).addObj("source", source).toString(); @@ -139,7 +131,7 @@ protected void runPolling() throws InterruptedException, ExecutionException { stations, geofencingZones ); - processGraphUpdaterResult(saveResultOnGraph.execute(graphWriterRunnable)); + updateGraph(graphWriterRunnable); } private class VehicleRentalGraphWriterRunnable implements GraphWriterRunnable { From 69ac4854678bb964715d4b7d143e457cc6b77dda Mon Sep 17 00:00:00 2001 From: Michael Tsang Date: Thu, 12 Dec 2024 12:50:17 +0000 Subject: [PATCH 28/60] add test for desired feature flag --- .../updater/spi/PollingGraphUpdaterTest.java | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 application/src/test/java/org/opentripplanner/updater/spi/PollingGraphUpdaterTest.java diff --git a/application/src/test/java/org/opentripplanner/updater/spi/PollingGraphUpdaterTest.java b/application/src/test/java/org/opentripplanner/updater/spi/PollingGraphUpdaterTest.java new file mode 100644 index 00000000000..6132988d92b --- /dev/null +++ b/application/src/test/java/org/opentripplanner/updater/spi/PollingGraphUpdaterTest.java @@ -0,0 +1,78 @@ +package org.opentripplanner.updater.spi; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.time.Duration; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.opentripplanner.framework.application.OTPFeature; +import org.opentripplanner.updater.GraphWriterRunnable; + +public class PollingGraphUpdaterTest { + + private static final PollingGraphUpdaterParameters config = new PollingGraphUpdaterParameters() { + @Override + public Duration frequency() { + return Duration.ZERO; + } + + @Override + public String configRef() { + return ""; + } + }; + + private static final PollingGraphUpdater subject = new PollingGraphUpdater(config) { + @Override + protected void runPolling() {} + }; + + private boolean updateCompleted; + + @BeforeAll + static void beforeAll() { + subject.setup(runnable -> CompletableFuture.runAsync(() -> runnable.run(null))); + } + + @BeforeEach + void setUp() { + updateCompleted = false; + } + + private final GraphWriterRunnable graphWriterRunnable = context -> { + try { + Thread.sleep(100); + updateCompleted = true; + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + }; + + @Test + void testUpdateGraphWithWaitFeatureOn() { + OTPFeature.WaitForGraphUpdateInPollingUpdaters.testOn(() -> { + callUpdater(); + assertTrue(updateCompleted); + }); + } + + @Test + void testProcessGraphUpdaterResultWithWaitFeatureOff() { + OTPFeature.WaitForGraphUpdateInPollingUpdaters.testOff(() -> { + callUpdater(); + assertFalse(updateCompleted); + }); + } + + private void callUpdater() { + try { + subject.updateGraph(graphWriterRunnable); + } catch (ExecutionException | InterruptedException e) { + throw new RuntimeException(e); + } + } +} From 0037b5aab805b8eb719593387881fd242556744c Mon Sep 17 00:00:00 2001 From: Michael Tsang Date: Thu, 12 Dec 2024 12:55:27 +0000 Subject: [PATCH 29/60] implement feature flag --- .../opentripplanner/updater/spi/PollingGraphUpdater.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdater.java b/application/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdater.java index 0525406505e..e8faa4b6aba 100644 --- a/application/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/spi/PollingGraphUpdater.java @@ -3,6 +3,7 @@ import java.time.Duration; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; +import org.opentripplanner.framework.application.OTPFeature; import org.opentripplanner.updater.GraphWriterRunnable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -114,6 +115,9 @@ public final void setup(WriteToGraphCallback writeToGraphCallback) { protected final void updateGraph(GraphWriterRunnable task) throws ExecutionException, InterruptedException { - saveResultOnGraph.execute(task).get(); + var result = saveResultOnGraph.execute(task); + if (OTPFeature.WaitForGraphUpdateInPollingUpdaters.isOn()) { + result.get(); + } } } From defdf5fef7c122b509b0a398fed739895417cbb9 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Fri, 13 Dec 2024 08:02:56 +0100 Subject: [PATCH 30/60] Introduce factory --- .../configure/UpdaterConfigurator.java | 46 +------- .../updater/siri/updater/SiriETUpdater.java | 2 - .../siri/updater/SiriLoaderFactory.java | 34 ------ .../updater/configure/SiriUpdaterModule.java | 107 ++++++++++++++++++ 4 files changed, 112 insertions(+), 77 deletions(-) delete mode 100644 application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLoaderFactory.java create mode 100644 application/src/main/java/org/opentripplanner/updater/siri/updater/configure/SiriUpdaterModule.java diff --git a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java index 82902f447d3..11be185fa2a 100644 --- a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java +++ b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java @@ -20,20 +20,16 @@ import org.opentripplanner.updater.UpdatersParameters; import org.opentripplanner.updater.alert.GtfsRealtimeAlertsUpdater; import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; -import org.opentripplanner.updater.siri.updater.SiriETHttpTripUpdateSource; -import org.opentripplanner.updater.siri.updater.SiriETUpdater; import org.opentripplanner.updater.siri.updater.SiriHttpLoader; -import org.opentripplanner.updater.siri.updater.SiriLoaderFactory; import org.opentripplanner.updater.siri.updater.SiriSXUpdater; +import org.opentripplanner.updater.siri.updater.configure.SiriUpdaterModule; import org.opentripplanner.updater.siri.updater.google.SiriETGooglePubsubUpdater; -import org.opentripplanner.updater.siri.updater.lite.SiriETLiteHttpTripUpdateSource; import org.opentripplanner.updater.siri.updater.lite.SiriLiteHttpLoader; import org.opentripplanner.updater.spi.GraphUpdater; import org.opentripplanner.updater.spi.TimetableSnapshotFlush; import org.opentripplanner.updater.trip.MqttGtfsRealtimeUpdater; import org.opentripplanner.updater.trip.PollingTripUpdater; import org.opentripplanner.updater.trip.TimetableSnapshotSource; -import org.opentripplanner.updater.trip.metrics.TripUpdateMetrics; import org.opentripplanner.updater.vehicle_parking.AvailabilityDatasourceFactory; import org.opentripplanner.updater.vehicle_parking.VehicleParkingAvailabilityUpdater; import org.opentripplanner.updater.vehicle_parking.VehicleParkingDataSourceFactory; @@ -189,54 +185,22 @@ private List createUpdatersFromConfig() { } for (var configItem : updatersParameters.getSiriETUpdaterParameters()) { updaters.add( - new SiriETUpdater( - configItem, - provideSiriTimetableSnapshot(), - new SiriETHttpTripUpdateSource( - configItem.sourceParameters(), - SiriLoaderFactory.createLoader(configItem) - ), - TripUpdateMetrics.streaming(configItem) - ) + SiriUpdaterModule.createSiriETUpdater(configItem, provideSiriTimetableSnapshot()) ); } for (var configItem : updatersParameters.getSiriETLiteUpdaterParameters()) { updaters.add( - new SiriETUpdater( - configItem, - provideSiriTimetableSnapshot(), - new SiriETLiteHttpTripUpdateSource( - configItem.sourceParameters(), - SiriLoaderFactory.createLoader(configItem) - ), - TripUpdateMetrics.batch(configItem) - ) + SiriUpdaterModule.createSiriETUpdater(configItem, provideSiriTimetableSnapshot()) ); } for (var configItem : updatersParameters.getSiriETGooglePubsubUpdaterParameters()) { updaters.add(new SiriETGooglePubsubUpdater(configItem, provideSiriTimetableSnapshot())); } for (var configItem : updatersParameters.getSiriSXUpdaterParameters()) { - updaters.add( - new SiriSXUpdater( - configItem, - timetableRepository, - new SiriHttpLoader(configItem.url(), configItem.timeout(), configItem.requestHeaders()) - ) - ); + updaters.add(SiriUpdaterModule.createSiriSXUpdater(configItem, timetableRepository)); } for (var configItem : updatersParameters.getSiriSXLiteUpdaterParameters()) { - updaters.add( - new SiriSXUpdater( - configItem, - timetableRepository, - new SiriLiteHttpLoader( - configItem.uri(), - configItem.timeout(), - configItem.requestHeaders() - ) - ) - ); + updaters.add(SiriUpdaterModule.createSiriSXUpdater(configItem, timetableRepository)); } for (var configItem : updatersParameters.getMqttGtfsRealtimeUpdaterParameters()) { updaters.add(new MqttGtfsRealtimeUpdater(configItem, provideGtfsTimetableSnapshot())); diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java index db60b34f55a..663d3ab906b 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriETUpdater.java @@ -3,8 +3,6 @@ import java.util.List; import java.util.function.Consumer; import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; -import org.opentripplanner.updater.siri.updater.lite.SiriETLiteHttpTripUpdateSource; -import org.opentripplanner.updater.siri.updater.lite.SiriETLiteUpdaterParameters; import org.opentripplanner.updater.spi.PollingGraphUpdater; import org.opentripplanner.updater.spi.PollingGraphUpdaterParameters; import org.opentripplanner.updater.spi.ResultLogger; diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLoaderFactory.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLoaderFactory.java deleted file mode 100644 index b9b43d9341e..00000000000 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriLoaderFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.opentripplanner.updater.siri.updater; - -import org.opentripplanner.updater.siri.updater.lite.SiriETLiteUpdaterParameters; -import org.opentripplanner.updater.siri.updater.lite.SiriLiteHttpLoader; - -/** - * Constructs a SiriLoader from the parameters of the updater. - */ -public class SiriLoaderFactory { - - public static SiriLoader createLoader(SiriETUpdater.Parameters parameters) { - // Load real-time updates from a file. - if (SiriFileLoader.matchesUrl(parameters.url())) { - return new SiriFileLoader(parameters.url()); - } - // Fallback to default loader - else { - return switch (parameters) { - case SiriETUpdaterParameters p -> new SiriHttpLoader( - p.url(), - p.timeout(), - p.httpRequestHeaders(), - p.previewInterval() - ); - case SiriETLiteUpdaterParameters p -> new SiriLiteHttpLoader( - p.uri(), - p.timeout(), - p.httpRequestHeaders() - ); - default -> throw new IllegalArgumentException("Unexpected value: " + parameters); - }; - } - } -} diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/configure/SiriUpdaterModule.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/configure/SiriUpdaterModule.java new file mode 100644 index 00000000000..2553bd3c67e --- /dev/null +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/configure/SiriUpdaterModule.java @@ -0,0 +1,107 @@ +package org.opentripplanner.updater.siri.updater.configure; + +import java.util.function.Consumer; +import org.opentripplanner.transit.service.TimetableRepository; +import org.opentripplanner.updater.siri.SiriTimetableSnapshotSource; +import org.opentripplanner.updater.siri.updater.EstimatedTimetableSource; +import org.opentripplanner.updater.siri.updater.SiriETHttpTripUpdateSource; +import org.opentripplanner.updater.siri.updater.SiriETUpdater; +import org.opentripplanner.updater.siri.updater.SiriETUpdaterParameters; +import org.opentripplanner.updater.siri.updater.SiriFileLoader; +import org.opentripplanner.updater.siri.updater.SiriHttpLoader; +import org.opentripplanner.updater.siri.updater.SiriLoader; +import org.opentripplanner.updater.siri.updater.SiriSXUpdater; +import org.opentripplanner.updater.siri.updater.SiriSXUpdaterParameters; +import org.opentripplanner.updater.siri.updater.lite.SiriETLiteHttpTripUpdateSource; +import org.opentripplanner.updater.siri.updater.lite.SiriETLiteUpdaterParameters; +import org.opentripplanner.updater.siri.updater.lite.SiriLiteHttpLoader; +import org.opentripplanner.updater.siri.updater.lite.SiriSXLiteUpdaterParameters; +import org.opentripplanner.updater.spi.UpdateResult; +import org.opentripplanner.updater.trip.metrics.TripUpdateMetrics; + +/** + * Dependency injection for instantiating SIRI-ET and SX updaters. + */ +public class SiriUpdaterModule { + + public static SiriETUpdater createSiriETUpdater( + SiriETUpdater.Parameters params, + SiriTimetableSnapshotSource timetableSnapshotSource + ) { + return new SiriETUpdater( + params, + timetableSnapshotSource, + createSource(params), + createMetricsConsumer(params) + ); + } + + public static SiriSXUpdater createSiriSXUpdater( + SiriSXUpdater.Parameters params, + TimetableRepository timetableRepository + ) { + return new SiriSXUpdater(params, timetableRepository, createLoader(params)); + } + + private static SiriLoader createLoader(SiriSXUpdater.Parameters params) { + return switch (params) { + case SiriSXUpdaterParameters p -> new SiriHttpLoader( + p.url(), + p.timeout(), + p.requestHeaders() + ); + case SiriSXLiteUpdaterParameters p -> new SiriLiteHttpLoader( + p.uri(), + p.timeout(), + p.requestHeaders() + ); + default -> throw new IllegalArgumentException("Unexpected value: " + params); + }; + } + + private static EstimatedTimetableSource createSource(SiriETUpdater.Parameters params) { + return switch (params) { + case SiriETUpdaterParameters p -> new SiriETHttpTripUpdateSource( + p.sourceParameters(), + createLoader(params) + ); + case SiriETLiteUpdaterParameters p -> new SiriETLiteHttpTripUpdateSource( + p.sourceParameters(), + createLoader(params) + ); + default -> throw new IllegalArgumentException("Unexpected value: " + params); + }; + } + + private static SiriLoader createLoader(SiriETUpdater.Parameters params) { + // Load real-time updates from a file. + if (SiriFileLoader.matchesUrl(params.url())) { + return new SiriFileLoader(params.url()); + } + // Fallback to default loader + else { + return switch (params) { + case SiriETUpdaterParameters p -> new SiriHttpLoader( + p.url(), + p.timeout(), + p.httpRequestHeaders(), + p.previewInterval() + ); + case SiriETLiteUpdaterParameters p -> new SiriLiteHttpLoader( + p.uri(), + p.timeout(), + p.httpRequestHeaders() + ); + default -> throw new IllegalArgumentException("Unexpected value: " + params); + }; + } + } + + private static Consumer createMetricsConsumer(SiriETUpdater.Parameters params) { + return switch (params) { + case SiriETUpdaterParameters p -> TripUpdateMetrics.streaming(p); + case SiriETLiteUpdaterParameters p -> TripUpdateMetrics.batch(p); + default -> throw new IllegalArgumentException("Unexpected value: " + params); + }; + } +} From fd0b1fe8ae564e70852fb75d487e67f5303a4c56 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Tue, 17 Dec 2024 22:47:28 +0100 Subject: [PATCH 31/60] Update protobuf, OSM parser and Google cloud tools --- application/pom.xml | 6 +++--- .../src/main/java/org/opentripplanner/osm/OsmParser.java | 4 ++-- .../src/main/java/org/opentripplanner/osm/OsmProvider.java | 2 +- .../updater/alert/GtfsRealtimeAlertsUpdater.java | 2 +- .../updater/trip/MqttGtfsRealtimeUpdater.java | 2 +- .../src/test/java/org/opentripplanner/GtfsTest.java | 2 +- gtfs-realtime-protobuf/pom.xml | 7 ++++++- pom.xml | 2 +- 8 files changed, 16 insertions(+), 11 deletions(-) diff --git a/application/pom.xml b/application/pom.xml index c3b4a6ee582..2a6e3043ba2 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -312,9 +312,9 @@ - org.openstreetmap.osmosis - osmosis-osm-binary - 0.48.3 + org.openstreetmap.pbf + osmpbf + 1.6.0 diff --git a/application/src/main/java/org/opentripplanner/osm/OsmParser.java b/application/src/main/java/org/opentripplanner/osm/OsmParser.java index 8a5f8e32448..4b443e6a505 100644 --- a/application/src/main/java/org/opentripplanner/osm/OsmParser.java +++ b/application/src/main/java/org/opentripplanner/osm/OsmParser.java @@ -1,11 +1,11 @@ package org.opentripplanner.osm; +import crosby.binary.BinaryParser; +import crosby.binary.Osmformat; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; -import org.openstreetmap.osmosis.osmbinary.BinaryParser; -import org.openstreetmap.osmosis.osmbinary.Osmformat; import org.opentripplanner.graph_builder.module.osm.OsmDatabase; import org.opentripplanner.osm.model.OsmMemberType; import org.opentripplanner.osm.model.OsmNode; diff --git a/application/src/main/java/org/opentripplanner/osm/OsmProvider.java b/application/src/main/java/org/opentripplanner/osm/OsmProvider.java index 597fd516b0e..91944a95b86 100644 --- a/application/src/main/java/org/opentripplanner/osm/OsmProvider.java +++ b/application/src/main/java/org/opentripplanner/osm/OsmProvider.java @@ -1,11 +1,11 @@ package org.opentripplanner.osm; +import crosby.binary.file.BlockInputStream; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.time.ZoneId; -import org.openstreetmap.osmosis.osmbinary.file.BlockInputStream; import org.opentripplanner.datastore.api.DataSource; import org.opentripplanner.datastore.api.FileType; import org.opentripplanner.datastore.file.FileDataSource; diff --git a/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java index a5be5ef4185..de6383c6016 100644 --- a/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java @@ -68,7 +68,7 @@ protected void runPolling() { final FeedMessage feed = otpHttpClient.getAndMap( URI.create(url), this.headers.asMap(), - FeedMessage.PARSER::parseFrom + FeedMessage::parseFrom ); long feedTimestamp = feed.getHeader().getTimestamp(); diff --git a/application/src/main/java/org/opentripplanner/updater/trip/MqttGtfsRealtimeUpdater.java b/application/src/main/java/org/opentripplanner/updater/trip/MqttGtfsRealtimeUpdater.java index 20b49ed022f..0580cd4ea63 100644 --- a/application/src/main/java/org/opentripplanner/updater/trip/MqttGtfsRealtimeUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/trip/MqttGtfsRealtimeUpdater.java @@ -138,7 +138,7 @@ public void messageArrived(String topic, MqttMessage message) { UpdateIncrementality updateIncrementality = FULL_DATASET; try { // Decode message - GtfsRealtime.FeedMessage feedMessage = GtfsRealtime.FeedMessage.PARSER.parseFrom( + GtfsRealtime.FeedMessage feedMessage = GtfsRealtime.FeedMessage.parseFrom( message.getPayload() ); List feedEntityList = feedMessage.getEntityList(); diff --git a/application/src/test/java/org/opentripplanner/GtfsTest.java b/application/src/test/java/org/opentripplanner/GtfsTest.java index 5d548e4012c..05b7bfbf4f6 100644 --- a/application/src/test/java/org/opentripplanner/GtfsTest.java +++ b/application/src/test/java/org/opentripplanner/GtfsTest.java @@ -221,7 +221,7 @@ protected void setUp() throws Exception { try { InputStream inputStream = new FileInputStream(gtfsRealTime); - FeedMessage feedMessage = FeedMessage.PARSER.parseFrom(inputStream); + FeedMessage feedMessage = FeedMessage.parseFrom(inputStream); List feedEntityList = feedMessage.getEntityList(); List updates = new ArrayList<>(feedEntityList.size()); for (FeedEntity feedEntity : feedEntityList) { diff --git a/gtfs-realtime-protobuf/pom.xml b/gtfs-realtime-protobuf/pom.xml index e4465a4d366..d3c3305b9b2 100644 --- a/gtfs-realtime-protobuf/pom.xml +++ b/gtfs-realtime-protobuf/pom.xml @@ -11,10 +11,15 @@ gtfs-realtime-protobuf OpenTripPlanner - GTFS Realtime (protobuf) + + 4.28.3 + + com.google.protobuf protobuf-java + ${protobuf.version} @@ -46,7 +51,7 @@ - com.google.protobuf:protoc:3.22.0:exe:${os.detected.classifier} + com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} diff --git a/pom.xml b/pom.xml index 27eada4007b..4108973c7ff 100644 --- a/pom.xml +++ b/pom.xml @@ -392,7 +392,7 @@ com.google.cloud libraries-bom - 26.48.0 + 26.51.0 pom import From de1e23d1264f20c9b5ce139ab22b865f121f1e6b Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 18 Dec 2024 12:52:11 +0100 Subject: [PATCH 32/60] Re-enable file loader for SIRI-SX --- .../updater/configure/SiriUpdaterModule.java | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/configure/SiriUpdaterModule.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/configure/SiriUpdaterModule.java index 2553bd3c67e..f39fbbb3134 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/configure/SiriUpdaterModule.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/configure/SiriUpdaterModule.java @@ -43,7 +43,26 @@ public static SiriSXUpdater createSiriSXUpdater( return new SiriSXUpdater(params, timetableRepository, createLoader(params)); } + private static EstimatedTimetableSource createSource(SiriETUpdater.Parameters params) { + return switch (params) { + case SiriETUpdaterParameters p -> new SiriETHttpTripUpdateSource( + p.sourceParameters(), + createLoader(params) + ); + case SiriETLiteUpdaterParameters p -> new SiriETLiteHttpTripUpdateSource( + p.sourceParameters(), + createLoader(params) + ); + default -> throw new IllegalArgumentException("Unexpected value: " + params); + }; + } + private static SiriLoader createLoader(SiriSXUpdater.Parameters params) { + // Load real-time updates from a file. + if (SiriFileLoader.matchesUrl(params.url())) { + return new SiriFileLoader(params.url()); + } + // Fallback to default loader return switch (params) { case SiriSXUpdaterParameters p -> new SiriHttpLoader( p.url(), @@ -59,20 +78,6 @@ private static SiriLoader createLoader(SiriSXUpdater.Parameters params) { }; } - private static EstimatedTimetableSource createSource(SiriETUpdater.Parameters params) { - return switch (params) { - case SiriETUpdaterParameters p -> new SiriETHttpTripUpdateSource( - p.sourceParameters(), - createLoader(params) - ); - case SiriETLiteUpdaterParameters p -> new SiriETLiteHttpTripUpdateSource( - p.sourceParameters(), - createLoader(params) - ); - default -> throw new IllegalArgumentException("Unexpected value: " + params); - }; - } - private static SiriLoader createLoader(SiriETUpdater.Parameters params) { // Load real-time updates from a file. if (SiriFileLoader.matchesUrl(params.url())) { From 5cc681285d4ff5739a0aafe9895a3914f534c977 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Thu, 19 Dec 2024 16:15:40 +0100 Subject: [PATCH 33/60] Specify version in parent pom --- gtfs-realtime-protobuf/pom.xml | 4 ---- pom.xml | 7 ++++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gtfs-realtime-protobuf/pom.xml b/gtfs-realtime-protobuf/pom.xml index d3c3305b9b2..dd3990207c9 100644 --- a/gtfs-realtime-protobuf/pom.xml +++ b/gtfs-realtime-protobuf/pom.xml @@ -11,15 +11,11 @@ gtfs-realtime-protobuf OpenTripPlanner - GTFS Realtime (protobuf) - - 4.28.3 - com.google.protobuf protobuf-java - ${protobuf.version} diff --git a/pom.xml b/pom.xml index 4108973c7ff..98cf77db29e 100644 --- a/pom.xml +++ b/pom.xml @@ -73,6 +73,7 @@ 2.0.15 1.27 4.0.5 + 4.28.3 UTF-8 opentripplanner/OpenTripPlanner @@ -485,7 +486,11 @@ java-snapshot-testing-junit5 2.3.0 - + + com.google.protobuf + protobuf-java + ${protobuf.version} + From 48ccd365b6c683481a86435e8504d0b2a848e9ff Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:30:17 +0000 Subject: [PATCH 34/60] fix(deps): update dependency org.entur:siri-java-model to v1.28 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 27eada4007b..f54278105ef 100644 --- a/pom.xml +++ b/pom.xml @@ -71,7 +71,7 @@ 9.12.0 2.0.16 2.0.15 - 1.27 + 1.28 4.0.5 UTF-8 From 7f4ee90c46416b82705fca35ce380adca8fab999 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 06:23:59 +0000 Subject: [PATCH 35/60] fix(deps): update lucene.version to v10 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 27eada4007b..bf817576cdc 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,7 @@ 1.14.1 5.6.0 1.5.12 - 9.12.0 + 10.1.0 2.0.16 2.0.15 1.27 From 9a3fec8dfce0264e0b572065a797848b6c1dcd5a Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Fri, 3 Jan 2025 10:35:19 +0100 Subject: [PATCH 36/60] Update code to Lucene 10 --- .../opentripplanner/ext/geocoder/LuceneIndex.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/application/src/ext/java/org/opentripplanner/ext/geocoder/LuceneIndex.java b/application/src/ext/java/org/opentripplanner/ext/geocoder/LuceneIndex.java index f742ddb131a..50452899deb 100644 --- a/application/src/ext/java/org/opentripplanner/ext/geocoder/LuceneIndex.java +++ b/application/src/ext/java/org/opentripplanner/ext/geocoder/LuceneIndex.java @@ -18,7 +18,7 @@ import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.codecs.Codec; import org.apache.lucene.codecs.PostingsFormat; -import org.apache.lucene.codecs.lucene912.Lucene912Codec; +import org.apache.lucene.codecs.lucene101.Lucene101Codec; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field.Store; import org.apache.lucene.document.StoredField; @@ -34,7 +34,7 @@ import org.apache.lucene.search.FuzzyQuery; import org.apache.lucene.search.PrefixQuery; import org.apache.lucene.search.TermQuery; -import org.apache.lucene.search.suggest.document.Completion912PostingsFormat; +import org.apache.lucene.search.suggest.document.Completion101PostingsFormat; import org.apache.lucene.search.suggest.document.CompletionAnalyzer; import org.apache.lucene.search.suggest.document.ContextQuery; import org.apache.lucene.search.suggest.document.ContextSuggestField; @@ -203,8 +203,8 @@ private StopCluster toStopCluster(Document document) { static IndexWriterConfig iwcWithSuggestField(Analyzer analyzer, final Set suggestFields) { IndexWriterConfig iwc = new IndexWriterConfig(analyzer); - Codec filterCodec = new Lucene912Codec() { - final PostingsFormat postingsFormat = new Completion912PostingsFormat(); + Codec filterCodec = new Lucene101Codec() { + final PostingsFormat postingsFormat = new Completion101PostingsFormat(); @Override public PostingsFormat getPostingsFormatForField(String field) { @@ -285,7 +285,7 @@ private Stream matchingDocuments( .stream(topDocs.scoreDocs) .map(scoreDoc -> { try { - return searcher.doc(scoreDoc.doc); + return searcher.storedFields().document(scoreDoc.doc); } catch (IOException e) { throw new RuntimeException(e); } @@ -330,7 +330,7 @@ private Stream matchingDocuments( .stream(topDocs.scoreDocs) .map(scoreDoc -> { try { - return searcher.doc(scoreDoc.doc); + return searcher.storedFields().document(scoreDoc.doc); } catch (IOException e) { throw new RuntimeException(e); } From 1518e38dd6f0ca9cc4656ce38dc9ccc009fdcef6 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Fri, 3 Jan 2025 10:44:48 +0100 Subject: [PATCH 37/60] Apply review feedback --- pom.xml | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 98cf77db29e..9cf7b514ce7 100644 --- a/pom.xml +++ b/pom.xml @@ -59,21 +59,23 @@ 176 + 32.1 2.53 2.18.2 + 4.0.5 3.1.9 5.11.4 - 1.14.1 - 5.6.0 1.5.12 9.12.0 - 2.0.16 + 1.14.1 2.0.15 - 1.27 - 4.0.5 + 5.6.0 4.28.3 + 1.27 + 2.0.16 + UTF-8 opentripplanner/OpenTripPlanner @@ -390,7 +392,7 @@ - + com.google.cloud libraries-bom 26.51.0 @@ -398,6 +400,18 @@ import + + com.google.protobuf + protobuf-java + ${protobuf.version} + + + + com.google.guava + guava + 33.3.1-jre + + org.slf4j @@ -420,11 +434,6 @@ trove4j 3.0.3 - - com.google.guava - guava - 33.3.1-jre - @@ -486,11 +495,7 @@ java-snapshot-testing-junit5 2.3.0 - - com.google.protobuf - protobuf-java - ${protobuf.version} - + From 509094ce927a7d0296e9ed6f2866fa457a2696be Mon Sep 17 00:00:00 2001 From: OTP Changelog Bot Date: Fri, 3 Jan 2025 12:50:36 +0000 Subject: [PATCH 38/60] Add changelog entry for #6284 [ci skip] --- doc/user/Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/user/Changelog.md b/doc/user/Changelog.md index a9ca5c28ca3..3dc3f018f9a 100644 --- a/doc/user/Changelog.md +++ b/doc/user/Changelog.md @@ -68,6 +68,7 @@ based on merged pull requests. Search GitHub issues and pull requests for smalle - Add default penalty to all car API modes [#6302](https://github.com/opentripplanner/OpenTripPlanner/pull/6302) - Make flex linking work together with boarding locations [#6311](https://github.com/opentripplanner/OpenTripPlanner/pull/6311) - Add fallback name for corridors [#6303](https://github.com/opentripplanner/OpenTripPlanner/pull/6303) +- Implement SIRI Lite [#6284](https://github.com/opentripplanner/OpenTripPlanner/pull/6284) [](AUTOMATIC_CHANGELOG_PLACEHOLDER_DO_NOT_REMOVE) ## 2.6.0 (2024-09-18) From 249b01b9e16dadf2fc41df1e576b312795324c0b Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Fri, 3 Jan 2025 11:00:34 +0100 Subject: [PATCH 39/60] Update list of GTFS Fares v2 classes --- .../org/opentripplanner/gtfs/graphbuilder/GtfsModule.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java b/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java index a5fe3641e3c..fc5e5e276d7 100644 --- a/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java +++ b/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java @@ -14,6 +14,7 @@ import org.onebusaway.csv_entities.EntityHandler; import org.onebusaway.gtfs.impl.GtfsRelationalDaoImpl; import org.onebusaway.gtfs.model.Agency; +import org.onebusaway.gtfs.model.Area; import org.onebusaway.gtfs.model.FareAttribute; import org.onebusaway.gtfs.model.FareLegRule; import org.onebusaway.gtfs.model.FareMedium; @@ -28,6 +29,7 @@ import org.onebusaway.gtfs.model.ShapePoint; import org.onebusaway.gtfs.model.Stop; import org.onebusaway.gtfs.model.StopArea; +import org.onebusaway.gtfs.model.StopAreaElement; import org.onebusaway.gtfs.model.Trip; import org.onebusaway.gtfs.serialization.GtfsReader; import org.onebusaway.gtfs.services.GenericMutableDao; @@ -66,7 +68,9 @@ public class GtfsModule implements GraphBuilderModule { FareTransferRule.class, RiderCategory.class, FareMedium.class, - StopArea.class + StopArea.class, + StopAreaElement.class, + Area.class ); private static final Logger LOG = LoggerFactory.getLogger(GtfsModule.class); From 21f15bde2642a5019eeac847e34a8756eb1ef76d Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Fri, 3 Jan 2025 13:54:23 +0100 Subject: [PATCH 40/60] Update to latest OBA --- application/pom.xml | 2 +- .../java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/application/pom.xml b/application/pom.xml index c3b4a6ee582..231675a99de 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -296,7 +296,7 @@ org.onebusaway onebusaway-gtfs - 4.3.0 + 5.0.0 diff --git a/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java b/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java index fc5e5e276d7..3548312b79a 100644 --- a/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java +++ b/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java @@ -28,7 +28,6 @@ import org.onebusaway.gtfs.model.ServiceCalendarDate; import org.onebusaway.gtfs.model.ShapePoint; import org.onebusaway.gtfs.model.Stop; -import org.onebusaway.gtfs.model.StopArea; import org.onebusaway.gtfs.model.StopAreaElement; import org.onebusaway.gtfs.model.Trip; import org.onebusaway.gtfs.serialization.GtfsReader; @@ -68,7 +67,6 @@ public class GtfsModule implements GraphBuilderModule { FareTransferRule.class, RiderCategory.class, FareMedium.class, - StopArea.class, StopAreaElement.class, Area.class ); From 5d4911b45a55a034666b7edc5c305f2c133bc5b4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:20:03 +0000 Subject: [PATCH 41/60] fix(deps): update micrometer to v1.14.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f54278105ef..fbc65c1e53a 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ 2.18.2 3.1.9 5.11.4 - 1.14.1 + 1.14.2 5.6.0 1.5.12 9.12.0 From 51080a8510956dcd40cd578a4ac1320fb1de01ce Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 11:05:31 +0000 Subject: [PATCH 42/60] fix(deps): update dependency com.google.guava:guava to v33.4.0-jre --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fbc65c1e53a..58af808d0e1 100644 --- a/pom.xml +++ b/pom.xml @@ -422,7 +422,7 @@ com.google.guava guava - 33.3.1-jre + 33.4.0-jre From 72019c0fd0086ee8401a2fcc177313f0f1c0c5cd Mon Sep 17 00:00:00 2001 From: Eivind Morris Bakke Date: Tue, 7 Jan 2025 14:59:51 +0100 Subject: [PATCH 43/60] Add a matcher API for filters in the transit service used for regularStop lookup (#6234) * Implements a RegularStop matcher that can be used for filtering RegularStops. Also moves the envelope filtering that used to happen on the client side of the findRegularStops call into the StopModelIndex. * Updates the RegularStopRequest to latest concepts. * Adds @Nullable to feedId method on the RegularStopRequest. * Changes feedId to be called agency. * Update application/src/test/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactoryTest.java Co-authored-by: Leonard Ehrenfried * Fixes test failure. * Addresses comments in code review. * Update application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequest.java Co-authored-by: Thomas Gran * Update application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequestBuilder.java Co-authored-by: Thomas Gran * Update application/src/main/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactory.java Co-authored-by: Thomas Gran * Update application/src/main/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactory.java Co-authored-by: Thomas Gran * Update application/src/main/java/org/opentripplanner/transit/service/TransitService.java Co-authored-by: Thomas Gran * Update application/src/main/java/org/opentripplanner/transit/service/TransitService.java Co-authored-by: Thomas Gran * Addresses comments in code review. --------- Co-authored-by: Leonard Ehrenfried Co-authored-by: Thomas Gran --- .../parkAndRideApi/ParkAndRideResource.java | 2 +- .../ext/restapi/resources/IndexAPI.java | 5 +- .../layers/stops/StopsLayerBuilder.java | 2 +- .../apis/gtfs/datafetchers/QueryTypeImpl.java | 5 +- .../transmodel/TransmodelGraphQLSchema.java | 53 ++++++++++--------- .../transmodel/model/stop/StopPlaceType.java | 3 +- .../GraphInspectorVectorTileResource.java | 2 +- .../StraightLineNearbyStopFinder.java | 2 +- .../api/OtpServerRequestContext.java | 2 +- .../transit/api/model/FilterValues.java | 2 +- .../FindRegularStopsByBoundingBoxRequest.java | 48 +++++++++++++++++ ...gularStopsByBoundingBoxRequestBuilder.java | 32 +++++++++++ .../api/request/TripOnServiceDateRequest.java | 4 +- .../TripOnServiceDateRequestBuilder.java | 4 +- .../transit/api/request/TripRequest.java | 2 +- .../api/request/TripRequestBuilder.java | 2 +- .../model/filter/expr/ExpressionBuilder.java | 5 ++ .../filter/expr/GenericUnaryMatcher.java | 33 ++++++++++++ .../transit/RegularStopMatcherFactory.java | 47 ++++++++++++++++ .../service/DefaultTransitService.java | 20 ++++++- .../transit/service/StopModelIndex.java | 11 +++- .../transit/service/TransitService.java | 21 +++++--- .../apis/transmodel/schema.graphql | 2 +- .../LegacyRouteRequestMapperTest.java | 2 +- .../routerequest/RouteRequestMapperTest.java | 2 +- .../graph/DefaultRoutingServiceTest.java | 2 +- .../filter/expr/GenericUnaryMatcherTest.java | 15 ++++++ .../RegularStopMatcherFactoryTest.java | 44 +++++++++++++++ 28 files changed, 313 insertions(+), 61 deletions(-) create mode 100644 application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequest.java create mode 100644 application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequestBuilder.java create mode 100644 application/src/main/java/org/opentripplanner/transit/model/filter/expr/GenericUnaryMatcher.java create mode 100644 application/src/main/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactory.java create mode 100644 application/src/test/java/org/opentripplanner/transit/model/filter/expr/GenericUnaryMatcherTest.java create mode 100644 application/src/test/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactoryTest.java diff --git a/application/src/ext/java/org/opentripplanner/ext/parkAndRideApi/ParkAndRideResource.java b/application/src/ext/java/org/opentripplanner/ext/parkAndRideApi/ParkAndRideResource.java index 747ba0617ec..611f4d46420 100644 --- a/application/src/ext/java/org/opentripplanner/ext/parkAndRideApi/ParkAndRideResource.java +++ b/application/src/ext/java/org/opentripplanner/ext/parkAndRideApi/ParkAndRideResource.java @@ -42,7 +42,7 @@ public ParkAndRideResource( // - serverContext.graphFinder(). This needs at least a comment! // - This can be replaced with a search done with the SiteRepository // - if we have a radius search there. - this.graphFinder = new DirectGraphFinder(serverContext.transitService()::findRegularStops); + this.graphFinder = new DirectGraphFinder(serverContext.transitService()::findRegularStopsByBoundingBox); } /** Envelopes are in latitude, longitude format */ diff --git a/application/src/ext/java/org/opentripplanner/ext/restapi/resources/IndexAPI.java b/application/src/ext/java/org/opentripplanner/ext/restapi/resources/IndexAPI.java index 7dbfabed156..b9c049f547e 100644 --- a/application/src/ext/java/org/opentripplanner/ext/restapi/resources/IndexAPI.java +++ b/application/src/ext/java/org/opentripplanner/ext/restapi/resources/IndexAPI.java @@ -200,7 +200,7 @@ public List getStopsInRadius( radius = Math.min(radius, MAX_STOP_SEARCH_RADIUS); - return new DirectGraphFinder(serverContext.transitService()::findRegularStops) + return new DirectGraphFinder(serverContext.transitService()::findRegularStopsByBoundingBox) .findClosestStops(new Coordinate(lon, lat), radius) .stream() .map(it -> StopMapper.mapToApiShort(it.stop, it.distance)) @@ -221,10 +221,9 @@ public List getStopsInRadius( new Coordinate(maxLon, maxLat) ); - var stops = transitService().findRegularStops(envelope); + var stops = transitService().findRegularStopsByBoundingBox(envelope); return stops .stream() - .filter(stop -> envelope.contains(stop.getCoordinate().asJtsCoordinate())) .map(StopMapper::mapToApiShort) .toList(); } diff --git a/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerBuilder.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerBuilder.java index 141157f8f3e..c1e03cdefca 100644 --- a/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerBuilder.java +++ b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerBuilder.java @@ -44,7 +44,7 @@ public StopsLayerBuilder( protected List getGeometries(Envelope query) { return transitService - .findRegularStops(query) + .findRegularStopsByBoundingBox(query) .stream() .filter(filter) .map(stop -> { diff --git a/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImpl.java index c56540a73f9..fa38deeab84 100644 --- a/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImpl.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImpl.java @@ -752,9 +752,8 @@ public DataFetcher> stopsByBbox() { ); Stream stopStream = getTransitService(environment) - .findRegularStops(envelope) - .stream() - .filter(stop -> envelope.contains(stop.getCoordinate().asJtsCoordinate())); + .findRegularStopsByBoundingBox(envelope) + .stream(); if (args.getGraphQLFeeds() != null) { List feedIds = args.getGraphQLFeeds(); diff --git a/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchema.java b/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchema.java index 922f9f5244b..0561ec9de85 100644 --- a/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchema.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchema.java @@ -3,6 +3,7 @@ import static java.lang.Boolean.TRUE; import static java.util.Collections.emptyList; import static org.opentripplanner.apis.transmodel.mapping.SeverityMapper.getTransmodelSeverity; +import static org.opentripplanner.apis.transmodel.mapping.TransitIdMapper.mapIDToDomain; import static org.opentripplanner.apis.transmodel.mapping.TransitIdMapper.mapIDsToDomainNullSafe; import static org.opentripplanner.apis.transmodel.model.EnumTypes.FILTER_PLACE_TYPE_ENUM; import static org.opentripplanner.apis.transmodel.model.EnumTypes.MULTI_MODAL_MODE; @@ -115,6 +116,7 @@ import org.opentripplanner.routing.graphfinder.PlaceType; import org.opentripplanner.service.vehiclerental.model.VehicleRentalPlace; import org.opentripplanner.transit.api.model.FilterValues; +import org.opentripplanner.transit.api.request.FindRegularStopsByBoundingBoxRequest; import org.opentripplanner.transit.api.request.TripRequest; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -439,10 +441,7 @@ private GraphQLSchema create() { .build() ) .dataFetcher(env -> - StopPlaceType.fetchStopPlaceById( - TransitIdMapper.mapIDToDomain(env.getArgument("id")), - env - ) + StopPlaceType.fetchStopPlaceById(mapIDToDomain(env.getArgument("id")), env) ) .build() ) @@ -576,7 +575,7 @@ private GraphQLSchema create() { .dataFetcher(environment -> GqlUtil .getTransitService(environment) - .getStopLocation(TransitIdMapper.mapIDToDomain(environment.getArgument("id"))) + .getStopLocation(mapIDToDomain(environment.getArgument("id"))) ) .build() ) @@ -610,7 +609,7 @@ private GraphQLSchema create() { } TransitService transitService = GqlUtil.getTransitService(environment); return ((List) environment.getArgument("ids")).stream() - .map(id -> transitService.getStopLocation(TransitIdMapper.mapIDToDomain(id))) + .map(id -> transitService.getStopLocation(mapIDToDomain(id))) .collect(Collectors.toList()); } if (environment.getArgument("name") == null) { @@ -661,7 +660,14 @@ private GraphQLSchema create() { .build() ) .argument( - GraphQLArgument.newArgument().name("authority").type(Scalars.GraphQLString).build() + GraphQLArgument + .newArgument() + .name("authority") + .deprecate( + "This is the Transmodel namespace or the GTFS feedID - avoid using this. Request a new field if necessary." + ) + .type(Scalars.GraphQLString) + .build() ) .argument( GraphQLArgument @@ -669,7 +675,7 @@ private GraphQLSchema create() { .name("filterByInUse") .description("If true only quays with at least one visiting line are included.") .type(Scalars.GraphQLBoolean) - .defaultValue(Boolean.FALSE) + .defaultValueProgrammatic(Boolean.FALSE) .build() ) .dataFetcher(environment -> { @@ -683,24 +689,19 @@ private GraphQLSchema create() { environment.getArgument("maximumLatitude") ) ); + + var authority = environment.getArgument("authority"); + var filterInUse = environment.getArgument("filterByInUse"); + + FindRegularStopsByBoundingBoxRequest findRegularStopsByBoundingBoxRequest = FindRegularStopsByBoundingBoxRequest + .of(envelope) + .withFeedId(authority) + .filterByInUse(filterInUse) + .build(); + return GqlUtil .getTransitService(environment) - .findRegularStops(envelope) - .stream() - .filter(stop -> envelope.contains(stop.getCoordinate().asJtsCoordinate())) - .filter(stop -> - environment.getArgument("authority") == null || - stop.getId().getFeedId().equalsIgnoreCase(environment.getArgument("authority")) - ) - .filter(stop -> { - boolean filterByInUse = TRUE.equals(environment.getArgument("filterByInUse")); - boolean inUse = !GqlUtil - .getTransitService(environment) - .findPatterns(stop, true) - .isEmpty(); - return !filterByInUse || inUse; - }) - .collect(Collectors.toList()); + .findRegularStopsByBoundingBox(findRegularStopsByBoundingBoxRequest); }) .build() ) @@ -1438,7 +1439,7 @@ private GraphQLSchema create() { .build() ) .dataFetcher(environment -> { - var bikeParkId = TransitIdMapper.mapIDToDomain(environment.getArgument("id")); + var bikeParkId = mapIDToDomain(environment.getArgument("id")); return GqlUtil .getVehicleParkingService(environment) .listBikeParks() @@ -1573,7 +1574,7 @@ private GraphQLSchema create() { return GqlUtil .getTransitService(environment) .getTransitAlertService() - .getAlertById(TransitIdMapper.mapIDToDomain(situationNumber)); + .getAlertById(mapIDToDomain(situationNumber)); }) .build() ) diff --git a/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopPlaceType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopPlaceType.java index fa755e8c6f7..9b8fd25c68a 100644 --- a/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopPlaceType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopPlaceType.java @@ -546,9 +546,8 @@ public static Collection fetchStopPlaces( ); Stream stations = transitService - .findRegularStops(envelope) + .findRegularStopsByBoundingBox(envelope) .stream() - .filter(stop -> envelope.contains(stop.getCoordinate().asJtsCoordinate())) .map(StopLocation::getParentStation) .filter(Objects::nonNull) .distinct(); diff --git a/application/src/main/java/org/opentripplanner/apis/vectortiles/GraphInspectorVectorTileResource.java b/application/src/main/java/org/opentripplanner/apis/vectortiles/GraphInspectorVectorTileResource.java index 0576e91f312..0336a57c5de 100644 --- a/application/src/main/java/org/opentripplanner/apis/vectortiles/GraphInspectorVectorTileResource.java +++ b/application/src/main/java/org/opentripplanner/apis/vectortiles/GraphInspectorVectorTileResource.java @@ -183,7 +183,7 @@ private static LayerBuilder createLayerBuilder( case RegularStop -> new StopLayerBuilder<>( layerParameters, locale, - e -> context.transitService().findRegularStops(e) + e -> context.transitService().findRegularStopsByBoundingBox(e) ); case AreaStop -> new StopLayerBuilder<>( layerParameters, diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/StraightLineNearbyStopFinder.java b/application/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/StraightLineNearbyStopFinder.java index 5b304d0d20c..ccdcb68446b 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/StraightLineNearbyStopFinder.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/nearbystops/StraightLineNearbyStopFinder.java @@ -22,7 +22,7 @@ public StraightLineNearbyStopFinder(TransitService transitService, Duration dura // We need to accommodate straight line distance (in meters) but when streets are present we // use an earliest arrival search, which optimizes on time. Ideally we'd specify in meters, // but we don't have much of a choice here. Use the default walking speed to convert. - this.directGraphFinder = new DirectGraphFinder(transitService::findRegularStops); + this.directGraphFinder = new DirectGraphFinder(transitService::findRegularStopsByBoundingBox); } /** diff --git a/application/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java b/application/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java index f088a3de60e..139bac6dcc9 100644 --- a/application/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java +++ b/application/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java @@ -121,7 +121,7 @@ public interface OtpServerRequestContext { TraverseVisitor traverseVisitor(); default GraphFinder graphFinder() { - return GraphFinder.getInstance(graph(), transitService()::findRegularStops); + return GraphFinder.getInstance(graph(), transitService()::findRegularStopsByBoundingBox); } FlexParameters flexParameters(); diff --git a/application/src/main/java/org/opentripplanner/transit/api/model/FilterValues.java b/application/src/main/java/org/opentripplanner/transit/api/model/FilterValues.java index 391b2531231..63befe3add6 100644 --- a/application/src/main/java/org/opentripplanner/transit/api/model/FilterValues.java +++ b/application/src/main/java/org/opentripplanner/transit/api/model/FilterValues.java @@ -1,8 +1,8 @@ package org.opentripplanner.transit.api.model; -import com.beust.jcommander.internal.Nullable; import java.util.Collection; import java.util.NoSuchElementException; +import javax.annotation.Nullable; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.service.TransitService; diff --git a/application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequest.java b/application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequest.java new file mode 100644 index 00000000000..476e23d7cd8 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequest.java @@ -0,0 +1,48 @@ +package org.opentripplanner.transit.api.request; + +import javax.annotation.Nullable; +import org.locationtech.jts.geom.Envelope; +import org.opentripplanner.transit.model.site.RegularStop; + +/** + * A request for {@link RegularStop}s within a bounding box. + *

+ * This request is used to retrieve {@link RegularStop}s that are within a provided bounding box and + * match the other criteria. + */ +public class FindRegularStopsByBoundingBoxRequest { + + private final Envelope envelope; + + @Nullable + private final String feedId; + + private final boolean filterByInUse; + + FindRegularStopsByBoundingBoxRequest( + Envelope envelope, + @Nullable String feedId, + boolean filterByInUse + ) { + this.envelope = envelope; + this.feedId = feedId; + this.filterByInUse = filterByInUse; + } + + public static FindRegularStopsByBoundingBoxRequestBuilder of(Envelope envelope) { + return new FindRegularStopsByBoundingBoxRequestBuilder(envelope); + } + + public Envelope envelope() { + return envelope; + } + + @Nullable + public String feedId() { + return feedId; + } + + public boolean filterByInUse() { + return filterByInUse; + } +} diff --git a/application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequestBuilder.java b/application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequestBuilder.java new file mode 100644 index 00000000000..49d31c33db9 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequestBuilder.java @@ -0,0 +1,32 @@ +package org.opentripplanner.transit.api.request; + +import javax.annotation.Nullable; +import org.locationtech.jts.geom.Envelope; + +public class FindRegularStopsByBoundingBoxRequestBuilder { + + private final Envelope envelope; + + @Nullable + private String feedId; + + private boolean filterByInUse = false; + + FindRegularStopsByBoundingBoxRequestBuilder(Envelope envelope) { + this.envelope = envelope; + } + + public FindRegularStopsByBoundingBoxRequestBuilder withFeedId(@Nullable String feedId) { + this.feedId = feedId; + return this; + } + + public FindRegularStopsByBoundingBoxRequestBuilder filterByInUse(boolean filterByInUse) { + this.filterByInUse = filterByInUse; + return this; + } + + public FindRegularStopsByBoundingBoxRequest build() { + return new FindRegularStopsByBoundingBoxRequest(envelope, feedId, filterByInUse); + } +} diff --git a/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequest.java b/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequest.java index c61bb8ad107..54dd1c7aea6 100644 --- a/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequest.java +++ b/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequest.java @@ -23,7 +23,7 @@ public class TripOnServiceDateRequest { private final FilterValues netexInternalPlanningCodes; private final FilterValues alterations; - protected TripOnServiceDateRequest( + TripOnServiceDateRequest( RequiredFilterValues serviceDates, FilterValues agencies, FilterValues routes, @@ -41,7 +41,7 @@ protected TripOnServiceDateRequest( this.alterations = alterations; } - public static TripOnServiceDateRequestBuilder of(RequiredFilterValues serviceDates) { + public static TripOnServiceDateRequestBuilder of(RequiredFilterValues serviceDates) { return new TripOnServiceDateRequestBuilder(serviceDates); } diff --git a/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequestBuilder.java b/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequestBuilder.java index 534557c15d8..3181819a400 100644 --- a/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequestBuilder.java +++ b/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequestBuilder.java @@ -30,9 +30,9 @@ public class TripOnServiceDateRequestBuilder { "alterations", List.of() ); - private RequiredFilterValues serviceDates; + private final RequiredFilterValues serviceDates; - protected TripOnServiceDateRequestBuilder(RequiredFilterValues serviceDates) { + TripOnServiceDateRequestBuilder(RequiredFilterValues serviceDates) { this.serviceDates = serviceDates; } diff --git a/application/src/main/java/org/opentripplanner/transit/api/request/TripRequest.java b/application/src/main/java/org/opentripplanner/transit/api/request/TripRequest.java index c73e800582b..5e05b472937 100644 --- a/application/src/main/java/org/opentripplanner/transit/api/request/TripRequest.java +++ b/application/src/main/java/org/opentripplanner/transit/api/request/TripRequest.java @@ -17,7 +17,7 @@ public class TripRequest { private final FilterValues netexInternalPlanningCodes; private final FilterValues serviceDates; - protected TripRequest( + TripRequest( FilterValues agencies, FilterValues routes, FilterValues netexInternalPlanningCodes, diff --git a/application/src/main/java/org/opentripplanner/transit/api/request/TripRequestBuilder.java b/application/src/main/java/org/opentripplanner/transit/api/request/TripRequestBuilder.java index 3a2f80a3e34..32ca31d5cd6 100644 --- a/application/src/main/java/org/opentripplanner/transit/api/request/TripRequestBuilder.java +++ b/application/src/main/java/org/opentripplanner/transit/api/request/TripRequestBuilder.java @@ -21,7 +21,7 @@ public class TripRequestBuilder { List.of() ); - protected TripRequestBuilder() {} + TripRequestBuilder() {} public TripRequestBuilder withAgencies(FilterValues agencies) { this.agencies = agencies; diff --git a/application/src/main/java/org/opentripplanner/transit/model/filter/expr/ExpressionBuilder.java b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/ExpressionBuilder.java index f2910a4c8d2..87533ab1b5e 100644 --- a/application/src/main/java/org/opentripplanner/transit/model/filter/expr/ExpressionBuilder.java +++ b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/ExpressionBuilder.java @@ -22,6 +22,11 @@ public static ExpressionBuilder of() { return new ExpressionBuilder<>(); } + public ExpressionBuilder matches(Matcher matcher) { + matchers.add(matcher); + return this; + } + public ExpressionBuilder atLeastOneMatch( FilterValues filterValues, Function> matcherProvider diff --git a/application/src/main/java/org/opentripplanner/transit/model/filter/expr/GenericUnaryMatcher.java b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/GenericUnaryMatcher.java new file mode 100644 index 00000000000..0ac6c5f17ee --- /dev/null +++ b/application/src/main/java/org/opentripplanner/transit/model/filter/expr/GenericUnaryMatcher.java @@ -0,0 +1,33 @@ +package org.opentripplanner.transit.model.filter.expr; + +import java.util.function.Predicate; + +/** + * A generic matcher that takes a predicate function that returns a boolean given the matched type. + *

+ * @param The type of the entity being matched. + */ +public class GenericUnaryMatcher implements Matcher { + + private final String typeName; + private final Predicate matchPredicate; + + /** + * @param typeName The typeName appears in the toString for easier debugging. + * @param matchPredicate The predicate that will be used to test the entity being matched. + */ + public GenericUnaryMatcher(String typeName, Predicate matchPredicate) { + this.typeName = typeName; + this.matchPredicate = matchPredicate; + } + + @Override + public boolean match(T entity) { + return matchPredicate.test(entity); + } + + @Override + public String toString() { + return "GenericUnaryMatcher: " + typeName; + } +} diff --git a/application/src/main/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactory.java b/application/src/main/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactory.java new file mode 100644 index 00000000000..261e7057d95 --- /dev/null +++ b/application/src/main/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactory.java @@ -0,0 +1,47 @@ +package org.opentripplanner.transit.model.filter.transit; + +import java.util.function.Predicate; +import org.opentripplanner.transit.api.request.FindRegularStopsByBoundingBoxRequest; +import org.opentripplanner.transit.model.filter.expr.EqualityMatcher; +import org.opentripplanner.transit.model.filter.expr.ExpressionBuilder; +import org.opentripplanner.transit.model.filter.expr.GenericUnaryMatcher; +import org.opentripplanner.transit.model.filter.expr.Matcher; +import org.opentripplanner.transit.model.site.RegularStop; + +/** + * A factory for creating matchers for {@link RegularStop} objects. + *

+ * This factory is used to create matchers for {@link RegularStop} objects based on a request. The + * resulting matcher can be used to filter a list of {@link RegularStop} objects. + */ +public class RegularStopMatcherFactory { + + /** + * Creates a matcher that filters {@link RegularStop} objects with the provided {@code request} + * and {@code inUseProvider}. The {@code inUseProvider} is used to determine if a {@link RegularStop} is + * in use. The inUseProvider is an injected function, because the check is done by the transit service + * which has access to all stops and routes. A stop is used if it has routes visiting the stop. + */ + public static Matcher of( + FindRegularStopsByBoundingBoxRequest request, + Predicate inUseProvider + ) { + ExpressionBuilder expr = ExpressionBuilder.of(); + + if (request.feedId() != null) { + expr.matches(feedId(request.feedId())); + } + if (request.filterByInUse()) { + expr.matches(inUseMatcher(inUseProvider)); + } + return expr.build(); + } + + static Matcher feedId(String feedId) { + return new EqualityMatcher<>("feedId", feedId, stop -> stop.getId().getFeedId()); + } + + static Matcher inUseMatcher(Predicate inUseProvider) { + return new GenericUnaryMatcher<>("inUse", inUseProvider); + } +} diff --git a/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java b/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java index cf5bb11c3b3..d27fe138ef4 100644 --- a/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java +++ b/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java @@ -35,11 +35,13 @@ import org.opentripplanner.routing.services.TransitAlertService; import org.opentripplanner.routing.stoptimes.ArrivalDeparture; import org.opentripplanner.routing.stoptimes.StopTimesHelper; +import org.opentripplanner.transit.api.request.FindRegularStopsByBoundingBoxRequest; import org.opentripplanner.transit.api.request.TripOnServiceDateRequest; import org.opentripplanner.transit.api.request.TripRequest; import org.opentripplanner.transit.model.basic.Notice; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.filter.expr.Matcher; +import org.opentripplanner.transit.model.filter.transit.RegularStopMatcherFactory; import org.opentripplanner.transit.model.filter.transit.TripMatcherFactory; import org.opentripplanner.transit.model.filter.transit.TripOnServiceDateMatcherFactory; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; @@ -698,11 +700,27 @@ public ZonedDateTime getTransitServiceStarts() { } @Override - public Collection findRegularStops(Envelope envelope) { + public Collection findRegularStopsByBoundingBox(Envelope envelope) { OTPRequestTimeoutException.checkForTimeout(); return timetableRepository.getSiteRepository().findRegularStops(envelope); } + @Override + public Collection findRegularStopsByBoundingBox( + FindRegularStopsByBoundingBoxRequest request + ) { + OTPRequestTimeoutException.checkForTimeout(); + Collection stops = timetableRepository + .getSiteRepository() + .findRegularStops(request.envelope()); + + Matcher matcher = RegularStopMatcherFactory.of( + request, + stop -> !findPatterns(stop, true).isEmpty() + ); + return stops.stream().filter(matcher::match).toList(); + } + @Override public Collection findAreaStops(Envelope envelope) { OTPRequestTimeoutException.checkForTimeout(); diff --git a/application/src/main/java/org/opentripplanner/transit/service/StopModelIndex.java b/application/src/main/java/org/opentripplanner/transit/service/StopModelIndex.java index 13a8c0d278d..effa8f95f7e 100644 --- a/application/src/main/java/org/opentripplanner/transit/service/StopModelIndex.java +++ b/application/src/main/java/org/opentripplanner/transit/service/StopModelIndex.java @@ -71,10 +71,17 @@ class SiteRepositoryIndex { } /** - * Find a regular stop in the spatial index + * Find a regular stop in the spatial index, where the stop is inside of the passed Envelope. + * + * @param envelope - The {@link Envelope} to search for stops in. + * @return A collection of {@link RegularStop}s that are inside of the passed envelope. */ Collection findRegularStops(Envelope envelope) { - return regularStopSpatialIndex.query(envelope); + return regularStopSpatialIndex + .query(envelope) + .stream() + .filter(stop -> envelope.contains(stop.getCoordinate().asJtsCoordinate())) + .toList(); } MultiModalStation getMultiModalStationForStation(Station station) { diff --git a/application/src/main/java/org/opentripplanner/transit/service/TransitService.java b/application/src/main/java/org/opentripplanner/transit/service/TransitService.java index 11a628508d6..6e005b355d1 100644 --- a/application/src/main/java/org/opentripplanner/transit/service/TransitService.java +++ b/application/src/main/java/org/opentripplanner/transit/service/TransitService.java @@ -24,6 +24,7 @@ import org.opentripplanner.routing.algorithm.raptoradapter.transit.TransitLayer; import org.opentripplanner.routing.services.TransitAlertService; import org.opentripplanner.routing.stoptimes.ArrivalDeparture; +import org.opentripplanner.transit.api.request.FindRegularStopsByBoundingBoxRequest; import org.opentripplanner.transit.api.request.TripOnServiceDateRequest; import org.opentripplanner.transit.api.request.TripRequest; import org.opentripplanner.transit.model.basic.Notice; @@ -271,7 +272,7 @@ List findTripTimeOnDate( boolean transitFeedCovers(Instant dateTime); - Collection findRegularStops(Envelope envelope); + Collection findRegularStopsByBoundingBox(Envelope envelope); Collection findAreaStops(Envelope envelope); @@ -287,6 +288,7 @@ List findTripTimeOnDate( * So, if more patterns of mode BUS than RAIL visit the group, the result will be [BUS,RAIL]. */ List findTransitModes(StopLocationsGroup station); + /** * For a {@link StopLocation} return its modes. *

@@ -307,18 +309,13 @@ List findTripTimeOnDate( Map getServiceCodesRunningForDate(); /** - * Returns a list of TripOnServiceDates that match the filtering defined in the request. - * - * @param request - A TripOnServiceDateRequest object with filtering defined. - * @return - A list of TripOnServiceDates + * Returns a list of {@link TripOnServiceDate}s that match the filtering defined in the request. */ List findTripsOnServiceDate(TripOnServiceDateRequest request); /** - * Returns a list of Trips that match the filtering defined in the request. + * Returns a list of {@link Trip}s that match the filtering defined in the request. * - * @param request - A TripRequest object with filtering defined. - * @return - A list of Trips */ List getTrips(TripRequest request); @@ -329,4 +326,12 @@ List findTripTimeOnDate( * @return true if the trip exists, false otherwise */ boolean containsTrip(FeedScopedId id); + + /** + * Returns a list of {@link RegularStop}s that lay within a bounding box and match the other criteria + * in the request object. + */ + Collection findRegularStopsByBoundingBox( + FindRegularStopsByBoundingBoxRequest request + ); } diff --git a/application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql b/application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql index b76f28649a4..6834d375bf1 100644 --- a/application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql +++ b/application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql @@ -702,7 +702,7 @@ type QueryType { quays(ids: [String], name: String): [Quay]! @timingData "Get all quays within the specified bounding box" quaysByBbox( - authority: String, + authority: String @deprecated(reason : "This is the Transmodel namespace or the GTFS feedID - avoid using this. Request a new field if necessary."), "If true only quays with at least one visiting line are included." filterByInUse: Boolean = false, maximumLatitude: Float!, diff --git a/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java index 43dd10dbdce..17193ad02c1 100644 --- a/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java +++ b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java @@ -65,7 +65,7 @@ class LegacyRouteRequestMapperTest implements PlanTestConstants { new DefaultVehicleRentalService(), new DefaultVehicleParkingService(new DefaultVehicleParkingRepository()), new DefaultRealtimeVehicleService(transitService), - GraphFinder.getInstance(graph, transitService::findRegularStops), + GraphFinder.getInstance(graph, transitService::findRegularStopsByBoundingBox), new RouteRequest() ); } diff --git a/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTest.java index 34cb865c81a..925e5009e77 100644 --- a/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTest.java +++ b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTest.java @@ -75,7 +75,7 @@ class RouteRequestMapperTest { new DefaultVehicleRentalService(), new DefaultVehicleParkingService(new DefaultVehicleParkingRepository()), new DefaultRealtimeVehicleService(transitService), - GraphFinder.getInstance(graph, transitService::findRegularStops), + GraphFinder.getInstance(graph, transitService::findRegularStopsByBoundingBox), new RouteRequest() ); } diff --git a/application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java b/application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java index ab897e3410b..48363a98c88 100644 --- a/application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java @@ -115,7 +115,7 @@ public void testSpatialIndex() { SphericalDistanceLibrary.metersToLonDegrees(100, stopJ.getLat()), SphericalDistanceLibrary.metersToDegrees(100) ); - Collection stops = transitService.findRegularStops(env); + Collection stops = transitService.findRegularStopsByBoundingBox(env); assertTrue(stops.contains(stopJ)); assertTrue(stops.contains(stopL)); assertTrue(stops.contains(stopM)); diff --git a/application/src/test/java/org/opentripplanner/transit/model/filter/expr/GenericUnaryMatcherTest.java b/application/src/test/java/org/opentripplanner/transit/model/filter/expr/GenericUnaryMatcherTest.java new file mode 100644 index 00000000000..ef93df53dbd --- /dev/null +++ b/application/src/test/java/org/opentripplanner/transit/model/filter/expr/GenericUnaryMatcherTest.java @@ -0,0 +1,15 @@ +package org.opentripplanner.transit.model.filter.expr; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +class GenericUnaryMatcherTest { + + @Test + void testMatches() { + var matcher = new GenericUnaryMatcher<>("int", i -> i.equals(42)); + assertTrue(matcher.match(42)); + assertFalse(matcher.match(43)); + } +} diff --git a/application/src/test/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactoryTest.java b/application/src/test/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactoryTest.java new file mode 100644 index 00000000000..5cfeaf2780f --- /dev/null +++ b/application/src/test/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactoryTest.java @@ -0,0 +1,44 @@ +package org.opentripplanner.transit.model.filter.transit; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.concurrent.atomic.AtomicInteger; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.opentripplanner.transit.model.framework.FeedScopedId; +import org.opentripplanner.transit.model.site.RegularStop; + +class RegularStopMatcherFactoryTest { + + private static RegularStop stop1; + private static RegularStop stop2; + + @BeforeAll + static void setup() { + stop1 = + RegularStop + .of(new FeedScopedId("agency", "stopId"), new AtomicInteger()::getAndIncrement) + .build(); + + stop2 = + RegularStop + .of(new FeedScopedId("otherAgency", "otherStopId"), new AtomicInteger()::getAndIncrement) + .build(); + } + + @Test + void testFeedIds() { + var matcher = RegularStopMatcherFactory.feedId("agency"); + assertTrue(matcher.match(stop1)); + assertFalse(matcher.match(stop2)); + } + + @Test + void testInUseMatcher() { + var matcher = RegularStopMatcherFactory.inUseMatcher(stop -> + stop.getId().getFeedId().equals("agency") + ); + assertTrue(matcher.match(stop1)); + assertFalse(matcher.match(stop2)); + } +} From 1ebb855a9f3c0ed6c3eb68cc2ff418050b051389 Mon Sep 17 00:00:00 2001 From: OTP Changelog Bot Date: Tue, 7 Jan 2025 14:00:06 +0000 Subject: [PATCH 44/60] Add changelog entry for #6234 [ci skip] --- doc/user/Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/user/Changelog.md b/doc/user/Changelog.md index 3dc3f018f9a..b859f87f19a 100644 --- a/doc/user/Changelog.md +++ b/doc/user/Changelog.md @@ -69,6 +69,7 @@ based on merged pull requests. Search GitHub issues and pull requests for smalle - Make flex linking work together with boarding locations [#6311](https://github.com/opentripplanner/OpenTripPlanner/pull/6311) - Add fallback name for corridors [#6303](https://github.com/opentripplanner/OpenTripPlanner/pull/6303) - Implement SIRI Lite [#6284](https://github.com/opentripplanner/OpenTripPlanner/pull/6284) +- Add a matcher API for filters in the transit service used for regularStop lookup [#6234](https://github.com/opentripplanner/OpenTripPlanner/pull/6234) [](AUTOMATIC_CHANGELOG_PLACEHOLDER_DO_NOT_REMOVE) ## 2.6.0 (2024-09-18) From f8b51d954dae8f06369e5133484b531736150089 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 8 Jan 2025 12:11:08 +0100 Subject: [PATCH 45/60] Fix spelling of SIRI [ci skip] --- mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index 51245f6c3b8..0ebcb7ddd4d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -91,7 +91,7 @@ nav: - "Stop Area Relations": 'StopAreas.md' - "Street Graph Pruning": 'IslandPruning.md' - Accessibility: 'Accessibility.md' - - NeTex and Siri compatibility: 'features-explained/Netex-Siri-Compatibility.md' + - NeTEx and SIRI compatibility: 'features-explained/Netex-Siri-Compatibility.md' - "Travel Time Analysis": 'Analysis.md' - "Logging": "Logging.md" - Development: From 1bfc8332c5a71a2ba390c03e5f75c1c287f506ac Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 8 Jan 2025 17:52:37 +0100 Subject: [PATCH 46/60] Fix ScheduledTransitAlertBuilder --- .../model/plan/ScheduledTransitLeg.java | 1 + .../plan/ScheduledTransitLegBuilder.java | 9 ++++++ .../plan/ScheduledTransitLegBuilderTest.java | 30 +++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/application/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLeg.java b/application/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLeg.java index 55e4bccfdec..ab912eae85b 100644 --- a/application/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLeg.java +++ b/application/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLeg.java @@ -98,6 +98,7 @@ protected ScheduledTransitLeg(ScheduledTransitLegBuilder builder) { getDistanceFromCoordinates( List.of(transitLegCoordinates.getFirst(), transitLegCoordinates.getLast()) ); + this.transitAlerts.addAll(builder.alerts()); } public ZoneId getZoneId() { diff --git a/application/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilder.java b/application/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilder.java index 3e9b5540b1c..e132137e982 100644 --- a/application/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilder.java +++ b/application/src/main/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilder.java @@ -3,7 +3,10 @@ import java.time.LocalDate; import java.time.ZoneId; import java.time.ZonedDateTime; +import java.util.HashSet; +import java.util.Set; import org.opentripplanner.model.transfer.ConstrainedTransfer; +import org.opentripplanner.routing.alertpatch.TransitAlert; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.timetable.TripOnServiceDate; import org.opentripplanner.transit.model.timetable.TripTimes; @@ -23,6 +26,7 @@ public class ScheduledTransitLegBuilder> private ConstrainedTransfer transferToNextLeg; private int generalizedCost; private Float accessibilityScore; + private Set alerts = new HashSet<>(); public ScheduledTransitLegBuilder() {} @@ -40,6 +44,7 @@ public ScheduledTransitLegBuilder(ScheduledTransitLeg original) { generalizedCost = original.getGeneralizedCost(); accessibilityScore = original.accessibilityScore(); zoneId = original.getZoneId(); + alerts = original.getTransitAlerts(); } public B withTripTimes(TripTimes tripTimes) { @@ -159,6 +164,10 @@ public Float accessibilityScore() { return accessibilityScore; } + public Set alerts() { + return alerts; + } + public ScheduledTransitLeg build() { return new ScheduledTransitLeg(this); } diff --git a/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java b/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java index 8d3d6ed7c1e..83871257ce2 100644 --- a/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java @@ -1,15 +1,25 @@ package org.opentripplanner.model.plan; +import static com.google.common.truth.Truth.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.time.LocalDate; +import java.util.Set; import org.junit.jupiter.api.Test; import org.opentripplanner._support.time.ZoneIds; +import org.opentripplanner.framework.i18n.I18NString; +import org.opentripplanner.routing.alertpatch.TransitAlert; import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; class ScheduledTransitLegBuilderTest { + private static final TransitAlert ALERT = TransitAlert + .of(id("alert")) + .withDescriptionText(I18NString.of("alert")) + .build(); + @Test void transferZoneId() { var pattern = TimetableRepositoryForTest.of().pattern(TransitMode.BUS).build(); @@ -28,4 +38,24 @@ void transferZoneId() { assertEquals(ZoneIds.BERLIN, withScore.getZoneId()); } + + @Test + void alerts() { + var pattern = TimetableRepositoryForTest.of().pattern(TransitMode.BUS).build(); + var leg = new ScheduledTransitLegBuilder<>() + .withZoneId(ZoneIds.BERLIN) + .withServiceDate(LocalDate.of(2023, 11, 15)) + .withTripPattern(pattern) + .withBoardStopIndexInPattern(0) + .withAlightStopIndexInPattern(1) + .build(); + + leg.addAlert(ALERT); + + var newLeg = new ScheduledTransitLegBuilder<>(leg); + + var withScore = newLeg.withAccessibilityScore(4f).build(); + + assertEquals(Set.of(ALERT), withScore.getTransitAlerts()); + } } From 7163f6a9154ede5f384c91ceec450b403f82d4e6 Mon Sep 17 00:00:00 2001 From: OTP Changelog Bot Date: Thu, 9 Jan 2025 15:21:03 +0000 Subject: [PATCH 47/60] Add changelog entry for #6262 [ci skip] --- doc/user/Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/user/Changelog.md b/doc/user/Changelog.md index b859f87f19a..14a9f6d83ed 100644 --- a/doc/user/Changelog.md +++ b/doc/user/Changelog.md @@ -70,6 +70,7 @@ based on merged pull requests. Search GitHub issues and pull requests for smalle - Add fallback name for corridors [#6303](https://github.com/opentripplanner/OpenTripPlanner/pull/6303) - Implement SIRI Lite [#6284](https://github.com/opentripplanner/OpenTripPlanner/pull/6284) - Add a matcher API for filters in the transit service used for regularStop lookup [#6234](https://github.com/opentripplanner/OpenTripPlanner/pull/6234) +- Make all polling updaters wait for graph update finish [#6262](https://github.com/opentripplanner/OpenTripPlanner/pull/6262) [](AUTOMATIC_CHANGELOG_PLACEHOLDER_DO_NOT_REMOVE) ## 2.6.0 (2024-09-18) From 98d8fd82cf282d434efadd795dc347d1e865ea12 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Thu, 9 Jan 2025 16:33:31 +0100 Subject: [PATCH 48/60] Remove unused import --- .../model/plan/ScheduledTransitLegBuilderTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java b/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java index 83871257ce2..c8ae617fd20 100644 --- a/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java @@ -1,6 +1,5 @@ package org.opentripplanner.model.plan; -import static com.google.common.truth.Truth.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; From f53245fdef475829f5a14cca1795fcce3287cb1a Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Thu, 9 Jan 2025 16:35:49 +0100 Subject: [PATCH 49/60] Fix formatting --- .../updater/alert/GtfsRealtimeAlertsUpdater.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java index 604a721c57d..8deddd35b61 100644 --- a/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java @@ -62,7 +62,7 @@ protected void runPolling() throws InterruptedException, ExecutionException { final FeedMessage feed = otpHttpClient.getAndMap( URI.create(url), this.headers.asMap(), - FeedMessage::parseFrom + FeedMessage::parseFrom ); long feedTimestamp = feed.getHeader().getTimestamp(); From 81d6c9b54b2f1d8063aa687b7ee346be0af742bf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:43:59 +0000 Subject: [PATCH 50/60] fix(deps): update jersey monorepo to v3.1.10 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7eb8dfffde8..eb494243d23 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ 2.53 2.18.2 4.0.5 - 3.1.9 + 3.1.10 5.11.4 1.14.1 5.6.0 From ffa99abb60851136751d42520989e86d097917fb Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Thu, 9 Jan 2025 16:52:50 +0100 Subject: [PATCH 51/60] Automerge patch version of jersey [ci skip] --- renovate.json5 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/renovate.json5 b/renovate.json5 index 557857bf54c..1394c6484b9 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -142,6 +142,15 @@ "automerge": true, "schedule": "on the 4th day of the month" }, + { + "groupName": "Low-risk dependencies (patch)", + "matchUpdateTypes": ["patch"], + "schedule": ["on the 27th day of the month"], + "reviewers": ["testower"], + "matchPackageNames": [ + "org.glassfish.jersey.{/,}**", + ] + }, { "description": "give some projects time to publish a changelog before opening the PR", "matchPackageNames": [ From edc3a7f4f920732fa3d499cb6784871291c952da Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Thu, 9 Jan 2025 17:05:28 +0100 Subject: [PATCH 52/60] Automerge protobuf only once a month [ci skip] --- renovate.json5 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/renovate.json5 b/renovate.json5 index 1394c6484b9..50134776150 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -101,7 +101,8 @@ "com.google.cloud:libraries-bom", "com.google.guava:guava", "io.micrometer:micrometer-registry-prometheus", - "io.micrometer:micrometer-registry-influx" + "io.micrometer:micrometer-registry-influx", + "com.google.protobuf:protobuf-java" ], "schedule": "on the 7th through 8th day of the month" }, From c5d1183e2a0412b48fadbf0a1b0bb7075b347465 Mon Sep 17 00:00:00 2001 From: Samuel Cedarbaum Date: Thu, 9 Jan 2025 19:46:09 -0500 Subject: [PATCH 53/60] Move TestDataFetcherDecorator to correct package path --- .../transmodel}/_support/TestDataFetcherDecorator.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename application/src/test/java/org/opentripplanner/{ext/transmodelapi => apis/transmodel}/_support/TestDataFetcherDecorator.java (100%) diff --git a/application/src/test/java/org/opentripplanner/ext/transmodelapi/_support/TestDataFetcherDecorator.java b/application/src/test/java/org/opentripplanner/apis/transmodel/_support/TestDataFetcherDecorator.java similarity index 100% rename from application/src/test/java/org/opentripplanner/ext/transmodelapi/_support/TestDataFetcherDecorator.java rename to application/src/test/java/org/opentripplanner/apis/transmodel/_support/TestDataFetcherDecorator.java From 872dbb36ee4f6fa7e1b076df7f88a1d67235f43c Mon Sep 17 00:00:00 2001 From: Samuel Cedarbaum Date: Thu, 9 Jan 2025 19:46:46 -0500 Subject: [PATCH 54/60] Add explicit cast when calling createFromDocumentedEnum --- .../org/opentripplanner/apis/transmodel/model/EnumTypes.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java index 2f8e69cc593..aab06381100 100644 --- a/application/src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java @@ -221,7 +221,7 @@ public class EnumTypes { public static final GraphQLEnumType OCCUPANCY_STATUS = createFromDocumentedEnum( "OccupancyStatus", - List.of( + List.>of( map("noData", OccupancyStatus.NO_DATA_AVAILABLE), map("empty", OccupancyStatus.EMPTY), map("manySeatsAvailable", OccupancyStatus.MANY_SEATS_AVAILABLE), From e23144bf9b611019f95cb1b4b2fa1f26df906b34 Mon Sep 17 00:00:00 2001 From: Samuel Cedarbaum Date: Thu, 9 Jan 2025 19:56:28 -0500 Subject: [PATCH 55/60] Add type annotation to OccupancyStatus instead of explicit cast --- .../org/opentripplanner/apis/transmodel/model/EnumTypes.java | 2 +- .../transit/model/timetable/OccupancyStatus.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java index aab06381100..2f8e69cc593 100644 --- a/application/src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java @@ -221,7 +221,7 @@ public class EnumTypes { public static final GraphQLEnumType OCCUPANCY_STATUS = createFromDocumentedEnum( "OccupancyStatus", - List.>of( + List.of( map("noData", OccupancyStatus.NO_DATA_AVAILABLE), map("empty", OccupancyStatus.EMPTY), map("manySeatsAvailable", OccupancyStatus.MANY_SEATS_AVAILABLE), diff --git a/application/src/main/java/org/opentripplanner/transit/model/timetable/OccupancyStatus.java b/application/src/main/java/org/opentripplanner/transit/model/timetable/OccupancyStatus.java index 9c32ca39394..fe760747ef4 100644 --- a/application/src/main/java/org/opentripplanner/transit/model/timetable/OccupancyStatus.java +++ b/application/src/main/java/org/opentripplanner/transit/model/timetable/OccupancyStatus.java @@ -9,7 +9,7 @@ *

* Descriptions are copied from the GTFS-RT specification with additions of SIRI nordic profile documentation. */ -public enum OccupancyStatus implements DocumentedEnum { +public enum OccupancyStatus implements DocumentedEnum { NO_DATA_AVAILABLE, EMPTY, MANY_SEATS_AVAILABLE, From 6a540d18e0d720a55c32b64c0575caf44016d7f1 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Fri, 10 Jan 2025 09:15:30 +0100 Subject: [PATCH 56/60] Remove testower from reviewers of jersey [ci skip] --- renovate.json5 | 1 - 1 file changed, 1 deletion(-) diff --git a/renovate.json5 b/renovate.json5 index 50134776150..100a91d959a 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -147,7 +147,6 @@ "groupName": "Low-risk dependencies (patch)", "matchUpdateTypes": ["patch"], "schedule": ["on the 27th day of the month"], - "reviewers": ["testower"], "matchPackageNames": [ "org.glassfish.jersey.{/,}**", ] From 1eb0556da113a86f560b3bdccdf8f9e8dc47ba8d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 12:53:23 +0000 Subject: [PATCH 57/60] chore(deps): update dependency jsdom to v26 --- client/package-lock.json | 183 ++++++++++++++++++++++++++++++++++----- client/package.json | 2 +- 2 files changed, 164 insertions(+), 21 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index a50d6d07f73..258494649cc 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -39,7 +39,7 @@ "eslint-plugin-react-hooks": "5.1.0", "eslint-plugin-react-refresh": "0.4.16", "globals": "15.14.0", - "jsdom": "25.0.1", + "jsdom": "26.0.0", "prettier": "3.4.2", "typescript": "5.7.2", "typescript-eslint": "8.19.0", @@ -207,6 +207,30 @@ "node": ">=14" } }, + "node_modules/@asamuzakjp/css-color": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-2.8.2.tgz", + "integrity": "sha512-RtWv9jFN2/bLExuZgFFZ0I3pWWeezAHGgrmjqGGWclATl1aDe3yhCUaI0Ilkp6OCk9zX7+FjvDasEX8Q9Rxc5w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@csstools/css-calc": "^2.1.1", + "@csstools/css-color-parser": "^3.0.7", + "@csstools/css-parser-algorithms": "^3.0.4", + "@csstools/css-tokenizer": "^3.0.3", + "lru-cache": "^11.0.2" + } + }, + "node_modules/@asamuzakjp/css-color/node_modules/lru-cache": { + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.2.tgz", + "integrity": "sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==", + "dev": true, + "license": "ISC", + "engines": { + "node": "20 || >=22" + } + }, "node_modules/@babel/code-frame": { "version": "7.26.2", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", @@ -1007,6 +1031,121 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@csstools/color-helpers": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-5.0.1.tgz", + "integrity": "sha512-MKtmkA0BX87PKaO1NFRTFH+UnkgnmySQOvNxJubsadusqPEC2aJ9MOQiMceZJJ6oitUl/i0L6u0M1IrmAOmgBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=18" + } + }, + "node_modules/@csstools/css-calc": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-2.1.1.tgz", + "integrity": "sha512-rL7kaUnTkL9K+Cvo2pnCieqNpTKgQzy5f+N+5Iuko9HAoasP+xgprVh7KN/MaJVvVL1l0EzQq2MoqBHKSrDrag==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^3.0.4", + "@csstools/css-tokenizer": "^3.0.3" + } + }, + "node_modules/@csstools/css-color-parser": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-3.0.7.tgz", + "integrity": "sha512-nkMp2mTICw32uE5NN+EsJ4f5N+IGFeCFu4bGpiKgb2Pq/7J/MpyLBeQ5ry4KKtRFZaYs6sTmcMYrSRIyj5DFKA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/color-helpers": "^5.0.1", + "@csstools/css-calc": "^2.1.1" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^3.0.4", + "@csstools/css-tokenizer": "^3.0.3" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.4.tgz", + "integrity": "sha512-Up7rBoV77rv29d3uKHUIVubz1BTcgyUK72IvCQAbfbMv584xHcGKCKbWh7i8hPrRJ7qU4Y8IO3IY9m+iTB7P3A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^3.0.3" + } + }, + "node_modules/@csstools/css-tokenizer": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-3.0.3.tgz", + "integrity": "sha512-UJnjoFsmxfKUdNYdWgOB0mWUypuLvAfQPH1+pyvRJs6euowbFkFC6P13w1l8mJyi3vxYMxc9kld5jZEGRQs6bw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/@envelop/core": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/@envelop/core/-/core-5.0.2.tgz", @@ -5178,12 +5317,14 @@ } }, "node_modules/cssstyle": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.1.0.tgz", - "integrity": "sha512-h66W1URKpBS5YMI/V8PyXvTMFT8SupJ1IzoIV8IeBC/ji8WVmrO8dGlTi+2dh6whmdk6BiKJLD/ZBkhWbcg6nA==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.2.1.tgz", + "integrity": "sha512-9+vem03dMXG7gDmZ62uqmRiMRNtinIZ9ZyuF6BdxzfOD+FdN5hretzynkn0ReS2DO2GSw76RWHs0UmJPI2zUjw==", "dev": true, + "license": "MIT", "dependencies": { - "rrweb-cssom": "^0.7.1" + "@asamuzakjp/css-color": "^2.8.2", + "rrweb-cssom": "^0.8.0" }, "engines": { "node": ">=18" @@ -7761,22 +7902,23 @@ "integrity": "sha512-SnZNcinB4RIcnEyZqFPdGPVgrg2AcnykiBy0sHVJQKHYeaLUvi3Exj+iaPpLnFVkDPZIV4U0yvgC9/R4uEAZ9g==" }, "node_modules/jsdom": { - "version": "25.0.1", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-25.0.1.tgz", - "integrity": "sha512-8i7LzZj7BF8uplX+ZyOlIz86V6TAsSs+np6m1kpW9u0JWi4z/1t+FzcK1aek+ybTnAC4KhBL4uXCNT0wcUIeCw==", + "version": "26.0.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-26.0.0.tgz", + "integrity": "sha512-BZYDGVAIriBWTpIxYzrXjv3E/4u8+/pSG5bQdIYCbNCGOvsPkDQfTVLAIXAf9ETdCpduCVTkDe2NNZ8NIwUVzw==", "dev": true, + "license": "MIT", "dependencies": { - "cssstyle": "^4.1.0", + "cssstyle": "^4.2.1", "data-urls": "^5.0.0", "decimal.js": "^10.4.3", - "form-data": "^4.0.0", + "form-data": "^4.0.1", "html-encoding-sniffer": "^4.0.0", "http-proxy-agent": "^7.0.2", - "https-proxy-agent": "^7.0.5", + "https-proxy-agent": "^7.0.6", "is-potential-custom-element-name": "^1.0.1", - "nwsapi": "^2.2.12", - "parse5": "^7.1.2", - "rrweb-cssom": "^0.7.1", + "nwsapi": "^2.2.16", + "parse5": "^7.2.1", + "rrweb-cssom": "^0.8.0", "saxes": "^6.0.0", "symbol-tree": "^3.2.4", "tough-cookie": "^5.0.0", @@ -7784,7 +7926,7 @@ "webidl-conversions": "^7.0.0", "whatwg-encoding": "^3.1.1", "whatwg-mimetype": "^4.0.0", - "whatwg-url": "^14.0.0", + "whatwg-url": "^14.1.0", "ws": "^8.18.0", "xml-name-validator": "^5.0.0" }, @@ -7792,7 +7934,7 @@ "node": ">=18" }, "peerDependencies": { - "canvas": "^2.11.2" + "canvas": "^3.0.0" }, "peerDependenciesMeta": { "canvas": { @@ -9455,10 +9597,11 @@ } }, "node_modules/rrweb-cssom": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.7.1.tgz", - "integrity": "sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==", - "dev": true + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.8.0.tgz", + "integrity": "sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==", + "dev": true, + "license": "MIT" }, "node_modules/run-async": { "version": "2.4.1", diff --git a/client/package.json b/client/package.json index b16a1fe8527..d81511d93c9 100644 --- a/client/package.json +++ b/client/package.json @@ -48,7 +48,7 @@ "eslint-plugin-react-hooks": "5.1.0", "eslint-plugin-react-refresh": "0.4.16", "globals": "15.14.0", - "jsdom": "25.0.1", + "jsdom": "26.0.0", "prettier": "3.4.2", "typescript": "5.7.2", "typescript-eslint": "8.19.0", From 77e29087dea17be0312171364cd1cd732c17e607 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 22:14:36 +0000 Subject: [PATCH 58/60] fix(deps): update debug ui dependencies (non-major) --- client/package-lock.json | 217 ++++++++++++++++++++++----------------- client/package.json | 16 +-- 2 files changed, 129 insertions(+), 104 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index 258494649cc..bb145274bd4 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -17,21 +17,21 @@ "react": "19.0.0", "react-bootstrap": "2.10.7", "react-dom": "19.0.0", - "react-map-gl": "7.1.7" + "react-map-gl": "7.1.8" }, "devDependencies": { - "@eslint/compat": "1.2.4", - "@eslint/js": "9.17.0", + "@eslint/compat": "1.2.5", + "@eslint/js": "9.18.0", "@graphql-codegen/cli": "5.0.3", "@graphql-codegen/client-preset": "4.5.1", "@graphql-codegen/introspection": "4.0.3", "@parcel/watcher": "2.5.0", "@testing-library/react": "16.1.0", - "@types/react": "19.0.1", + "@types/react": "19.0.4", "@types/react-dom": "19.0.2", "@vitejs/plugin-react": "4.3.4", "@vitest/coverage-v8": "2.1.8", - "eslint": "9.17.0", + "eslint": "9.18.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-import": "2.31.0", "eslint-plugin-jsx-a11y": "6.10.2", @@ -41,9 +41,9 @@ "globals": "15.14.0", "jsdom": "26.0.0", "prettier": "3.4.2", - "typescript": "5.7.2", - "typescript-eslint": "8.19.0", - "vite": "6.0.3", + "typescript": "5.7.3", + "typescript-eslint": "8.19.1", + "vite": "6.0.7", "vitest": "2.1.8" } }, @@ -1611,10 +1611,11 @@ } }, "node_modules/@eslint/compat": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@eslint/compat/-/compat-1.2.4.tgz", - "integrity": "sha512-S8ZdQj/N69YAtuqFt7653jwcvuUj131+6qGLUyDqfDg1OIoBQ66OCuXC473YQfO2AaxITTutiRQiDwoo7ZLYyg==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@eslint/compat/-/compat-1.2.5.tgz", + "integrity": "sha512-5iuG/StT+7OfvhoBHPlmxkPA9om6aDUFgmD4+mWKAGsYt4vCe8rypneG03AuseyRHBmcCLXQtIH5S26tIoggLg==", "dev": true, + "license": "Apache-2.0", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, @@ -1642,10 +1643,11 @@ } }, "node_modules/@eslint/core": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.9.1.tgz", - "integrity": "sha512-GuUdqkyyzQI5RMIWkHhvTWLCyLo1jNK3vzkSyaExH5kHPDHcuL2VOpHjmMY+y3+NC69qAKToBqldTBgYeLSr9Q==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.10.0.tgz", + "integrity": "sha512-gFHJ+xBOo4G3WRlR1e/3G8A6/KZAH6zcE/hkLRCZTi/B9avAG365QhFA8uOGzTMqgTghpn7/fSnscW++dpMSAw==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@types/json-schema": "^7.0.15" }, @@ -1689,10 +1691,11 @@ } }, "node_modules/@eslint/js": { - "version": "9.17.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.17.0.tgz", - "integrity": "sha512-Sxc4hqcs1kTu0iID3kcZDW3JHq2a77HO9P8CP6YEA/FpH3Ll8UXE2r/86Rz9YJLKme39S9vU5OWNjC6Xl0Cr3w==", + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.18.0.tgz", + "integrity": "sha512-fK6L7rxcq6/z+AaQMtiFTkvbHkBLNlwyRxHpKawP0x3u9+NC6MQTnFW+AdpwC6gfHTW0051cokQgtTN2FqlxQA==", "dev": true, + "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } @@ -1707,11 +1710,13 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.4.tgz", - "integrity": "sha512-zSkKow6H5Kdm0ZUQUB2kV5JIXqoG0+uH5YADhaEHswm664N9Db8dXSi0nMJpacpMf+MyyglF1vnZohpEg5yUtg==", + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.5.tgz", + "integrity": "sha512-lB05FkqEdUg2AA0xEbUz0SnkXT1LcCTa438W4IWTUh4hdOnVbQyOJ81OrDXsJk/LSiJHubgGEFoR5EHq1NsH1A==", "dev": true, + "license": "Apache-2.0", "dependencies": { + "@eslint/core": "^0.10.0", "levn": "^0.4.1" }, "engines": { @@ -3875,9 +3880,10 @@ "integrity": "sha512-gNMvNH49DJ7OJYv+KAKn0Xp45p8PLl6zo2YnvDIbTd4J6MER2BmWN49TG7n9LvkyihINxeKW8+3bfS2yDC9dzQ==" }, "node_modules/@types/react": { - "version": "19.0.1", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.0.1.tgz", - "integrity": "sha512-YW6614BDhqbpR5KtUYzTA+zlA7nayzJRA9ljz9CQoxthR0sDisYZLuvSMsil36t4EH/uAt8T52Xb4sVw17G+SQ==", + "version": "19.0.4", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.0.4.tgz", + "integrity": "sha512-3O4QisJDYr1uTUMZHA2YswiQZRq+Pd8D+GdVFYikTutYsTz+QZgWkAPnP7rx9txoI6EXKcPiluMqWPFV3tT9Wg==", + "license": "MIT", "dependencies": { "csstype": "^3.0.2" } @@ -3922,20 +3928,21 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.19.0.tgz", - "integrity": "sha512-NggSaEZCdSrFddbctrVjkVZvFC6KGfKfNK0CU7mNK/iKHGKbzT4Wmgm08dKpcZECBu9f5FypndoMyRHkdqfT1Q==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.19.1.tgz", + "integrity": "sha512-tJzcVyvvb9h/PB96g30MpxACd9IrunT7GF9wfA9/0TJ1LxGOJx1TdPzSbBBnNED7K9Ka8ybJsnEpiXPktolTLg==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.19.0", - "@typescript-eslint/type-utils": "8.19.0", - "@typescript-eslint/utils": "8.19.0", - "@typescript-eslint/visitor-keys": "8.19.0", + "@typescript-eslint/scope-manager": "8.19.1", + "@typescript-eslint/type-utils": "8.19.1", + "@typescript-eslint/utils": "8.19.1", + "@typescript-eslint/visitor-keys": "8.19.1", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", - "ts-api-utils": "^1.3.0" + "ts-api-utils": "^2.0.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3951,15 +3958,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.19.0.tgz", - "integrity": "sha512-6M8taKyOETY1TKHp0x8ndycipTVgmp4xtg5QpEZzXxDhNvvHOJi5rLRkLr8SK3jTgD5l4fTlvBiRdfsuWydxBw==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.19.1.tgz", + "integrity": "sha512-67gbfv8rAwawjYx3fYArwldTQKoYfezNUT4D5ioWetr/xCrxXxvleo3uuiFuKfejipvq+og7mjz3b0G2bVyUCw==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.19.0", - "@typescript-eslint/types": "8.19.0", - "@typescript-eslint/typescript-estree": "8.19.0", - "@typescript-eslint/visitor-keys": "8.19.0", + "@typescript-eslint/scope-manager": "8.19.1", + "@typescript-eslint/types": "8.19.1", + "@typescript-eslint/typescript-estree": "8.19.1", + "@typescript-eslint/visitor-keys": "8.19.1", "debug": "^4.3.4" }, "engines": { @@ -3975,13 +3983,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.19.0.tgz", - "integrity": "sha512-hkoJiKQS3GQ13TSMEiuNmSCvhz7ujyqD1x3ShbaETATHrck+9RaDdUbt+osXaUuns9OFwrDTTrjtwsU8gJyyRA==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.19.1.tgz", + "integrity": "sha512-60L9KIuN/xgmsINzonOcMDSB8p82h95hoBfSBtXuO4jlR1R9L1xSkmVZKgCPVfavDlXihh4ARNjXhh1gGnLC7Q==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.19.0", - "@typescript-eslint/visitor-keys": "8.19.0" + "@typescript-eslint/types": "8.19.1", + "@typescript-eslint/visitor-keys": "8.19.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3992,15 +4001,16 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.19.0.tgz", - "integrity": "sha512-TZs0I0OSbd5Aza4qAMpp1cdCYVnER94IziudE3JU328YUHgWu9gwiwhag+fuLeJ2LkWLXI+F/182TbG+JaBdTg==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.19.1.tgz", + "integrity": "sha512-Rp7k9lhDKBMRJB/nM9Ksp1zs4796wVNyihG9/TU9R6KCJDNkQbc2EOKjrBtLYh3396ZdpXLtr/MkaSEmNMtykw==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.19.0", - "@typescript-eslint/utils": "8.19.0", + "@typescript-eslint/typescript-estree": "8.19.1", + "@typescript-eslint/utils": "8.19.1", "debug": "^4.3.4", - "ts-api-utils": "^1.3.0" + "ts-api-utils": "^2.0.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4015,10 +4025,11 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.19.0.tgz", - "integrity": "sha512-8XQ4Ss7G9WX8oaYvD4OOLCjIQYgRQxO+qCiR2V2s2GxI9AUpo7riNwo6jDhKtTcaJjT8PY54j2Yb33kWtSJsmA==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.19.1.tgz", + "integrity": "sha512-JBVHMLj7B1K1v1051ZaMMgLW4Q/jre5qGK0Ew6UgXz1Rqh+/xPzV1aW581OM00X6iOfyr1be+QyW8LOUf19BbA==", "dev": true, + "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, @@ -4028,19 +4039,20 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.19.0.tgz", - "integrity": "sha512-WW9PpDaLIFW9LCbucMSdYUuGeFUz1OkWYS/5fwZwTA+l2RwlWFdJvReQqMUMBw4yJWJOfqd7An9uwut2Oj8sLw==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.19.1.tgz", + "integrity": "sha512-jk/TZwSMJlxlNnqhy0Eod1PNEvCkpY6MXOXE/WLlblZ6ibb32i2We4uByoKPv1d0OD2xebDv4hbs3fm11SMw8Q==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.19.0", - "@typescript-eslint/visitor-keys": "8.19.0", + "@typescript-eslint/types": "8.19.1", + "@typescript-eslint/visitor-keys": "8.19.1", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", - "ts-api-utils": "^1.3.0" + "ts-api-utils": "^2.0.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4058,6 +4070,7 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } @@ -4067,6 +4080,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" }, @@ -4082,6 +4096,7 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -4090,15 +4105,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.19.0.tgz", - "integrity": "sha512-PTBG+0oEMPH9jCZlfg07LCB2nYI0I317yyvXGfxnvGvw4SHIOuRnQ3kadyyXY6tGdChusIHIbM5zfIbp4M6tCg==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.19.1.tgz", + "integrity": "sha512-IxG5gLO0Ne+KaUc8iW1A+XuKLd63o4wlbI1Zp692n1xojCl/THvgIKXJXBZixTh5dd5+yTJ/VXH7GJaaw21qXA==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.19.0", - "@typescript-eslint/types": "8.19.0", - "@typescript-eslint/typescript-estree": "8.19.0" + "@typescript-eslint/scope-manager": "8.19.1", + "@typescript-eslint/types": "8.19.1", + "@typescript-eslint/typescript-estree": "8.19.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4113,12 +4129,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.19.0.tgz", - "integrity": "sha512-mCFtBbFBJDCNCWUl5y6sZSCHXw1DEFEk3c/M3nRK2a4XUB8StGFtmcEMizdjKuBzB6e/smJAAWYug3VrdLMr1w==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.19.1.tgz", + "integrity": "sha512-fzmjU8CHK853V/avYZAvuVut3ZTfwN5YtMaoi+X9Y9MA9keaWNHC3zEQ9zvyX/7Hj+5JkNyK1l7TOR2hevHB6Q==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.19.0", + "@typescript-eslint/types": "8.19.1", "eslint-visitor-keys": "^4.2.0" }, "engines": { @@ -5915,18 +5932,19 @@ } }, "node_modules/eslint": { - "version": "9.17.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.17.0.tgz", - "integrity": "sha512-evtlNcpJg+cZLcnVKwsai8fExnqjGPicK7gnUtlNuzu+Fv9bI0aLpND5T44VLQtoMEnI57LoXO9XAkIXwohKrA==", + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.18.0.tgz", + "integrity": "sha512-+waTfRWQlSbpt3KWE+CjrPPYnbq9kfZIYUqapc0uBXyjTp8aYXZDsUH16m39Ryq3NjAVP4tjuF7KaukeqoCoaA==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.19.0", - "@eslint/core": "^0.9.0", + "@eslint/core": "^0.10.0", "@eslint/eslintrc": "^3.2.0", - "@eslint/js": "9.17.0", - "@eslint/plugin-kit": "^0.2.3", + "@eslint/js": "9.18.0", + "@eslint/plugin-kit": "^0.2.5", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.1", @@ -9317,9 +9335,10 @@ "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==" }, "node_modules/react-map-gl": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/react-map-gl/-/react-map-gl-7.1.7.tgz", - "integrity": "sha512-mwjc0obkBJOXCcoXQr3VoLqmqwo9vS4bXfbGsdxXzEgVCv/PM0v+1QggL7W0d/ccIy+VCjbXNlGij+PENz6VNg==", + "version": "7.1.8", + "resolved": "https://registry.npmjs.org/react-map-gl/-/react-map-gl-7.1.8.tgz", + "integrity": "sha512-zwF16XMOdOKH4py5ehS1bgQIChqW8UN3b1bXps+JnADbYLSbOoUPQ3tNw0EZ2OTBWArR5aaQlhlEqg4lE47T8A==", + "license": "MIT", "dependencies": { "@maplibre/maplibre-gl-style-spec": "^19.2.1", "@types/mapbox-gl": ">=1.0.0" @@ -9343,6 +9362,7 @@ "version": "19.3.3", "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-19.3.3.tgz", "integrity": "sha512-cOZZOVhDSulgK0meTsTkmNXb1ahVvmTmWmfx9gRBwc6hq98wS9JP35ESIoNq3xqEan+UN+gn8187Z6E4NKhLsw==", + "license": "ISC", "dependencies": { "@mapbox/jsonlint-lines-primitives": "~2.0.2", "@mapbox/unitbezier": "^0.0.1", @@ -9360,7 +9380,8 @@ "node_modules/react-map-gl/node_modules/json-stringify-pretty-compact": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/json-stringify-pretty-compact/-/json-stringify-pretty-compact-3.0.0.tgz", - "integrity": "sha512-Rc2suX5meI0S3bfdZuA7JMFBGkJ875ApfVyq2WHELjBiiG22My/l7/8zPpH/CfFVQHuVLd8NLR0nv6vi0BYYKA==" + "integrity": "sha512-Rc2suX5meI0S3bfdZuA7JMFBGkJ875ApfVyq2WHELjBiiG22My/l7/8zPpH/CfFVQHuVLd8NLR0nv6vi0BYYKA==", + "license": "MIT" }, "node_modules/react-refresh": { "version": "0.14.2", @@ -10529,15 +10550,16 @@ } }, "node_modules/ts-api-utils": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz", - "integrity": "sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.0.tgz", + "integrity": "sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">=16" + "node": ">=18.12" }, "peerDependencies": { - "typescript": ">=4.2.0" + "typescript": ">=4.8.4" } }, "node_modules/ts-log": { @@ -10674,10 +10696,11 @@ } }, "node_modules/typescript": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", - "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -10687,14 +10710,15 @@ } }, "node_modules/typescript-eslint": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.19.0.tgz", - "integrity": "sha512-Ni8sUkVWYK4KAcTtPjQ/UTiRk6jcsuDhPpxULapUDi8A/l8TSBk+t1GtJA1RsCzIJg0q6+J7bf35AwQigENWRQ==", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.19.1.tgz", + "integrity": "sha512-LKPUQpdEMVOeKluHi8md7rwLcoXHhwvWp3x+sJkMuq3gGm9yaYJtPo8sRZSblMFJ5pcOGCAak/scKf1mvZDlQw==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.19.0", - "@typescript-eslint/parser": "8.19.0", - "@typescript-eslint/utils": "8.19.0" + "@typescript-eslint/eslint-plugin": "8.19.1", + "@typescript-eslint/parser": "8.19.1", + "@typescript-eslint/utils": "8.19.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -10899,12 +10923,13 @@ } }, "node_modules/vite": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.0.3.tgz", - "integrity": "sha512-Cmuo5P0ENTN6HxLSo6IHsjCLn/81Vgrp81oaiFFMRa8gGDj5xEjIcEpf2ZymZtZR8oU0P2JX5WuUp/rlXcHkAw==", + "version": "6.0.7", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.0.7.tgz", + "integrity": "sha512-RDt8r/7qx9940f8FcOIAH9PTViRrghKaK2K1jY3RaAURrEUbm9Du1mJ72G+jlhtG3WwodnfzY8ORQZbBavZEAQ==", "dev": true, + "license": "MIT", "dependencies": { - "esbuild": "^0.24.0", + "esbuild": "^0.24.2", "postcss": "^8.4.49", "rollup": "^4.23.0" }, diff --git a/client/package.json b/client/package.json index d81511d93c9..78180de6b6a 100644 --- a/client/package.json +++ b/client/package.json @@ -26,21 +26,21 @@ "react": "19.0.0", "react-bootstrap": "2.10.7", "react-dom": "19.0.0", - "react-map-gl": "7.1.7" + "react-map-gl": "7.1.8" }, "devDependencies": { - "@eslint/compat": "1.2.4", - "@eslint/js": "9.17.0", + "@eslint/compat": "1.2.5", + "@eslint/js": "9.18.0", "@graphql-codegen/cli": "5.0.3", "@graphql-codegen/client-preset": "4.5.1", "@graphql-codegen/introspection": "4.0.3", "@parcel/watcher": "2.5.0", "@testing-library/react": "16.1.0", - "@types/react": "19.0.1", + "@types/react": "19.0.4", "@types/react-dom": "19.0.2", "@vitejs/plugin-react": "4.3.4", "@vitest/coverage-v8": "2.1.8", - "eslint": "9.17.0", + "eslint": "9.18.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-import": "2.31.0", "eslint-plugin-jsx-a11y": "6.10.2", @@ -50,9 +50,9 @@ "globals": "15.14.0", "jsdom": "26.0.0", "prettier": "3.4.2", - "typescript": "5.7.2", - "typescript-eslint": "8.19.0", - "vite": "6.0.3", + "typescript": "5.7.3", + "typescript-eslint": "8.19.1", + "vite": "6.0.7", "vitest": "2.1.8" } } From 71bb5fa9583f837c06899f5a378dba0c05cda38e Mon Sep 17 00:00:00 2001 From: OTP Bot Date: Sat, 11 Jan 2025 19:24:18 +0000 Subject: [PATCH 59/60] Upgrade debug client to version 2025/01/2025-01-11T19:23 --- application/src/client/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/src/client/index.html b/application/src/client/index.html index db412af9df5..d3dd8544a53 100644 --- a/application/src/client/index.html +++ b/application/src/client/index.html @@ -5,8 +5,8 @@ OTP Debug - - + +

From 0312487d246402fcf4b67c7e0c2d5aaf6fe3af20 Mon Sep 17 00:00:00 2001 From: OTP Changelog Bot Date: Mon, 13 Jan 2025 13:23:01 +0000 Subject: [PATCH 60/60] Add changelog entry for #6368 [ci skip] --- doc/user/Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/user/Changelog.md b/doc/user/Changelog.md index 14a9f6d83ed..5f4e1a054e2 100644 --- a/doc/user/Changelog.md +++ b/doc/user/Changelog.md @@ -71,6 +71,7 @@ based on merged pull requests. Search GitHub issues and pull requests for smalle - Implement SIRI Lite [#6284](https://github.com/opentripplanner/OpenTripPlanner/pull/6284) - Add a matcher API for filters in the transit service used for regularStop lookup [#6234](https://github.com/opentripplanner/OpenTripPlanner/pull/6234) - Make all polling updaters wait for graph update finish [#6262](https://github.com/opentripplanner/OpenTripPlanner/pull/6262) +- When using ScheduledTransitLeg's copy builder, also copy alerts [#6368](https://github.com/opentripplanner/OpenTripPlanner/pull/6368) [](AUTOMATIC_CHANGELOG_PLACEHOLDER_DO_NOT_REMOVE) ## 2.6.0 (2024-09-18)