
org.opentripplanner.service.package.md Maven / Gradle / Ivy
The newest version!
# Service package
This package contains small services usually specific to one or a few use-cases. In contrast
to a domain model they may use one or many domain models and other services, as long as there
are no cyclic dependencies.
The typical package structure of the `` service:
```
o.o.service.
configure -- Dependency Injection configuration
Module
grapbuilder -- If this module has its own graph-builder module
GraphBuilderModule
internal -- Internal implementaion
DefaultService
DefaultRepository
model -- Public model/api
Service -- Interface for the (read-only) service
Repository -- Optional interface for updating the model (in memory)
```
- The `grapbuilder` is just an example, in case this service has its own
graph-builder module.
- The `internal` package can be split into sub-packages, if needed.
- The aggregate root `Service` is defined in the root package.
- The `Repository` interface is only needed if the repository
is used outside the module by an updater or another service.
- Both the `DefaultRepository` and `DefaultService` should be
thread safe.
- The `DefaultRepository` should be serialized in the `graph.obj` file and hence
needs to be `Serializable`.
The `worldenvelope` service is used to illustrate the above example; Hence the `worldenvelope`
has a `WorldEnvelopeRepository` even if it is not required.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy