Add support for sandboxed realtime vehicle parking updaters#3796
Conversation
* use common DataSource interface * extract generic xml and json updaters
optionsome
left a comment
There was a problem hiding this comment.
Need feedback on the few comments before I'll finish up this pr. I'll also plan to add updater for HSL park and ride in the scope of this pr.
| } | ||
| for (VehicleParkingUpdaterParameters configItem : config.getVehicleParkingUpdaterParameters()) { | ||
| updaters.add(new VehicleParkingUpdater(configItem)); | ||
| var source = VehicleParkingDataSourceFactory.create(configItem); |
There was a problem hiding this comment.
Should this be moved into the updater like it is in VehicleRentalUpdater?
There was a problem hiding this comment.
We thought it's better to do this outside of the data source constructor. Changed the vehicle rental to be like that too 124c25b
|
|
||
| public static DataSource<VehicleParking> create(VehicleParkingUpdaterParameters source) { | ||
| switch (source.getSourceType()) { | ||
| case KML: return new KmlBikeParkDataSource(source.getUrl(), source.getFeedId(), source.getNamePrefix(), source.isZip()); |
There was a problem hiding this comment.
Should we create different parameter classes for different updaters that extend the generic parameters similarly as in vehicle rental instead of handpicking parameters from one "VehicleParkingUpdaterParameters" into different data source?
There was a problem hiding this comment.
We thought it would be better to have different parameter classes for different updaters. We discussed that these parameters shouldn't extend any generic parameter class. However, while doing the changes in 0901f2f, I ended up implementing it so it extends a generic VehicleRentalUpdaterParameters because all the updaters implement PollingGraphUpdaterParameters and have a data source enum value.
| if (bicycleSpaces == null && carSpaces == null && wheelchairAccessibleCarSpaces == null) { | ||
| return null; | ||
| } | ||
| return createVehiclePlaces(carSpaces, wheelchairAccessibleCarSpaces, bicycleSpaces); |
There was a problem hiding this comment.
The createVehiclePlaces method can be deleted in favor of the builder.
There was a problem hiding this comment.
The method is also used when creating the capacity and there is not that much room for refactoring while still keeping track if the capacity should be null or an instance of VehicleParkingSpaces.
Co-authored-by: Thomas Gran <t2gran@gmail.com>
leonardehrenfried
left a comment
There was a problem hiding this comment.
This looks really great work.
I think some of that code comes from our downstream fork which we have been running in prod for quite a while so have high confidence that it works well.
Also thanks for the refactoring!
Summary
Add support for realtime vehicle parking updaters and refactor data source code to be shared between vehicle rental and vehicle parking updaters. Adds
useVehicleParkingAvailabilityInformationquery parameter.Issue
Relates to #3432
Unit tests
Added unit tests.
Code style
Have you followed the suggested code style?
Yes
Documentation
Updated documentation
Changelog
From title