getVehicleParkingGroups();
+}
diff --git a/application/src/main/java/org/opentripplanner/service/vehicleparking/VehicleParkingService.java b/application/src/main/java/org/opentripplanner/service/vehicleparking/VehicleParkingService.java
new file mode 100644
index 00000000000..4603367979e
--- /dev/null
+++ b/application/src/main/java/org/opentripplanner/service/vehicleparking/VehicleParkingService.java
@@ -0,0 +1,25 @@
+package org.opentripplanner.service.vehicleparking;
+
+import com.google.common.collect.ListMultimap;
+import java.util.Collection;
+import org.opentripplanner.service.vehicleparking.model.VehicleParking;
+import org.opentripplanner.service.vehicleparking.model.VehicleParkingGroup;
+
+/**
+ * The read-only service for getting information about parking facilities.
+ *
+ * For writing data see {@link VehicleParkingRepository}
+ */
+public interface VehicleParkingService {
+ Collection listBikeParks();
+
+ Collection listCarParks();
+
+ Collection listVehicleParkings();
+
+ ListMultimap listVehicleParkingGroups();
+
+ boolean hasBikeParking();
+
+ boolean hasCarParking();
+}
diff --git a/application/src/main/java/org/opentripplanner/service/vehicleparking/configure/VehicleParkingRepositoryModule.java b/application/src/main/java/org/opentripplanner/service/vehicleparking/configure/VehicleParkingRepositoryModule.java
new file mode 100644
index 00000000000..23c5b3e0e51
--- /dev/null
+++ b/application/src/main/java/org/opentripplanner/service/vehicleparking/configure/VehicleParkingRepositoryModule.java
@@ -0,0 +1,12 @@
+package org.opentripplanner.service.vehicleparking.configure;
+
+import dagger.Binds;
+import dagger.Module;
+import org.opentripplanner.service.vehicleparking.VehicleParkingRepository;
+import org.opentripplanner.service.vehicleparking.internal.DefaultVehicleParkingRepository;
+
+@Module
+public interface VehicleParkingRepositoryModule {
+ @Binds
+ VehicleParkingRepository bind(DefaultVehicleParkingRepository repo);
+}
diff --git a/application/src/main/java/org/opentripplanner/service/vehicleparking/configure/VehicleParkingServiceModule.java b/application/src/main/java/org/opentripplanner/service/vehicleparking/configure/VehicleParkingServiceModule.java
new file mode 100644
index 00000000000..50dbe4b2bcb
--- /dev/null
+++ b/application/src/main/java/org/opentripplanner/service/vehicleparking/configure/VehicleParkingServiceModule.java
@@ -0,0 +1,12 @@
+package org.opentripplanner.service.vehicleparking.configure;
+
+import dagger.Binds;
+import dagger.Module;
+import org.opentripplanner.service.vehicleparking.VehicleParkingService;
+import org.opentripplanner.service.vehicleparking.internal.DefaultVehicleParkingService;
+
+@Module
+public interface VehicleParkingServiceModule {
+ @Binds
+ VehicleParkingService bind(DefaultVehicleParkingService service);
+}
diff --git a/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingService.java b/application/src/main/java/org/opentripplanner/service/vehicleparking/internal/DefaultVehicleParkingRepository.java
similarity index 65%
rename from application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingService.java
rename to application/src/main/java/org/opentripplanner/service/vehicleparking/internal/DefaultVehicleParkingRepository.java
index b0c08a2309b..ef8f9db99bf 100644
--- a/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingService.java
+++ b/application/src/main/java/org/opentripplanner/service/vehicleparking/internal/DefaultVehicleParkingRepository.java
@@ -1,23 +1,23 @@
-package org.opentripplanner.routing.vehicle_parking;
+package org.opentripplanner.service.vehicleparking.internal;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableListMultimap;
+import com.google.common.collect.ListMultimap;
import com.google.common.collect.Multimap;
-import java.io.Serializable;
+import jakarta.inject.Inject;
+import jakarta.inject.Singleton;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-import java.util.stream.Stream;
+import org.opentripplanner.service.vehicleparking.VehicleParkingRepository;
+import org.opentripplanner.service.vehicleparking.model.VehicleParking;
+import org.opentripplanner.service.vehicleparking.model.VehicleParkingGroup;
-/**
- * Service that holds all the {@link VehicleParking} instances and an index for fetching parking
- * locations within a {@link VehicleParkingGroup}. This class is thread-safe because the collections
- * held here are immutable and only updated in atomic operations that replace the existing
- * collection with a new copy.
- *
- * THIS CLASS IS THREAD-SAFE
- */
-public class VehicleParkingService implements Serializable {
+@Singleton
+public class DefaultVehicleParkingRepository implements VehicleParkingRepository {
+
+ @Inject
+ public DefaultVehicleParkingRepository() {}
/**
* To ensure that his is thread-safe, the set stored here should always be immutable.
@@ -38,6 +38,7 @@ public class VehicleParkingService implements Serializable {
* service by replacing the existing with a new copy that includes old ones that were not removed
* in the update and the new ones that were added in the update.
*/
+ @Override
public void updateVehicleParking(
Collection parkingToAdd,
Collection parkingToRemove
@@ -65,27 +66,13 @@ public void updateVehicleParking(
vehicleParkings = Set.copyOf(updatedVehicleParkings);
}
- public Stream getBikeParks() {
- return vehicleParkings.stream().filter(VehicleParking::hasBicyclePlaces);
- }
-
- public Stream getCarParks() {
- return vehicleParkings.stream().filter(VehicleParking::hasAnyCarPlaces);
- }
-
- public Stream getVehicleParkings() {
- return vehicleParkings.stream();
+ @Override
+ public Collection listVehicleParkings() {
+ return Set.copyOf(vehicleParkings);
}
- public ImmutableListMultimap getVehicleParkingGroups() {
+ @Override
+ public ListMultimap getVehicleParkingGroups() {
return vehicleParkingGroups;
}
-
- public boolean hasBikeParking() {
- return vehicleParkings.stream().anyMatch(VehicleParking::hasBicyclePlaces);
- }
-
- public boolean hasCarParking() {
- return vehicleParkings.stream().anyMatch(VehicleParking::hasAnyCarPlaces);
- }
}
diff --git a/application/src/main/java/org/opentripplanner/service/vehicleparking/internal/DefaultVehicleParkingService.java b/application/src/main/java/org/opentripplanner/service/vehicleparking/internal/DefaultVehicleParkingService.java
new file mode 100644
index 00000000000..b874c4338b7
--- /dev/null
+++ b/application/src/main/java/org/opentripplanner/service/vehicleparking/internal/DefaultVehicleParkingService.java
@@ -0,0 +1,68 @@
+package org.opentripplanner.service.vehicleparking.internal;
+
+import com.google.common.collect.ListMultimap;
+import jakarta.inject.Inject;
+import jakarta.inject.Singleton;
+import java.io.Serializable;
+import java.util.Collection;
+import org.opentripplanner.service.vehicleparking.VehicleParkingRepository;
+import org.opentripplanner.service.vehicleparking.VehicleParkingService;
+import org.opentripplanner.service.vehicleparking.model.VehicleParking;
+import org.opentripplanner.service.vehicleparking.model.VehicleParkingGroup;
+
+/**
+ * Service that holds all the {@link VehicleParking} instances and an index for fetching parking
+ * locations within a {@link VehicleParkingGroup}. This class is thread-safe because the collections
+ * held here are immutable and only updated in atomic operations that replace the existing
+ * collection with a new copy.
+ *
+ * THIS CLASS IS THREAD-SAFE
+ */
+@Singleton
+public class DefaultVehicleParkingService implements Serializable, VehicleParkingService {
+
+ private final VehicleParkingRepository repository;
+
+ @Inject
+ public DefaultVehicleParkingService(VehicleParkingRepository repository) {
+ this.repository = repository;
+ }
+
+ @Override
+ public Collection listBikeParks() {
+ return repository
+ .listVehicleParkings()
+ .stream()
+ .filter(VehicleParking::hasBicyclePlaces)
+ .toList();
+ }
+
+ @Override
+ public Collection listCarParks() {
+ return repository
+ .listVehicleParkings()
+ .stream()
+ .filter(VehicleParking::hasAnyCarPlaces)
+ .toList();
+ }
+
+ @Override
+ public Collection listVehicleParkings() {
+ return repository.listVehicleParkings();
+ }
+
+ @Override
+ public ListMultimap listVehicleParkingGroups() {
+ return repository.getVehicleParkingGroups();
+ }
+
+ @Override
+ public boolean hasBikeParking() {
+ return repository.listVehicleParkings().stream().anyMatch(VehicleParking::hasBicyclePlaces);
+ }
+
+ @Override
+ public boolean hasCarParking() {
+ return repository.listVehicleParkings().stream().anyMatch(VehicleParking::hasAnyCarPlaces);
+ }
+}
diff --git a/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParking.java b/application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParking.java
similarity index 99%
rename from application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParking.java
rename to application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParking.java
index 4e71ecd1c68..c9539f21eef 100644
--- a/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParking.java
+++ b/application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParking.java
@@ -1,4 +1,4 @@
-package org.opentripplanner.routing.vehicle_parking;
+package org.opentripplanner.service.vehicleparking.model;
import java.io.Serializable;
import java.util.ArrayList;
diff --git a/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingEntrance.java b/application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingEntrance.java
similarity index 98%
rename from application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingEntrance.java
rename to application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingEntrance.java
index f6bc584fb18..d905441641b 100644
--- a/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingEntrance.java
+++ b/application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingEntrance.java
@@ -1,4 +1,4 @@
-package org.opentripplanner.routing.vehicle_parking;
+package org.opentripplanner.service.vehicleparking.model;
import java.io.Serializable;
import java.util.Objects;
diff --git a/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingGroup.java b/application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingGroup.java
similarity index 97%
rename from application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingGroup.java
rename to application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingGroup.java
index 74ffedc0dcb..07548efa11a 100644
--- a/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingGroup.java
+++ b/application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingGroup.java
@@ -1,4 +1,4 @@
-package org.opentripplanner.routing.vehicle_parking;
+package org.opentripplanner.service.vehicleparking.model;
import java.util.Objects;
import javax.annotation.Nullable;
diff --git a/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingGroupBuilder.java b/application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingGroupBuilder.java
similarity index 93%
rename from application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingGroupBuilder.java
rename to application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingGroupBuilder.java
index 42603e33159..7f109f38002 100644
--- a/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingGroupBuilder.java
+++ b/application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingGroupBuilder.java
@@ -1,4 +1,4 @@
-package org.opentripplanner.routing.vehicle_parking;
+package org.opentripplanner.service.vehicleparking.model;
import org.opentripplanner.framework.geometry.WgsCoordinate;
import org.opentripplanner.framework.i18n.I18NString;
diff --git a/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingHelper.java b/application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingHelper.java
similarity index 98%
rename from application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingHelper.java
rename to application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingHelper.java
index 257f2805ca2..5832a8d5f91 100644
--- a/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingHelper.java
+++ b/application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingHelper.java
@@ -1,4 +1,4 @@
-package org.opentripplanner.routing.vehicle_parking;
+package org.opentripplanner.service.vehicleparking.model;
import java.util.List;
import java.util.Objects;
diff --git a/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingSpaces.java b/application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingSpaces.java
similarity index 98%
rename from application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingSpaces.java
rename to application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingSpaces.java
index eb50440651b..6827e6af198 100644
--- a/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingSpaces.java
+++ b/application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingSpaces.java
@@ -1,4 +1,4 @@
-package org.opentripplanner.routing.vehicle_parking;
+package org.opentripplanner.service.vehicleparking.model;
import java.io.Serializable;
import java.util.Objects;
diff --git a/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingState.java b/application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingState.java
similarity index 80%
rename from application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingState.java
rename to application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingState.java
index ff9178a9b34..e3af795459c 100644
--- a/application/src/main/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingState.java
+++ b/application/src/main/java/org/opentripplanner/service/vehicleparking/model/VehicleParkingState.java
@@ -1,4 +1,4 @@
-package org.opentripplanner.routing.vehicle_parking;
+package org.opentripplanner.service.vehicleparking.model;
/**
* The state of the vehicle parking. TEMPORARILY_CLOSED and CLOSED are distinct states so that they
diff --git a/application/src/main/java/org/opentripplanner/standalone/OTPMain.java b/application/src/main/java/org/opentripplanner/standalone/OTPMain.java
index a10f8f8ef7b..ade5067a981 100644
--- a/application/src/main/java/org/opentripplanner/standalone/OTPMain.java
+++ b/application/src/main/java/org/opentripplanner/standalone/OTPMain.java
@@ -152,6 +152,7 @@ private static void startOTPServer(CommandLineParameters cli) {
app.graph(),
app.timetableRepository(),
app.worldEnvelopeRepository(),
+ app.vehicleParkingRepository(),
config.buildConfig(),
config.routerConfig(),
DataImportIssueSummary.combine(graphBuilder.issueSummary(), app.dataImportIssueSummary()),
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 49b43856011..b5b39ddee18 100644
--- a/application/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java
+++ b/application/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java
@@ -23,6 +23,7 @@
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.routing.graphfinder.GraphFinder;
import org.opentripplanner.service.realtimevehicles.RealtimeVehicleService;
+import org.opentripplanner.service.vehicleparking.VehicleParkingService;
import org.opentripplanner.service.vehiclerental.VehicleRentalService;
import org.opentripplanner.service.worldenvelope.WorldEnvelopeService;
import org.opentripplanner.standalone.config.routerconfig.VectorTileConfig;
@@ -96,6 +97,8 @@ public interface OtpServerRequestContext {
VehicleRentalService vehicleRentalService();
+ VehicleParkingService vehicleParkingService();
+
TransitTuningParameters transitTuningParameters();
RaptorTuningParameters raptorTuningParameters();
diff --git a/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java
index 279c3c48368..eb3fae5275f 100644
--- a/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java
+++ b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java
@@ -19,6 +19,8 @@
import org.opentripplanner.routing.algorithm.raptoradapter.transit.mappers.TransitLayerUpdater;
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.service.realtimevehicles.RealtimeVehicleRepository;
+import org.opentripplanner.service.vehicleparking.VehicleParkingRepository;
+import org.opentripplanner.service.vehicleparking.VehicleParkingService;
import org.opentripplanner.service.vehiclerental.VehicleRentalRepository;
import org.opentripplanner.service.worldenvelope.WorldEnvelopeRepository;
import org.opentripplanner.standalone.api.OtpServerRequestContext;
@@ -75,6 +77,7 @@ public class ConstructApplication {
GraphBuilderDataSources graphBuilderDataSources,
DataImportIssueSummary issueSummary,
EmissionsDataModel emissionsDataModel,
+ VehicleParkingRepository vehicleParkingRepository,
@Nullable StopConsolidationRepository stopConsolidationRepository,
StreetLimitationParameters streetLimitationParameters
) {
@@ -93,6 +96,7 @@ public class ConstructApplication {
.timetableRepository(timetableRepository)
.graphVisualizer(graphVisualizer)
.worldEnvelopeRepository(worldEnvelopeRepository)
+ .vehicleParkingRepository(vehicleParkingRepository)
.emissionsDataModel(emissionsDataModel)
.dataImportIssueSummary(issueSummary)
.stopConsolidationRepository(stopConsolidationRepository)
@@ -127,6 +131,7 @@ public GraphBuilder createGraphBuilder() {
graph(),
timetableRepository(),
factory.worldEnvelopeRepository(),
+ factory.vehicleParkingRepository(),
factory.emissionsDataModel(),
factory.stopConsolidationRepository(),
factory.streetLimitationParameters(),
@@ -163,6 +168,7 @@ private void setupTransitRoutingServer() {
graph(),
realtimeVehicleRepository(),
vehicleRentalRepository(),
+ vehicleParkingRepository(),
timetableRepository(),
routerConfig().updaterConfig()
);
@@ -266,6 +272,14 @@ public VehicleRentalRepository vehicleRentalRepository() {
return factory.vehicleRentalRepository();
}
+ public VehicleParkingService vehicleParkingService() {
+ return factory.vehicleParkingService();
+ }
+
+ public VehicleParkingRepository vehicleParkingRepository() {
+ return factory.vehicleParkingRepository();
+ }
+
public Graph graph() {
return factory.graph();
}
diff --git a/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java
index 7191b82e814..d6310c0c616 100644
--- a/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java
+++ b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java
@@ -22,6 +22,9 @@
import org.opentripplanner.service.realtimevehicles.RealtimeVehicleService;
import org.opentripplanner.service.realtimevehicles.configure.RealtimeVehicleRepositoryModule;
import org.opentripplanner.service.realtimevehicles.configure.RealtimeVehicleServiceModule;
+import org.opentripplanner.service.vehicleparking.VehicleParkingRepository;
+import org.opentripplanner.service.vehicleparking.VehicleParkingService;
+import org.opentripplanner.service.vehicleparking.configure.VehicleParkingServiceModule;
import org.opentripplanner.service.vehiclerental.VehicleRentalRepository;
import org.opentripplanner.service.vehiclerental.VehicleRentalService;
import org.opentripplanner.service.vehiclerental.configure.VehicleRentalRepositoryModule;
@@ -54,6 +57,7 @@
RealtimeVehicleRepositoryModule.class,
VehicleRentalServiceModule.class,
VehicleRentalRepositoryModule.class,
+ VehicleParkingServiceModule.class,
ConstructApplicationModule.class,
RideHailingServicesModule.class,
EmissionsServiceModule.class,
@@ -75,6 +79,8 @@ public interface ConstructApplicationFactory {
RealtimeVehicleService realtimeVehicleService();
VehicleRentalRepository vehicleRentalRepository();
VehicleRentalService vehicleRentalService();
+ VehicleParkingRepository vehicleParkingRepository();
+ VehicleParkingService vehicleParkingService();
DataImportIssueSummary dataImportIssueSummary();
@Nullable
@@ -121,6 +127,9 @@ Builder stopConsolidationRepository(
@Nullable StopConsolidationRepository stopConsolidationRepository
);
+ @BindsInstance
+ Builder vehicleParkingRepository(VehicleParkingRepository parkingRepository);
+
@BindsInstance
Builder dataImportIssueSummary(DataImportIssueSummary issueSummary);
diff --git a/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationModule.java b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationModule.java
index ab0f242f834..bbdd39c57d5 100644
--- a/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationModule.java
+++ b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationModule.java
@@ -16,6 +16,7 @@
import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripSchedule;
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.service.realtimevehicles.RealtimeVehicleService;
+import org.opentripplanner.service.vehicleparking.VehicleParkingService;
import org.opentripplanner.service.vehiclerental.VehicleRentalService;
import org.opentripplanner.service.worldenvelope.WorldEnvelopeService;
import org.opentripplanner.standalone.api.OtpServerRequestContext;
@@ -37,6 +38,7 @@ OtpServerRequestContext providesServerContext(
WorldEnvelopeService worldEnvelopeService,
RealtimeVehicleService realtimeVehicleService,
VehicleRentalService vehicleRentalService,
+ VehicleParkingService vehicleParkingService,
List rideHailingServices,
@Nullable StopConsolidationService stopConsolidationService,
StreetLimitationParametersService streetLimitationParametersService,
@@ -59,6 +61,7 @@ OtpServerRequestContext providesServerContext(
worldEnvelopeService,
realtimeVehicleService,
vehicleRentalService,
+ vehicleParkingService,
emissionsService,
sorlandsbanenService,
routerConfig.flexParameters(),
diff --git a/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java b/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java
index 300eb24f997..021af778345 100644
--- a/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java
+++ b/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java
@@ -8,6 +8,7 @@
import org.opentripplanner.graph_builder.issue.api.DataImportIssueSummary;
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.routing.graph.SerializedGraphObject;
+import org.opentripplanner.service.vehicleparking.VehicleParkingRepository;
import org.opentripplanner.service.worldenvelope.WorldEnvelopeRepository;
import org.opentripplanner.standalone.config.CommandLineParameters;
import org.opentripplanner.standalone.config.ConfigModel;
@@ -56,6 +57,7 @@ public ConstructApplication appConstruction(SerializedGraphObject obj) {
obj.graph,
obj.timetableRepository,
obj.worldEnvelopeRepository,
+ obj.parkingRepository,
obj.issueSummary,
obj.emissionsDataModel,
obj.stopConsolidationRepository,
@@ -69,6 +71,7 @@ public ConstructApplication appConstruction() {
factory.emptyGraph(),
factory.emptyTimetableRepository(),
factory.emptyWorldEnvelopeRepository(),
+ factory.emptyVehicleParkingRepository(),
DataImportIssueSummary.empty(),
factory.emptyEmissionsDataModel(),
factory.emptyStopConsolidationRepository(),
@@ -91,6 +94,7 @@ private ConstructApplication createAppConstruction(
Graph graph,
TimetableRepository timetableRepository,
WorldEnvelopeRepository worldEnvelopeRepository,
+ VehicleParkingRepository parkingRepository,
DataImportIssueSummary issueSummary,
@Nullable EmissionsDataModel emissionsDataModel,
@Nullable StopConsolidationRepository stopConsolidationRepository,
@@ -105,6 +109,7 @@ private ConstructApplication createAppConstruction(
graphBuilderDataSources(),
issueSummary,
emissionsDataModel,
+ parkingRepository,
stopConsolidationRepository,
streetLimitationParameters
);
diff --git a/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplicationFactory.java b/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplicationFactory.java
index 8d11d645c48..b054fac3ca5 100644
--- a/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplicationFactory.java
+++ b/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplicationFactory.java
@@ -11,6 +11,8 @@
import org.opentripplanner.ext.stopconsolidation.configure.StopConsolidationRepositoryModule;
import org.opentripplanner.graph_builder.GraphBuilderDataSources;
import org.opentripplanner.routing.graph.Graph;
+import org.opentripplanner.service.vehicleparking.VehicleParkingRepository;
+import org.opentripplanner.service.vehicleparking.configure.VehicleParkingRepositoryModule;
import org.opentripplanner.service.worldenvelope.WorldEnvelopeRepository;
import org.opentripplanner.service.worldenvelope.configure.WorldEnvelopeRepositoryModule;
import org.opentripplanner.standalone.config.CommandLineParameters;
@@ -30,6 +32,7 @@
GsDataSourceModule.class,
WorldEnvelopeRepositoryModule.class,
StopConsolidationRepositoryModule.class,
+ VehicleParkingRepositoryModule.class,
}
)
public interface LoadApplicationFactory {
@@ -58,6 +61,9 @@ public interface LoadApplicationFactory {
@Singleton
StreetLimitationParameters emptyStreetLimitationParameters();
+ @Singleton
+ VehicleParkingRepository emptyVehicleParkingRepository();
+
@Component.Builder
interface Builder {
@BindsInstance
diff --git a/application/src/main/java/org/opentripplanner/standalone/server/DefaultServerRequestContext.java b/application/src/main/java/org/opentripplanner/standalone/server/DefaultServerRequestContext.java
index 9f38db5c420..1427dcf1971 100644
--- a/application/src/main/java/org/opentripplanner/standalone/server/DefaultServerRequestContext.java
+++ b/application/src/main/java/org/opentripplanner/standalone/server/DefaultServerRequestContext.java
@@ -21,6 +21,7 @@
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.routing.service.DefaultRoutingService;
import org.opentripplanner.service.realtimevehicles.RealtimeVehicleService;
+import org.opentripplanner.service.vehicleparking.VehicleParkingService;
import org.opentripplanner.service.vehiclerental.VehicleRentalService;
import org.opentripplanner.service.worldenvelope.WorldEnvelopeService;
import org.opentripplanner.standalone.api.HttpRequestScoped;
@@ -47,6 +48,7 @@ public class DefaultServerRequestContext implements OtpServerRequestContext {
private final WorldEnvelopeService worldEnvelopeService;
private final RealtimeVehicleService realtimeVehicleService;
private final VehicleRentalService vehicleRentalService;
+ private final VehicleParkingService vehicleParkingService;
private final EmissionsService emissionsService;
@Nullable
@@ -73,6 +75,7 @@ private DefaultServerRequestContext(
WorldEnvelopeService worldEnvelopeService,
RealtimeVehicleService realtimeVehicleService,
VehicleRentalService vehicleRentalService,
+ VehicleParkingService vehicleParkingService,
@Nullable EmissionsService emissionsService,
@Nullable SorlandsbanenNorwayService sorlandsbanenService,
List rideHailingServices,
@@ -90,6 +93,7 @@ private DefaultServerRequestContext(
this.tileRendererManager = tileRendererManager;
this.vectorTileConfig = vectorTileConfig;
this.vehicleRentalService = vehicleRentalService;
+ this.vehicleParkingService = vehicleParkingService;
this.flexParameters = flexParameters;
this.traverseVisitor = traverseVisitor;
this.routeRequestDefaults = routeRequestDefaults;
@@ -117,6 +121,7 @@ public static DefaultServerRequestContext create(
WorldEnvelopeService worldEnvelopeService,
RealtimeVehicleService realtimeVehicleService,
VehicleRentalService vehicleRentalService,
+ VehicleParkingService vehicleParkingService,
@Nullable EmissionsService emissionsService,
@Nullable SorlandsbanenNorwayService sorlandsbanenService,
FlexParameters flexParameters,
@@ -138,6 +143,7 @@ public static DefaultServerRequestContext create(
worldEnvelopeService,
realtimeVehicleService,
vehicleRentalService,
+ vehicleParkingService,
emissionsService,
sorlandsbanenService,
rideHailingServices,
@@ -201,6 +207,11 @@ public VehicleRentalService vehicleRentalService() {
return vehicleRentalService;
}
+ @Override
+ public VehicleParkingService vehicleParkingService() {
+ return vehicleParkingService;
+ }
+
@Override
public TransitTuningParameters transitTuningParameters() {
return transitRoutingConfig;
diff --git a/application/src/main/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLink.java b/application/src/main/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLink.java
index 682aeca0b3e..ac046dd45df 100644
--- a/application/src/main/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLink.java
+++ b/application/src/main/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLink.java
@@ -4,7 +4,7 @@
import org.opentripplanner.framework.geometry.GeometryUtils;
import org.opentripplanner.framework.i18n.I18NString;
import org.opentripplanner.routing.api.request.preference.VehicleParkingPreferences;
-import org.opentripplanner.routing.vehicle_parking.VehicleParking;
+import org.opentripplanner.service.vehicleparking.model.VehicleParking;
import org.opentripplanner.street.model.vertex.StreetVertex;
import org.opentripplanner.street.model.vertex.VehicleParkingEntranceVertex;
import org.opentripplanner.street.search.TraverseMode;
diff --git a/application/src/main/java/org/opentripplanner/street/model/edge/VehicleParkingEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/VehicleParkingEdge.java
index 95d9ea5507d..a7aa7bb2535 100644
--- a/application/src/main/java/org/opentripplanner/street/model/edge/VehicleParkingEdge.java
+++ b/application/src/main/java/org/opentripplanner/street/model/edge/VehicleParkingEdge.java
@@ -8,7 +8,7 @@
import org.opentripplanner.routing.api.request.preference.CarPreferences;
import org.opentripplanner.routing.api.request.preference.RoutingPreferences;
import org.opentripplanner.routing.api.request.preference.VehicleParkingPreferences;
-import org.opentripplanner.routing.vehicle_parking.VehicleParking;
+import org.opentripplanner.service.vehicleparking.model.VehicleParking;
import org.opentripplanner.street.model.vertex.VehicleParkingEntranceVertex;
import org.opentripplanner.street.search.TraverseMode;
import org.opentripplanner.street.search.request.StreetSearchRequest;
diff --git a/application/src/main/java/org/opentripplanner/street/model/vertex/VehicleParkingEntranceVertex.java b/application/src/main/java/org/opentripplanner/street/model/vertex/VehicleParkingEntranceVertex.java
index 591f71f1869..9a4e64dc2d6 100644
--- a/application/src/main/java/org/opentripplanner/street/model/vertex/VehicleParkingEntranceVertex.java
+++ b/application/src/main/java/org/opentripplanner/street/model/vertex/VehicleParkingEntranceVertex.java
@@ -3,8 +3,8 @@
import java.util.Collection;
import java.util.Objects;
import org.opentripplanner.framework.i18n.I18NString;
-import org.opentripplanner.routing.vehicle_parking.VehicleParking;
-import org.opentripplanner.routing.vehicle_parking.VehicleParkingEntrance;
+import org.opentripplanner.service.vehicleparking.model.VehicleParking;
+import org.opentripplanner.service.vehicleparking.model.VehicleParkingEntrance;
import org.opentripplanner.street.model.edge.Edge;
import org.opentripplanner.street.model.edge.StreetVehicleParkingLink;
import org.opentripplanner.street.model.edge.VehicleParkingEdge;
diff --git a/application/src/main/java/org/opentripplanner/street/model/vertex/VertexFactory.java b/application/src/main/java/org/opentripplanner/street/model/vertex/VertexFactory.java
index 80bd8021309..422fc16c837 100644
--- a/application/src/main/java/org/opentripplanner/street/model/vertex/VertexFactory.java
+++ b/application/src/main/java/org/opentripplanner/street/model/vertex/VertexFactory.java
@@ -6,8 +6,8 @@
import org.opentripplanner.framework.i18n.I18NString;
import org.opentripplanner.osm.model.OsmNode;
import org.opentripplanner.routing.graph.Graph;
-import org.opentripplanner.routing.vehicle_parking.VehicleParking;
-import org.opentripplanner.routing.vehicle_parking.VehicleParkingEntrance;
+import org.opentripplanner.service.vehicleparking.model.VehicleParking;
+import org.opentripplanner.service.vehicleparking.model.VehicleParkingEntrance;
import org.opentripplanner.service.vehiclerental.model.VehicleRentalPlace;
import org.opentripplanner.service.vehiclerental.street.VehicleRentalPlaceVertex;
import org.opentripplanner.street.model.edge.StreetEdge;
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 8b2fc784587..a1112575cc6 100644
--- a/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java
+++ b/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java
@@ -94,18 +94,18 @@ public DefaultTransitService(
}
@Override
- public Collection getFeedIds() {
+ public Collection listFeedIds() {
return this.timetableRepository.getFeedIds();
}
@Override
- public Collection getAgencies() {
+ public Collection listAgencies() {
OTPRequestTimeoutException.checkForTimeout();
return this.timetableRepository.getAgencies();
}
@Override
- public Optional findAgencyById(FeedScopedId id) {
+ public Optional findAgency(FeedScopedId id) {
return this.timetableRepository.findAgencyById(id);
}
@@ -125,29 +125,23 @@ public void addFeedInfo(FeedInfo info) {
}
@Override
- public Collection getNoticesByEntity(AbstractTransitEntity, ?> entity) {
+ public Collection findNotices(AbstractTransitEntity, ?> entity) {
return this.timetableRepository.getNoticesByElement().get(entity);
}
@Override
- public TripPattern getTripPatternForId(FeedScopedId id) {
+ public TripPattern getTripPattern(FeedScopedId id) {
return this.timetableRepository.getTripPatternForId(id);
}
@Override
- public Collection getAllTripPatterns() {
+ public Collection listTripPatterns() {
OTPRequestTimeoutException.checkForTimeout();
return this.timetableRepository.getAllTripPatterns();
}
@Override
- public Collection getNotices() {
- OTPRequestTimeoutException.checkForTimeout();
- return this.timetableRepository.getNoticesByElement().values();
- }
-
- @Override
- public Station getStationById(FeedScopedId id) {
+ public Station getStation(FeedScopedId id) {
return this.timetableRepository.getSiteRepository().getStationById(id);
}
@@ -157,13 +151,13 @@ public MultiModalStation getMultiModalStation(FeedScopedId id) {
}
@Override
- public Collection getStations() {
+ public Collection listStations() {
OTPRequestTimeoutException.checkForTimeout();
return this.timetableRepository.getSiteRepository().listStations();
}
@Override
- public Integer getServiceCodeForId(FeedScopedId id) {
+ public Integer getServiceCode(FeedScopedId id) {
return this.timetableRepository.getServiceCodes().get(id);
}
@@ -175,7 +169,7 @@ public TIntSet getServiceCodesRunningForDate(LocalDate serviceDate) {
}
@Override
- public Agency getAgencyForId(FeedScopedId id) {
+ public Agency getAgency(FeedScopedId id) {
return this.timetableRepositoryIndex.getAgencyForId(id);
}
@@ -185,7 +179,7 @@ public RegularStop getRegularStop(FeedScopedId id) {
}
@Override
- public Route getRouteForId(FeedScopedId id) {
+ public Route getRoute(FeedScopedId id) {
TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot();
if (currentSnapshot != null) {
Route realtimeAddedRoute = currentSnapshot.getRealtimeAddedRoute(id);
@@ -206,25 +200,25 @@ public void addRoutes(Route route) {
}
@Override
- public Set getRoutesForStop(StopLocation stop) {
+ public Set findRoutes(StopLocation stop) {
OTPRequestTimeoutException.checkForTimeout();
return this.timetableRepositoryIndex.getRoutesForStop(stop);
}
@Override
- public Collection getPatternsForStop(StopLocation stop) {
+ public Collection findPatterns(StopLocation stop) {
OTPRequestTimeoutException.checkForTimeout();
return this.timetableRepositoryIndex.getPatternsForStop(stop);
}
@Override
- public Collection getAllOperators() {
+ public Collection listOperators() {
OTPRequestTimeoutException.checkForTimeout();
return this.timetableRepository.getOperators();
}
@Override
- public Operator getOperatorForId(FeedScopedId id) {
+ public Operator getOperator(FeedScopedId id) {
return this.timetableRepositoryIndex.getOperatorForId(id);
}
@@ -246,7 +240,7 @@ public StopLocation getStopLocation(FeedScopedId id) {
}
@Override
- public Collection getStopOrChildStops(FeedScopedId id) {
+ public Collection findStopOrChildStops(FeedScopedId id) {
return timetableRepository.getSiteRepository().findStopOrChildStops(id);
}
@@ -262,7 +256,7 @@ public StopLocationsGroup getStopLocationsGroup(FeedScopedId id) {
}
@Override
- public Trip getTripForId(FeedScopedId id) {
+ public Trip getTrip(FeedScopedId id) {
TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot();
if (currentSnapshot != null) {
Trip trip = currentSnapshot.getRealTimeAddedTrip(id);
@@ -270,17 +264,17 @@ public Trip getTripForId(FeedScopedId id) {
return trip;
}
}
- return getScheduledTripForId(id);
+ return getScheduledTrip(id);
}
@Nullable
@Override
- public Trip getScheduledTripForId(FeedScopedId id) {
+ public Trip getScheduledTrip(FeedScopedId id) {
return this.timetableRepositoryIndex.getTripForId(id);
}
@Override
- public Collection getAllTrips() {
+ public Collection listTrips() {
OTPRequestTimeoutException.checkForTimeout();
TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot();
if (currentSnapshot != null) {
@@ -293,7 +287,7 @@ public Collection getAllTrips() {
}
@Override
- public Collection getAllRoutes() {
+ public Collection